From 3810cfb433308dd9ced9c2185ecbb5f206e07f4c Mon Sep 17 00:00:00 2001 From: elijah Date: Wed, 19 Apr 2017 19:51:50 -0700 Subject: [feat] added app buttons (quit & about bitmask) - Closes #8803 --- ui/app/components/bye_splash.js | 99 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 ui/app/components/bye_splash.js (limited to 'ui/app/components/bye_splash.js') diff --git a/ui/app/components/bye_splash.js b/ui/app/components/bye_splash.js new file mode 100644 index 00000000..633aa3d3 --- /dev/null +++ b/ui/app/components/bye_splash.js @@ -0,0 +1,99 @@ +/* + * a parting window + */ + +import React from 'react' +import Center from 'components/center' +import bitmask from 'lib/bitmask' + +export default class ByeSplash extends React.Component { + + static get defaultProps() {return{ + delay: 1000 + }} + + constructor(props) { + super(props) + this.state = { + errorMessage: null, + readyToQuit: false + } + this.tick = this.tick.bind(this) + } + + componentDidMount() { + this.interval = setInterval(this.tick, this.props.delay) + bitmask.core.stop().then(msg => { + console.log(msg) + this.setState({readyToQuit: true}) + }, error => { + console.log(error) + this.setState({errorMessage: error}) + }) + } + + componentWillUnmount() { + clearInterval(this.interval) + } + + tick() { + if (this.state.readyToQuit) { + if (typeof(bitmaskApp) == 'undefined') { + window.close() + } else { + bitmaskApp.shutdown() + } + } else { + clearInterval(this.interval) + this.interval = setInterval(this.tick, 200) + } + } + + render () { + let message = null + let messageClass = "ok" + if (this.state.errorMessage) { + messageClass = "error" + message = this.state.errorMessage + } + + let backgroundStyle = { + position: "absolute", + width: "100%", + height: "100%", + backgroundColor: "#333" + } + let foregroundStyle = { + marginTop: "10px", + color: "#999", + textAlign: "center" + } + let style = ` + .mask, .ok { + animation: fadeout 2s infinite ease-in-out; + -webkit-animation: fadeout 2s infinite ease-in-out; + } + @keyframes fadeout { + 0% {opacity: 1} + 50% {opacity: 0} + 100% {opacity: 1} + } + @-webkit-keyframes fadeout { + 0% {opacity: 1} + 50% {opacity: 0} + 100% {opacity: 1} + } + ` + return ( +
+ +
+ +
+ {message} +
+
+
+ ) + } +} \ No newline at end of file -- cgit v1.2.3