aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/delayApp/Component.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/features/delayApp/Component.js')
-rw-r--r--src/features/delayApp/Component.js19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/features/delayApp/Component.js b/src/features/delayApp/Component.js
index 403340c7b..5c6ceaf86 100644
--- a/src/features/delayApp/Component.js
+++ b/src/features/delayApp/Component.js
@@ -6,7 +6,7 @@ import injectSheet from 'react-jss';
6 6
7import Button from '../../components/ui/Button'; 7import Button from '../../components/ui/Button';
8 8
9import { config } from './'; 9import { config } from '.';
10import styles from './styles'; 10import styles from './styles';
11 11
12const messages = defineMessages({ 12const messages = defineMessages({
@@ -38,10 +38,14 @@ export default @inject('actions') @injectSheet(styles) @observer class DelayApp
38 countdown: config.delayDuration, 38 countdown: config.delayDuration,
39 } 39 }
40 40
41 countdownInterval = null;
42
43 countdownIntervalTimeout = 1000;
44
41 componentDidMount() { 45 componentDidMount() {
42 this.countdownInterval = setInterval(() => { 46 this.countdownInterval = setInterval(() => {
43 this.setState({ 47 this.setState({
44 countdown: this.state.countdown - this.countdownIntervalTimeout, 48 countdown: prevState => ({ value: prevState.countdown - this.countdownIntervalTimeout }),
45 }); 49 });
46 50
47 if (this.state.countdown <= 0) { 51 if (this.state.countdown <= 0) {
@@ -55,9 +59,6 @@ export default @inject('actions') @injectSheet(styles) @observer class DelayApp
55 clearInterval(this.countdownInterval); 59 clearInterval(this.countdownInterval);
56 } 60 }
57 61
58 countdownInterval = null;
59 countdownIntervalTimeout = 1000;
60
61 render() { 62 render() {
62 const { classes, actions } = this.props; 63 const { classes, actions } = this.props;
63 const { intl } = this.context; 64 const { intl } = this.context;
@@ -71,9 +72,11 @@ export default @inject('actions') @injectSheet(styles) @observer class DelayApp
71 buttonType="inverted" 72 buttonType="inverted"
72 onClick={() => actions.ui.openSettings({ path: 'user' })} 73 onClick={() => actions.ui.openSettings({ path: 'user' })}
73 /> 74 />
74 <p className="footnote">{intl.formatMessage(messages.text, { 75 <p className="footnote">
75 seconds: this.state.countdown / 1000, 76 {intl.formatMessage(messages.text, {
76 })}</p> 77 seconds: this.state.countdown / 1000,
78 })}
79 </p>
77 </div> 80 </div>
78 ); 81 );
79 } 82 }