Skip to content

Commit

Permalink
Allow to reload extension from within error modal
Browse files Browse the repository at this point in the history
  • Loading branch information
buberdds committed Mar 28, 2024
1 parent 13d3d5a commit 6375c11
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions .changelog/1860.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow to reload extension from within error modal
17 changes: 17 additions & 0 deletions src/app/components/FatalErrorHandler/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ import { TextArea } from 'grommet/es6/components/TextArea'
import { Text } from 'grommet/es6/components/Text'
import { Copy } from 'grommet-icons/es6/icons/Copy'
import { Dashboard } from 'grommet-icons/es6/icons/Dashboard'
import { Refresh } from 'grommet-icons/es6/icons/Refresh'
import * as React from 'react'
import { useContext, useState } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { useSelector } from 'react-redux'
import { normalizeColor } from 'grommet/es6/utils'
import { ResponsiveLayer } from '../ResponsiveLayer'
import logotype from '../../../../public/logo192.png'
import { runtimeIs } from 'config'

const StyledTextArea = styled(TextArea)`
// Opacity is a workaround for browsers anti-aliasing issue triggered by border-radius.
Expand Down Expand Up @@ -116,6 +118,21 @@ export function FatalErrorHandler({ children }: Props) {
size="large"
/>
</Box>
<Box align={isMobile ? 'stretch' : 'end'} margin={{ bottom: isMobile ? 'xlarge' : 'large' }}>
{runtimeIs === 'extension' && (
<StyledButton
onClick={() => (window as any).chrome?.runtime?.reload()}
icon={<Refresh size="22px" color={normalizeColor('brand-white', theme)} />}
label={t('fatalError.reloadExtension', 'Reload extension')}
style={{
backgroundColor: normalizeColor('brand-blue', theme),
color: normalizeColor('brand-white', theme),
borderColor: normalizeColor('brand-blue', theme),
}}
size="large"
/>
)}
</Box>
<Text size="small">
<Trans
i18nKey="fatalError.instruction"
Expand Down
3 changes: 2 additions & 1 deletion src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@
"copy": "Copy error to clipboard",
"description": "The error that has occurred triggers the wallet to stop. <strong>Your funds are safe.</strong><br/><br/>Please try refreshing the page and reopening your wallet to see if the issue persists. You can check the current status of the network below.",
"heading": "An error occurred.",
"instruction": "If the issue is not resolved after refreshing, please email our support team at <Email/> and attached the error report."
"instruction": "If the issue is not resolved after refreshing, please email our support team at <Email/> and attached the error report.",
"reload": "Reload extension"
},
"fiatOnramp": {
"astarFootnote": "It is hereby noted that AStar Technologies, a Cayman Islands exempted company is acting on behalf and for the purposes of Oasis, and is also the provider of the Oasis Wallet.",
Expand Down

0 comments on commit 6375c11

Please sign in to comment.