Skip to content

Commit b33a238

Browse files
committed
feat(neuron-ui): add check on current wallet id on leaving settings view
1 parent 4c9f8fc commit b33a238

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

  • packages/neuron-ui/src/components/Settings

packages/neuron-ui/src/components/Settings/index.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { StateWithDispatch } from 'states/stateProvider/reducer'
99
import GeneralSetting from 'components/GeneralSetting'
1010
import Wallets from 'components/WalletSetting'
1111
import NetworkSetting from 'components/NetworkSetting'
12+
import { WalletWizardPath } from 'components/WalletWizard'
1213

1314
import { Routes } from 'utils/const'
1415

@@ -46,15 +47,16 @@ const Settings = ({
4647
...neuronWalletState
4748
}: React.PropsWithoutRef<StateWithDispatch & RouteComponentProps>) => {
4849
const [t] = useTranslation()
49-
const goBack = useCallback(() => {
50-
history.goBack()
51-
}, [history])
50+
const { id } = neuronWalletState.wallet
51+
const onLeave = useCallback(() => {
52+
return id ? history.push(Routes.Overview) : history.push(`${Routes.WalletWizard}${WalletWizardPath.Welcome}`)
53+
}, [id, history])
5254

5355
return (
5456
<Stack tokens={{ childrenGap: 15 }}>
5557
<Stack horizontal>
5658
<Stack.Item align="center">
57-
<IconButton onClick={goBack} styles={{ root: { marginRight: 20 } }}>
59+
<IconButton onClick={onLeave} styles={{ root: { marginRight: 20 } }}>
5860
<FormPreviousLink />
5961
</IconButton>
6062
</Stack.Item>

0 commit comments

Comments
 (0)