diff --git a/src/components/SettingsPage/RepairDeviceButton.js b/src/components/SettingsPage/RepairDeviceButton.js index e876a789..d627cad0 100644 --- a/src/components/SettingsPage/RepairDeviceButton.js +++ b/src/components/SettingsPage/RepairDeviceButton.js @@ -22,7 +22,6 @@ type State = { isLoading: boolean, error: ?Error, progress: number, - confirmed: boolean, } class RepairDeviceButton extends PureComponent { @@ -31,18 +30,15 @@ class RepairDeviceButton extends PureComponent { isLoading: false, error: null, progress: 0, - confirmed: false, } open = () => this.setState({ opened: true, error: null }) - setConfirm = () => this.setState({ confirmed: true }) - sub: * close = () => { if (this.sub) this.sub.unsubscribe() - this.setState({ opened: false, isLoading: false, error: null, confirmed: false }) + this.setState({ opened: false, isLoading: false, error: null, progress: 0 }) } action = () => { @@ -54,10 +50,10 @@ class RepairDeviceButton extends PureComponent { this.setState(patch) }, error: error => { - this.setState({ error, isLoading: false, confirmed: false }) + this.setState({ error, isLoading: false, progress: 0 }) }, complete: () => { - this.setState({ opened: false, isLoading: false, confirmed: false }, () => { + this.setState({ opened: false, isLoading: false, progress: 0 }, () => { push('/manager') }) }, @@ -66,7 +62,7 @@ class RepairDeviceButton extends PureComponent { render() { const { t } = this.props - const { opened, isLoading, error, progress, confirmed } = this.state + const { opened, isLoading, error, progress } = this.state return ( @@ -87,8 +83,6 @@ class RepairDeviceButton extends PureComponent { confirmText={t('settings.repairDevice.button')} progress={progress} error={error} - setConfirm={this.setConfirm} - confirmed={confirmed} /> ) diff --git a/src/components/base/Modal/RepairModal.js b/src/components/base/Modal/RepairModal.js index 5d8f7ee8..37d00df9 100644 --- a/src/components/base/Modal/RepairModal.js +++ b/src/components/base/Modal/RepairModal.js @@ -46,49 +46,48 @@ const DisclaimerStep = ({ desc }: { desc?: string }) => ( ) -const ConnectStep = ({ t }: { t: * }) => ( - - - - {'1.'} - {t('manager.modal.mcuFirst')} - - {t('manager.modal.mcuFirst')} - - - - - {'2.'} - {t('manager.modal.mcuSecond')} - - {t('manager.modal.mcuFirst')} - - -) - -const FlashStep = ({ progress, t }: { progress: number, t: * }) => ( - - - - - - {t(`manager.modal.steps.flash`)} - - - - {t('manager.modal.mcuPin')} - - - -) +const FlashStep = ({ progress, t }: { progress: number, t: * }) => + progress === 0 ? ( + + + + {'1.'} + {t('manager.modal.mcuFirst')} + + {t('manager.modal.mcuFirst')} + + + + + {'2.'} + {t('manager.modal.mcuSecond')} + + {t('manager.modal.mcuFirst')} + + + ) : ( + + + + + + {t(`manager.modal.steps.flash`)} + + + + {t('manager.modal.mcuPin')} + + + + ) const ErrorStep = ({ error }: { error: Error }) => ( @@ -137,15 +136,9 @@ type Props = { cancellable?: boolean, progress: number, error?: Error, - confirmed: boolean, - setConfirm: Function, -} - -type State = { - confirmed: boolean, } -class RepairModal extends PureComponent { +class RepairModal extends PureComponent { render() { const { cancellable, @@ -162,8 +155,6 @@ class RepairModal extends PureComponent { analyticsName, progress, error, - confirmed, - setConfirm, ...props } = this.props @@ -182,28 +173,26 @@ class RepairModal extends PureComponent { ) : isLoading ? ( - ) : confirmed ? ( - ) : ( )} - - {!isLoading && ( + {!isLoading ? ( + - )} - {error ? null : ( - - )} - + {error ? null : ( + + )} + + ) : null} )} />