Skip to content

Commit

Permalink
Merge pull request #181 from CityOfZion/CU-86a4wpzuv-2
Browse files Browse the repository at this point in the history
CU-86a4wpzuv-NEON3 - Wipe Local Data
  • Loading branch information
thiagocbalducci authored Sep 16, 2024
2 parents 2a89aa1 + f59e3da commit 8054267
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 4 deletions.
9 changes: 9 additions & 0 deletions src/renderer/src/components/SuccessIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'
import { TbDiscountCheck } from 'react-icons/tb'

export const SuccessIcon: React.FC = () => (
<TbDiscountCheck
className={'text-blue stroke-1 bg-asphalt rounded-[50%] p-1.5 mt-8 w-[118px] h-[118px]'}
aria-hidden={true}
/>
)
6 changes: 6 additions & 0 deletions src/renderer/src/locales/en/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@
}
}
},
"forgottenPasswordSuccess": {
"title": "Success!",
"text": "You’ve reset Neon",
"description": "All local app data has been removed and you’re now ready to start over",
"goToWelcome": "Go to welcome screen"
},
"send": {
"title": "Send Tokens",
"leftSideTitle": "Token balances",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@ import { useTranslation } from 'react-i18next'
import { useNavigate } from 'react-router-dom'
import { Banner } from '@renderer/components/Banner'
import { Swipe } from '@renderer/components/Swipe'
import { ToastHelper } from '@renderer/helpers/ToastHelper'
import { useAppDispatch } from '@renderer/hooks/useRedux'
import { WelcomeLayout } from '@renderer/layouts/Welcome'
import { settingsReducerActions } from '@renderer/store/reducers/SettingsReducer'
import { RootStore } from '@renderer/store/RootStore'

export const ForgottenPasswordConfirmPage = () => {
const { t } = useTranslation('pages', { keyPrefix: 'forgottenPasswordConfirm' })
const navigate = useNavigate()
const dispatch = useAppDispatch()

const clearData = async () => {
await RootStore.persistor.purge()

ToastHelper.success({ message: t('success') })

navigate('/welcome')
dispatch(settingsReducerActions.setIsFirstTime(false))
navigate('/forgotten-password-success')
}

return (
Expand Down
28 changes: 28 additions & 0 deletions src/renderer/src/routes/pages/ForgottenPassword/Success/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react'
import { useTranslation } from 'react-i18next'
import { Link } from '@renderer/components/Link'
import { SuccessIcon } from '@renderer/components/SuccessIcon'
import { WelcomeLayout } from '@renderer/layouts/Welcome'

export const ForgottenPasswordSuccessPage: React.FC = () => {
const { t } = useTranslation('pages', { keyPrefix: 'forgottenPasswordSuccess' })

return (
<WelcomeLayout heading={t('title')}>
<div className={'flex flex-col h-full text-center gap-y-6 items-center max-w-[280px]'}>
<SuccessIcon />

<p className={'text-white text-xl'}>{t('text')}</p>
<p className={'text-gray-300 text-sm flex-grow'}>{t('description')}</p>

<Link
to={'/neon-account'}
label={t('goToWelcome')}
colorSchema={'neon'}
variant={'contained'}
className={'w-full max-w-[250px] mx-auto'}
/>
</div>
</WelcomeLayout>
)
}
5 changes: 5 additions & 0 deletions src/renderer/src/routes/pagesRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { NeonAccountPage } from '@renderer/routes/pages/NeonAccountPage'

import { AppPage } from './pages/AppPage'
import { ContactsPage } from './pages/Contacts'
import { ForgottenPasswordSuccessPage } from './pages/ForgottenPassword/Success'
import { LoginPage } from './pages/Login'
import { PortfolioPage } from './pages/Portfolio'
import { PortfolioActivityPage } from './pages/Portfolio/Activity'
Expand Down Expand Up @@ -256,6 +257,10 @@ export const pagesRouter = routeHandler([
path: 'forgotten-password-confirm',
element: <ForgottenPasswordConfirmPage />,
},
{
path: 'forgotten-password-success',
element: <ForgottenPasswordSuccessPage />,
},
],
},
])

0 comments on commit 8054267

Please sign in to comment.