diff options
Diffstat (limited to 'src/features/delayApp')
-rw-r--r-- | src/features/delayApp/Component.js | 19 | ||||
-rw-r--r-- | src/features/delayApp/index.js | 1 |
2 files changed, 11 insertions, 9 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 | ||
7 | import Button from '../../components/ui/Button'; | 7 | import Button from '../../components/ui/Button'; |
8 | 8 | ||
9 | import { config } from './'; | 9 | import { config } from '.'; |
10 | import styles from './styles'; | 10 | import styles from './styles'; |
11 | 11 | ||
12 | const messages = defineMessages({ | 12 | const 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 | } |
diff --git a/src/features/delayApp/index.js b/src/features/delayApp/index.js index 9ffa1d2fd..d5c544b78 100644 --- a/src/features/delayApp/index.js +++ b/src/features/delayApp/index.js | |||
@@ -67,4 +67,3 @@ export default function init(stores) { | |||
67 | } | 67 | } |
68 | 68 | ||
69 | export const Component = DelayAppComponent; | 69 | export const Component = DelayAppComponent; |
70 | |||