From 179078d31a225fc5bdf68664c0f047be3911980b Mon Sep 17 00:00:00 2001 From: Jannis R Date: Thu, 17 Nov 2016 14:21:44 +0100 Subject: [PATCH] sms verification: loading step --- .../modals/SMSVerification/SMSVerification.js | 47 ++++++++++--------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/js/src/modals/SMSVerification/SMSVerification.js b/js/src/modals/SMSVerification/SMSVerification.js index 47124e7f6..4ec0b608d 100644 --- a/js/src/modals/SMSVerification/SMSVerification.js +++ b/js/src/modals/SMSVerification/SMSVerification.js @@ -22,7 +22,8 @@ import ContentClear from 'material-ui/svg-icons/content/clear'; import { Button, IdentityIcon, Modal } from '../../ui'; import { - GATHERING_DATA, GATHERED_DATA, + LOADING, + QUERY_DATA, POSTING_REQUEST, POSTED_REQUEST, REQUESTING_SMS, REQUESTED_SMS, POSTING_CONFIRMATION, POSTED_CONFIRMATION, @@ -44,15 +45,12 @@ export default class SMSVerification extends Component { } static phases = { // mapping (store steps -> steps) - [GATHERING_DATA]: 0, [GATHERED_DATA]: 0, - [POSTING_REQUEST]: 1, [POSTED_REQUEST]: 1, [REQUESTING_SMS]: 1, - [REQUESTED_SMS]: 2, - [POSTING_CONFIRMATION]: 3, [POSTED_CONFIRMATION]: 3, - [DONE]: 4 - } - - componentDidMount () { - this.props.store.gatherData(); + [LOADING]: 0, + [QUERY_DATA]: 1, + [POSTING_REQUEST]: 2, [POSTED_REQUEST]: 2, [REQUESTING_SMS]: 2, + [REQUESTED_SMS]: 3, + [POSTING_CONFIRMATION]: 4, [POSTED_CONFIRMATION]: 4, + [DONE]: 5 } render () { @@ -65,8 +63,8 @@ export default class SMSVerification extends Component { title='verify your account via SMS' visible scroll current={ phase } - steps={ ['Enter Data', 'Request', 'Enter Code', 'Confirm', 'Done!'] } - waiting={ error ? [] : [ 1, 3 ] } + steps={ ['Prepare', 'Enter Data', 'Request', 'Enter Code', 'Confirm', 'Done!'] } + waiting={ error ? [] : [ 0, 2, 4 ] } > { this.renderStep(phase, error) } @@ -87,7 +85,7 @@ export default class SMSVerification extends Component { return (
{ cancel }
); } - if (phase === 4) { + if (phase === 5) { return (
{ cancel } @@ -101,18 +99,18 @@ export default class SMSVerification extends Component { ); } - let action; + let action = () => {}; switch (phase) { - case 0: + case 1: action = store.sendRequest; break; - case 1: + case 2: action = store.queryCode; break; - case 2: + case 3: action = store.sendConfirmation; break; - case 3: + case 4: action = store.done; break; } @@ -142,13 +140,13 @@ export default class SMSVerification extends Component { setNumber, setConsentGiven, setCode } = this.props.store; - if (phase === 4) { + if (phase === 5) { return (); } - if (phase === 3) { + if (phase === 4) { return (); } - if (phase === 2) { + if (phase === 3) { return ( ); } - if (phase === 1) { + if (phase === 2) { return (); } - if (phase === 0) { + if (phase === 1) { const { setNumber, setConsentGiven } = this.props.store; return ( ); } + if (phase === 0) { + return (

Preparing awesomeness!

); + } return null; }