From 254c07a7042a9039331dcde2a8c6d910e26a3452 Mon Sep 17 00:00:00 2001 From: Anastasia Poupeney Date: Fri, 22 Jun 2018 16:26:03 +0200 Subject: [PATCH 1/2] add confirm to hard reset on the crash screen --- src/components/RenderError.js | 42 +++++++++++++++++-- .../SettingsPage/sections/Profile.js | 2 +- src/icons/TriangleWarning.js | 2 +- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/components/RenderError.js b/src/components/RenderError.js index 20f4f366..a660bf02 100644 --- a/src/components/RenderError.js +++ b/src/components/RenderError.js @@ -14,6 +14,9 @@ import ExportLogsBtn from 'components/ExportLogsBtn' import Box from 'components/base/Box' import Space from 'components/base/Space' import Button from 'components/base/Button' +import IconTriangleWarning from 'icons/TriangleWarning' +import ConfirmModal from './base/Modal/ConfirmModal' +import { IconWrapperCircle } from './SettingsPage/sections/Profile' type Props = { error: Error, @@ -22,11 +25,33 @@ type Props = { children?: *, } -class RenderError extends PureComponent { +class RenderError extends PureComponent< + Props, + { isHardResetting: boolean, isHardResetModalOpened: boolean }, +> { state = { isHardResetting: false, + isHardResetModalOpened: false, } + handleOpenHardResetModal = () => this.setState({ isHardResetModalOpened: true }) + handleCloseHardResetModal = () => this.setState({ isHardResetModalOpened: false }) + + handleHardReset = async () => { + this.setState({ isHardResetting: true }) + try { + await hardReset() + remote.getCurrentWindow().webContents.reloadIgnoringCache() + } catch (err) { + this.setState({ isHardResetting: false }) + } + } + hardResetIconRender = () => ( + + + + ) + handleCreateIssue = () => { const { error } = this.props if (!error) { @@ -60,7 +85,7 @@ ${error.stack} render() { const { error, t, disableExport, children } = this.props - const { isHardResetting } = this.state + const { isHardResetting, isHardResetModalOpened } = this.state return ( @@ -88,10 +113,21 @@ ${error.stack} - + {String(error)} diff --git a/src/components/SettingsPage/sections/Profile.js b/src/components/SettingsPage/sections/Profile.js index 703b1e99..f9a29f89 100644 --- a/src/components/SettingsPage/sections/Profile.js +++ b/src/components/SettingsPage/sections/Profile.js @@ -263,7 +263,7 @@ export default connect( )(TabProfile) // TODO: need a helper file for common styles across the app -const IconWrapperCircle = styled(Box).attrs({})` +export const IconWrapperCircle = styled(Box).attrs({})` width: 50px; height: 50px; border-radius: 50%; diff --git a/src/icons/TriangleWarning.js b/src/icons/TriangleWarning.js index 569fff9d..c53743bd 100644 --- a/src/icons/TriangleWarning.js +++ b/src/icons/TriangleWarning.js @@ -10,7 +10,7 @@ const path = ( ) export default ({ height, width, ...p }: { height: number, width: number }) => ( - + {path} ) From 4001d2887386c9dea375d96908aaa3a7fb6f360c Mon Sep 17 00:00:00 2001 From: Anastasia Poupeney Date: Fri, 22 Jun 2018 16:57:22 +0200 Subject: [PATCH 2/2] removing extra func definition --- src/components/RenderError.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/components/RenderError.js b/src/components/RenderError.js index a660bf02..23a0f39b 100644 --- a/src/components/RenderError.js +++ b/src/components/RenderError.js @@ -37,15 +37,6 @@ class RenderError extends PureComponent< handleOpenHardResetModal = () => this.setState({ isHardResetModalOpened: true }) handleCloseHardResetModal = () => this.setState({ isHardResetModalOpened: false }) - handleHardReset = async () => { - this.setState({ isHardResetting: true }) - try { - await hardReset() - remote.getCurrentWindow().webContents.reloadIgnoringCache() - } catch (err) { - this.setState({ isHardResetting: false }) - } - } hardResetIconRender = () => (