-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- browser bomb to warn of unsupported nature - add report error button to modal in case of no target available - add logos to header - set creation date as default title - rename session saving buttons and change saving modal text
- Loading branch information
1 parent
6fbccde
commit 4f17fff
Showing
13 changed files
with
227 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/** | ||
* Created by ricgillams on 14/06/2018. | ||
*/ | ||
|
||
import React from "react"; | ||
import {connect} from "react-redux"; | ||
import ReactModal from "react-modal"; | ||
import {Button} from 'react-bootstrap'; | ||
|
||
const customStyles = { | ||
overlay : { | ||
zIndex: 50, | ||
backgroundColor: 'rgba(0, 0, 0, 0.85)' | ||
}, | ||
content : { | ||
top: '50%', | ||
left: '50%', | ||
right: 'auto', | ||
bottom: 'auto', | ||
marginRight: '-20%', | ||
transform: 'translate(-50%, -50%)', | ||
border: '10px solid #7a7a7a' | ||
} | ||
}; | ||
|
||
export class BrowserBomb extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.closeModal = this.closeModal.bind(this); | ||
this.checkBrowser = this.checkBrowser.bind(this); | ||
this.state = { | ||
currentBrowser: undefined, | ||
notSupported: undefined | ||
}; | ||
} | ||
|
||
checkBrowser(){ | ||
if (typeof InstallTrigger !== 'undefined'){ | ||
this.setState(prevState => ({currentBrowser: "Firefox should be supported"})); | ||
this.setState(prevState => ({notSupported: false})); | ||
} else if (!!window.chrome && !!window.chrome.webstore){ | ||
this.setState(prevState => ({currentBrowser: "Chrome should be supported"})) | ||
this.setState(prevState => ({notSupported: false})); | ||
} else { | ||
this.setState(prevState => ({currentBrowser: "This browser may not perform properly. Please consider using Firefox or Chrome."})) | ||
this.setState(prevState => ({notSupported: true})); | ||
} | ||
} | ||
|
||
closeModal(){ | ||
this.setState(prevState => ({notSupported:undefined})); | ||
} | ||
|
||
componentWillMount() { | ||
ReactModal.setAppElement('body') | ||
this.checkBrowser() | ||
} | ||
|
||
componentWillReceiveProps(nextProps) { | ||
if (nextProps.errorMessage != undefined){ | ||
this.setState(prevState => ({errorMessage: nextProps.errorMessage})) | ||
} | ||
} | ||
|
||
render() { | ||
return ( | ||
<ReactModal isOpen={this.state.notSupported} style={customStyles}> | ||
<div> | ||
<h4>This browser is not supported by Fragalysis, please consider moving to | ||
<a href="https://www.google.com/chrome/"> Google Chrome</a> or <a href="https://www.mozilla.org/en-GB/firefox/">Mozilla Firefox.</a></h4> | ||
<Button bsSize="sm" bsStyle="success" onClick={this.closeModal}>Close</Button> | ||
</div> | ||
</ReactModal> | ||
); | ||
} | ||
} | ||
|
||
function mapStateToProps(state) { | ||
return { | ||
} | ||
} | ||
|
||
const mapDispatchToProps = { | ||
} | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(BrowserBomb); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.