diff --git a/src/components/RenderError.js b/src/components/RenderError.js index f8fb8a42..23034422 100644 --- a/src/components/RenderError.js +++ b/src/components/RenderError.js @@ -1,20 +1,20 @@ // @flow import React, { PureComponent } from 'react' -import styled from 'styled-components' import { shell, remote } from 'electron' import qs from 'querystring' import { translate } from 'react-i18next' -import { rgba } from 'styles/helpers' -import db from 'helpers/db' +import { i } from 'helpers/staticPath' +import hardReset from 'helpers/hardReset' import type { T } from 'types/common' import ExportLogsBtn from 'components/ExportLogsBtn' import Box from 'components/base/Box' +import Space from 'components/base/Space' import Button from 'components/base/Button' -import TranslatedError from './TranslatedError' +// import TranslatedError from './TranslatedError' type Props = { error: Error, @@ -23,25 +23,11 @@ type Props = { children?: *, } -const Container = styled(Box).attrs({ - grow: true, - align: 'center', - justify: 'center', - bg: 'lightGraphite', - color: 'alertRed', - ff: 'Museo Sans|Bold', - flow: 2, -})`` - -const Inner = styled(Box).attrs({ - p: 2, - bg: p => rgba(p.theme.colors.alertRed, 0.05), - borderRadius: 1, -})` - border: ${p => `1px solid ${rgba(p.theme.colors.alertRed, 0.1)}`}; -` +class RenderError extends PureComponent { + state = { + isHardResetting: false, + } -class RenderError extends PureComponent { handleCreateIssue = () => { const { error } = this.props if (!error) { @@ -60,27 +46,45 @@ ${error.stack} } handleRestart = () => { - remote.app.relaunch() - remote.app.exit() + remote.getCurrentWindow().webContents.reloadIgnoringCache() } - handleReset = () => { - db.resetAll() - this.handleRestart() + handleHardReset = async () => { + this.setState({ isHardResetting: true }) + try { + await hardReset() + remote.getCurrentWindow().webContents.reloadIgnoringCache() + } catch (err) { + this.setState({ isHardResetting: false }) + } } render() { - const { error, t, disableExport, children } = this.props + const { t, disableExport, children } = this.props + const { isHardResetting } = this.state return ( - - - - + + + + + {t('app:crash.oops')} + + + + {t('app:crash.uselessText')} + + - {!disableExport ? : null} @@ -89,9 +93,10 @@ ${error.stack} {children} - + ) } } +// export default translate()(RenderError) diff --git a/static/i18n/en/app.yml b/static/i18n/en/app.yml index 606a568f..ce8efa1c 100644 --- a/static/i18n/en/app.yml +++ b/static/i18n/en/app.yml @@ -368,6 +368,8 @@ update: newVersionReady: A new update is available. relaunch: Update now crash: + oops: Oops, something went wrong. + uselessText: You may try again by restarting Ledger Live. Please export your logs and contact Ledger Support if the problem persists. restart: Restart app - reset: Reset app files - createTicket: Create ticket + reset: Hard reset + createTicket: Create issue diff --git a/static/images/crash-screen.svg b/static/images/crash-screen.svg new file mode 100644 index 00000000..39fbc9a7 --- /dev/null +++ b/static/images/crash-screen.svg @@ -0,0 +1 @@ +Fichier 2 \ No newline at end of file