Skip to content

Commit

Permalink
Merge pull request #32 from novasamatech/feat/add-reset-wallet
Browse files Browse the repository at this point in the history
Feat: add reset wallet to restore page
  • Loading branch information
sokolova-an authored Dec 29, 2023
2 parents 9097e38 + 5e3232a commit 96883f4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 9 additions & 1 deletion src/screens/onboarding/restore/RestoreWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useGlobalContext } from '@/common/providers/contextProvider';
import { Avatar, Input } from '@nextui-org/react';
import { BodyText, TitleText } from '@/components/Typography';
import { Paths } from '@/common/routing';
import { initializeWalletFromCloud } from '@/common/wallet';
import { initializeWalletFromCloud, resetWallet } from '@/common/wallet';

type Props = {
mnemonic: string;
Expand Down Expand Up @@ -53,6 +53,11 @@ export const RestoreWalletPage = ({ mnemonic }: Props) => {
};
}, [password]);

function clearWallet() {
resetWallet();
router.replace(Paths.ONBOARDING);
}

return (
<>
<Avatar src={user?.photo_url} size="lg" className="w-[64px] h-[64px]" name={user?.first_name[0]} />
Expand All @@ -78,6 +83,9 @@ export const RestoreWalletPage = ({ mnemonic }: Props) => {
onValueChange={setPassword}
onClear={() => setPassword('')}
/>
<button className="btn btn-blue m-auto" onClick={() => clearWallet()}>
Reset Wallet
</button>
</>
);
};
7 changes: 5 additions & 2 deletions src/screens/onboarding/start/OnboardingStartPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ export const OnboardingStartPage = () => {

useEffect(() => {
MainButton?.show();
MainButton?.onClick(() => {
MainButton?.enable();
const callback = () => {
router.push(Paths.ONBOARDING_PASSWORD);
MainButton?.showProgress(false);
});
};
MainButton?.onClick(callback);

return () => {
MainButton?.offClick(callback);
MainButton?.hideProgress();
MainButton?.disable();
};
Expand Down

0 comments on commit 96883f4

Please sign in to comment.