Skip to content

Commit 6febd55

Browse files
committed
Completed Onboarding pages
Added: Recovery pages Add Tokens Connect Account
1 parent 0afa54f commit 6febd55

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1618
-245
lines changed

packages/browser-wallet/src/popup/page-layouts/MainLayout/MainLayout.tsx

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,26 @@ import { useAtomValue } from 'jotai';
44
import clsx from 'clsx';
55

66
import { absoluteRoutes } from '@popup/constants/routes';
7-
import {
8-
hasBeenOnBoardedAtom,
9-
sessionOnboardingLocationAtom,
10-
sessionPasscodeAtom,
11-
acceptedTermsAtom,
12-
} from '@popup/store/settings';
7+
import { absoluteRoutes as absoluteRoutesX } from '@popup/popupX/constants/routes';
8+
import { hasBeenOnBoardedAtom, sessionPasscodeAtom, acceptedTermsAtom } from '@popup/store/settings';
139
import { isRecoveringAtom } from '@popup/store/identity';
1410
import Toast from '@popup/shared/Toast/Toast';
1511
import Header from './Header';
1612

1713
export default function MainLayout() {
1814
const [headerOpen, setHeaderOpen] = useState(false);
1915
const { loading: loadingHasBeenOnboarded, value: hasBeenOnboarded } = useAtomValue(hasBeenOnBoardedAtom);
20-
const { loading: loadingOnboardingLocation, value: onboardingLocation } =
21-
useAtomValue(sessionOnboardingLocationAtom);
2216
const { loading: loadingPasscode, value: sessionPasscode } = useAtomValue(sessionPasscodeAtom);
2317
const { loading: loadingIsRecovering, value: sessionIsRecovering } = useAtomValue(isRecoveringAtom);
2418
const { loading: loadingAcceptedTerms, value: acceptedTerms } = useAtomValue(acceptedTermsAtom);
2519

26-
if (
27-
loadingHasBeenOnboarded ||
28-
loadingPasscode ||
29-
loadingIsRecovering ||
30-
loadingOnboardingLocation ||
31-
loadingAcceptedTerms
32-
) {
20+
if (loadingHasBeenOnboarded || loadingPasscode || loadingIsRecovering || loadingAcceptedTerms) {
3321
// This will be near instant, as we're just waiting for the Chrome async store
3422
return null;
3523
}
3624

3725
if (!hasBeenOnboarded) {
38-
if (onboardingLocation) {
39-
return <Navigate to={absoluteRoutes.login.path} state={{ to: onboardingLocation }} />;
40-
}
41-
return <Navigate to={absoluteRoutes.setup.path} />;
26+
return <Navigate to={absoluteRoutesX.onboarding.path} />;
4227
}
4328

4429
if (!sessionPasscode) {

packages/browser-wallet/src/popup/popupX/constants/routes.ts

Lines changed: 73 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -36,56 +36,66 @@ export const relativeRoutes = {
3636
hideMenu: true,
3737
hideConnection: true,
3838
},
39-
},
40-
createOrRestore: {
41-
path: 'createOrRestore',
42-
config: {
43-
hideBackArrow: false,
44-
backTitle: '',
45-
hideMenu: true,
46-
hideConnection: true,
47-
},
48-
},
49-
selectNetwork: {
50-
path: 'selectNetwork',
51-
config: {
52-
hideBackArrow: false,
53-
backTitle: '',
54-
hideMenu: true,
55-
hideConnection: true,
56-
},
57-
},
58-
restoreWallet: {
59-
path: 'restoreWallet',
60-
config: {
61-
hideBackArrow: false,
62-
backTitle: '',
63-
hideMenu: true,
64-
hideConnection: true,
65-
},
66-
},
67-
idIntro: {
68-
path: 'idIntro',
69-
config: {
70-
backTitle: '',
71-
hideMenu: true,
72-
hideConnection: true,
73-
},
74-
},
75-
requestIdentity: {
76-
path: 'requestIdentity',
77-
config: {
78-
backTitle: '',
79-
hideMenu: true,
80-
hideConnection: true,
81-
},
82-
},
83-
idSubmitted: {
84-
path: 'idSubmitted',
85-
config: {
86-
backTitle: '',
87-
hideMenu: true,
88-
hideConnection: true,
39+
createOrRestore: {
40+
path: 'createOrRestore',
41+
config: {
42+
hideBackArrow: true,
43+
backTitle: '',
44+
hideMenu: true,
45+
hideConnection: true,
46+
},
47+
selectNetwork: {
48+
path: 'selectNetwork',
49+
config: {
50+
hideBackArrow: false,
51+
backTitle: '',
52+
hideMenu: true,
53+
hideConnection: true,
54+
},
55+
},
56+
restoreWallet: {
57+
path: 'restoreWallet',
58+
config: {
59+
hideBackArrow: false,
60+
backTitle: '',
61+
hideMenu: true,
62+
hideConnection: true,
63+
},
64+
},
65+
generateSeedPhrase: {
66+
path: 'generateSeedPhrase',
67+
config: {
68+
hideBackArrow: false,
69+
backTitle: '',
70+
hideMenu: true,
71+
hideConnection: true,
72+
},
73+
confirmSeedPhrase: {
74+
path: 'confirmSeedPhrase',
75+
config: {
76+
hideBackArrow: false,
77+
backTitle: '',
78+
hideMenu: true,
79+
hideConnection: true,
80+
},
81+
idIntro: {
82+
path: 'idIntro',
83+
config: {
84+
backTitle: '',
85+
hideMenu: true,
86+
hideConnection: true,
87+
},
88+
requestIdentity: {
89+
path: 'requestIdentity',
90+
config: {
91+
backTitle: '',
92+
hideMenu: true,
93+
hideConnection: true,
94+
},
95+
},
96+
},
97+
},
98+
},
8999
},
90100
},
91101
},
@@ -242,10 +252,11 @@ export const relativeRoutes = {
242252
},
243253
restore: {
244254
path: 'restore',
245-
result: {
246-
path: 'result',
255+
main: {
256+
path: 'main',
247257
config: {
248-
backTitle: 'Restore wallet',
258+
hideMenu: true,
259+
hideBackArrow: true,
249260
},
250261
},
251262
},
@@ -358,6 +369,15 @@ export const relativeRoutes = {
358369
connectionRequest: {
359370
path: 'connectionRequest',
360371
},
372+
connectAccountsRequest: {
373+
path: 'connectAccountsRequest',
374+
},
375+
addTokens: {
376+
path: 'addTokens',
377+
},
378+
recovery: {
379+
path: 'recovery',
380+
},
361381
endIdentityIssuance: {
362382
path: 'end-identity-issuance',
363383
},

packages/browser-wallet/src/popup/popupX/page-layouts/MainLayout/Header/components/AccountButton.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import clsx from 'clsx';
33
import UpDown from '@assets/svgX/caret-up-down.svg';
44
import { displayNameOrSplitAddress } from '@popup/shared/utils/account-helpers';
55
import { useAtomValue } from 'jotai';
6-
import { selectedCredentialAtom } from '@popup/store/account';
6+
import { credentialsAtom, selectedCredentialAtom } from '@popup/store/account';
7+
import { useTranslation } from 'react-i18next';
78

89
export default function AccountButton({
910
hideAccountButton,
@@ -14,14 +15,24 @@ export default function AccountButton({
1415
accountOpen?: boolean;
1516
setAccountOpen: (open: boolean) => void;
1617
}) {
18+
const { t } = useTranslation('x', { keyPrefix: 'header.accountButton' });
1719
const credential = useAtomValue(selectedCredentialAtom);
20+
const credentials = useAtomValue(credentialsAtom);
21+
22+
if (hideAccountButton) return null;
23+
24+
if (credential === undefined && credentials.length === 0) {
25+
return (
26+
<div className={clsx('header__account')}>
27+
<span className="text__main_medium red">{t('noAccounts')}</span>
28+
</div>
29+
);
30+
}
1831

1932
if (credential === undefined) {
2033
return null;
2134
}
2235

23-
if (hideAccountButton) return null;
24-
2536
return (
2637
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
2738
<div className={clsx('header__account', accountOpen && 'active')} onClick={() => setAccountOpen(!accountOpen)}>

packages/browser-wallet/src/popup/popupX/page-layouts/MainLayout/Header/i18n/en.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ const t = {
1212
oldUI: 'Old UI',
1313
nft: 'NFT',
1414
},
15+
accountButton: {
16+
noAccounts: 'No accounts',
17+
},
1518
accountSelector: {
1619
sortAsc: 'Sort A-Z',
1720
sortDesc: 'Sort Z-A',

packages/browser-wallet/src/popup/popupX/page-layouts/MainLayout/MainLayout.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858

5959
.text__main_medium {
6060
color: $color-white;
61+
62+
&.red {
63+
color: $color-red-attention;
64+
}
6165
}
6266
}
6367
}

packages/browser-wallet/src/popup/popupX/page-layouts/MainLayout/MainLayout.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Header from '@popup/popupX/page-layouts/MainLayout/Header';
55
import Toast from '@popup/popupX/shared/Toast';
66
import { AccountButton, NavButton } from '@popup/popupX/page-layouts/MainLayout/Header/components';
77
import { relativeRoutes, RouteConfig, routePrefix } from '@popup/popupX/constants/routes';
8-
import { withPasswordSession } from '@popup/popupX/shared/utils/hoc';
8+
import { withPasswordSession, withRedirect } from '@popup/popupX/shared/utils/hoc';
99
import { noOp } from 'wallet-common-helpers';
1010

1111
type RouteObj = {
@@ -89,4 +89,6 @@ function MainLayout() {
8989
);
9090
}
9191

92-
export default withPasswordSession(MainLayout);
92+
export const OnboardingLayout = MainLayout;
93+
94+
export default withRedirect(withPasswordSession(MainLayout));
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { default } from './MainLayout';
1+
export { default, OnboardingLayout } from './MainLayout';

packages/browser-wallet/src/popup/popupX/pages/CreateAccount/CreateAccount.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export default function CreateAccount() {
4646
})
4747
);
4848
const validIdentities = useValidIdentities();
49+
const navToCreateIdentity = () => nav(absoluteRoutes.settings.identities.create.path);
4950

5051
return (
5152
<Page className="create-account-x">
@@ -68,6 +69,11 @@ export default function CreateAccount() {
6869
))
6970
)}
7071
</Page.Main>
72+
<Page.Footer>
73+
{validIdentities.length === 0 && (
74+
<Button.Main label={t('createIdentity')} onClick={navToCreateIdentity} />
75+
)}
76+
</Page.Footer>
7177
</Page>
7278
);
7379
}

packages/browser-wallet/src/popup/popupX/pages/CreateAccount/i18n/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const t = {
66
77
Which identity do you want to use to create the account?`,
88
confirmButton: 'Create account',
9+
createIdentity: 'Create Identity',
910
};
1011

1112
export default t;

packages/browser-wallet/src/popup/popupX/pages/IdIssuance/Submitted.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default function IdIssuanceSubmitted() {
2121
if (isSpawnedWindow) {
2222
window.close();
2323
} else {
24-
nav(absoluteRoutes.settings.identities.path, { replace: true });
24+
nav(absoluteRoutes.home.path, { replace: true });
2525
}
2626
};
2727

packages/browser-wallet/src/popup/popupX/pages/MainPage/MainPage.scss

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,18 @@
1313
}
1414

1515
.main-page-x {
16+
&.rejected-account {
17+
.heading_medium {
18+
color: $color-red-attention;
19+
}
20+
}
21+
1622
&.page-container {
1723
height: 100%;
18-
padding-bottom: unset;
24+
25+
&:not(.create-account) {
26+
padding-bottom: unset;
27+
}
1928
}
2029

2130
&__balance {

0 commit comments

Comments
 (0)