diff --git a/nym-wallet/src/pages/welcome/pages/create-mnemonic.tsx b/nym-wallet/src/pages/welcome/pages/create-mnemonic.tsx
new file mode 100644
index 0000000000..c18c0c1b0f
--- /dev/null
+++ b/nym-wallet/src/pages/welcome/pages/create-mnemonic.tsx
@@ -0,0 +1,129 @@
+import React, { useContext, useEffect, useState } from 'react';
+import { Alert, Button, CircularProgress, Grid, ToggleButton, ToggleButtonGroup, Typography } from '@mui/material';
+import { CopyToClipboard } from '@nymproject/react';
+import { useSnackbar } from 'notistack';
+import { WordTiles } from '../components';
+import { TPages } from '../types';
+import { MnemonicInput } from '../components/textfields';
+import { SignInContext } from '../context';
+import { createPassword } from '../../../requests';
+
+export const CreateMnemonic = ({
+ page,
+ onNext,
+ onPrev,
+ onComplete,
+}: {
+ page: TPages;
+ onNext: () => void;
+ onPrev: () => void;
+ onComplete: () => void;
+}) => {
+ const [toggle, setToggle] = useState('new');
+ const [isLoading, setIsLoading] = useState(false);
+
+ const { password, mnemonic, mnemonicWords, error, generateMnemonic, validateMnemonic, setMnemonic, setError } =
+ useContext(SignInContext);
+
+ const { enqueueSnackbar } = useSnackbar();
+
+ const handleUseExisting = async () => {
+ setIsLoading(true);
+ setError(undefined);
+ try {
+ await validateMnemonic();
+ await createPassword({ password, mnemonic });
+ enqueueSnackbar('Password successfully created', { variant: 'success' });
+ onComplete();
+ } catch (e) {
+ setError(e as string);
+ setIsLoading(false);
+ }
+ };
+
+ useEffect(() => {
+ setError(undefined);
+ if (toggle === 'new') {
+ generateMnemonic();
+ } else {
+ setMnemonic('');
+ }
+ }, [toggle]);
+
+ return (
+
+
+
+ Write down your mnemonic
+
+
+ {toggle === 'new' && (
+
+ }
+ >
+ Please store your mnemonic in a safe place
+
+ This is the only way to access your wallet!
+
+
+
+ )}
+
+ , value: string) => {
+ setToggle(value);
+ }}
+ >
+ Create new mnemonic
+ Use existing mnemonic
+
+
+
+ {toggle === 'new' && }
+ {toggle === 'existing' && (
+ setMnemonic(mnc)} error={error} />
+ )}
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
diff --git a/nym-wallet/src/pages/welcome/pages/create-password.tsx b/nym-wallet/src/pages/welcome/pages/create-password.tsx
index d4ec4061f7..c0372b94cc 100644
--- a/nym-wallet/src/pages/welcome/pages/create-password.tsx
+++ b/nym-wallet/src/pages/welcome/pages/create-password.tsx
@@ -1,14 +1,19 @@
-import React, { useState } from 'react';
-import { Button, FormControl, Grid, IconButton, Stack, TextField } from '@mui/material';
-import { VisibilityOff, Visibility } from '@mui/icons-material';
+import React, { useContext, useState } from 'react';
+import { Button, FormControl, Grid, Stack } from '@mui/material';
import { TPages } from '../types';
import { Subtitle, Title, PasswordStrength } from '../components';
import { PasswordInput } from '../components/textfields';
+import { SignInContext } from '../context';
export const CreatePassword = ({ page, onPrev, onNext }: { page: TPages; onNext: () => void; onPrev: () => void }) => {
- const [password, setPassword] = useState('');
- const [confirmedPassword, setConfirmedPassword] = useState();
- const [showConfirmedPassword, setShowConfirmedPassword] = useState(false);
+ const { password, setPassword } = useContext(SignInContext);
+ const [confirmedPassword, setConfirmedPassword] = useState('');
+ const [isStrongPassword, setIsStrongPassword] = useState(false);
+
+ const handleOnPrev = () => {
+ setPassword('');
+ onPrev();
+ };
return (
<>
@@ -20,33 +25,25 @@ export const CreatePassword = ({ page, onPrev, onNext }: { page: TPages; onNext:
<>
- setPassword(pswd)} />
-
+ setPassword(pswd)} label="Password" />
+ setIsStrongPassword(isStrong)} />
>
- setConfirmedPassword(pswd)}
label="Confirm password"
- value={confirmedPassword}
- onChange={(e) => setConfirmedPassword(e.target.value)}
- type={showConfirmedPassword ? 'input' : 'password'}
- InputProps={{
- endAdornment: (
- setShowConfirmedPassword((show) => !show)}>
- {showConfirmedPassword ? : }
-
- ),
- }}
/>