From 5e787b2201ab2ddcdb9f433960870f0872d5ee47 Mon Sep 17 00:00:00 2001 From: Norton Andreev Date: Wed, 17 Apr 2024 15:35:58 +0300 Subject: [PATCH] web-wallet: Replace Card component Resolves #1295, Resolves #1650 --- .../ExistingWalletNotice.svelte | 10 +- .../src/lib/components/Stake/Stake.svelte | 16 +- .../__snapshots__/Stake.spec.js.snap | 15 +- .../IconHeaderToggleCard.css | 11 + .../IconHeaderToggleCard.svelte | 35 ++ .../__tests__/IconHeaderToggleCard.spec.js | 28 ++ .../IconHeaderToggleCard.spec.js.snap | 93 ++++ web-wallet/src/lib/containers/index.js | 1 + .../src/lib/dusk/components/Card/Card.svelte | 37 +- .../dusk/components/__tests__/Card.spec.js | 12 +- .../__tests__/__snapshots__/Card.spec.js.snap | 48 +- .../lib/dusk/components/dusk.components.d.ts | 2 + .../(welcome)/forced-logout/+page.svelte | 25 +- .../__tests__/__snapshots__/page.spec.js.snap | 72 +-- .../src/routes/(welcome)/login/+page.svelte | 12 +- .../__tests__/__snapshots__/page.spec.js.snap | 96 ++-- .../src/routes/(welcome)/setup/AllSet.svelte | 5 +- .../(welcome)/setup/PasswordSetup.svelte | 11 +- .../(welcome)/setup/TermsOfService.svelte | 3 +- .../setup/create/MnemonicPhrase.svelte | 16 +- .../setup/create/MnemonicPreSetup.svelte | 29 +- .../setup/create/MnemonicValidate.svelte | 13 +- .../__tests__/__snapshots__/page.spec.js.snap | 410 +++++++++--------- .../setup/restore/MnemonicAuthenticate.svelte | 3 +- .../__tests__/__snapshots__/page.spec.js.snap | 84 ++-- .../routes/components-showcase/Cards.svelte | 21 +- web-wallet/src/style/dusk-components/card.css | 31 +- 27 files changed, 651 insertions(+), 488 deletions(-) create mode 100644 web-wallet/src/lib/containers/IconHeaderToggleCard/IconHeaderToggleCard.css create mode 100644 web-wallet/src/lib/containers/IconHeaderToggleCard/IconHeaderToggleCard.svelte create mode 100644 web-wallet/src/lib/containers/__tests__/IconHeaderToggleCard.spec.js create mode 100644 web-wallet/src/lib/containers/__tests__/__snapshots__/IconHeaderToggleCard.spec.js.snap diff --git a/web-wallet/src/lib/components/ExistingWalletNotice/ExistingWalletNotice.svelte b/web-wallet/src/lib/components/ExistingWalletNotice/ExistingWalletNotice.svelte index 93fde8a51b..499380b0e0 100644 --- a/web-wallet/src/lib/components/ExistingWalletNotice/ExistingWalletNotice.svelte +++ b/web-wallet/src/lib/components/ExistingWalletNotice/ExistingWalletNotice.svelte @@ -1,6 +1,7 @@
- +

Initializing a new wallet will replace your existing local wallet cache, erasing any stored data. Ensure you have securely backed up your current @@ -30,7 +34,7 @@ }} /> - +

diff --git a/web-wallet/src/routes/(welcome)/setup/PasswordSetup.svelte b/web-wallet/src/routes/(welcome)/setup/PasswordSetup.svelte index 1c9b3437e2..dceb996393 100644 --- a/web-wallet/src/routes/(welcome)/setup/PasswordSetup.svelte +++ b/web-wallet/src/routes/(welcome)/setup/PasswordSetup.svelte @@ -1,5 +1,6 @@ - +

Please store your password safely.

{/if} -
+
diff --git a/web-wallet/src/routes/(welcome)/setup/TermsOfService.svelte b/web-wallet/src/routes/(welcome)/setup/TermsOfService.svelte index 34754dc770..e98ce4cebe 100644 --- a/web-wallet/src/routes/(welcome)/setup/TermsOfService.svelte +++ b/web-wallet/src/routes/(welcome)/setup/TermsOfService.svelte @@ -7,7 +7,8 @@
- + +

Terms & Privacy Policy

Our - import { Card, Words } from "$lib/dusk/components"; + import { Words } from "$lib/dusk/components"; + import { IconHeaderToggleCard } from "$lib/containers"; + import { mdiAlertOutline } from "@mdi/js"; import { generateMnemonic } from "bip39"; @@ -11,15 +13,15 @@ } - -

+ +

Please make sure to write your phrase down and save it in a secure location.

-
+ - diff --git a/web-wallet/src/routes/(welcome)/setup/create/MnemonicPreSetup.svelte b/web-wallet/src/routes/(welcome)/setup/create/MnemonicPreSetup.svelte index 5dbf7b4a72..836366b56e 100644 --- a/web-wallet/src/routes/(welcome)/setup/create/MnemonicPreSetup.svelte +++ b/web-wallet/src/routes/(welcome)/setup/create/MnemonicPreSetup.svelte @@ -14,18 +14,21 @@ $: isValid = agreementOneChecked && agreementTwoChecked; - - - + +

Securely store your seed phrase!

+
+ + +
@@ -37,7 +40,7 @@
diff --git a/web-wallet/src/routes/(welcome)/setup/create/MnemonicValidate.svelte b/web-wallet/src/routes/(welcome)/setup/create/MnemonicValidate.svelte index 9de34ccbfb..67173092a2 100644 --- a/web-wallet/src/routes/(welcome)/setup/create/MnemonicValidate.svelte +++ b/web-wallet/src/routes/(welcome)/setup/create/MnemonicValidate.svelte @@ -18,7 +18,8 @@ $: isValid = arraysEqual(enteredMnemonicPhrase, mnemonicPhrase); - + +

Verification

Ensure you have backed up the Mnemonic phrase.

{/if}
- - diff --git a/web-wallet/src/routes/(welcome)/setup/create/__tests__/__snapshots__/page.spec.js.snap b/web-wallet/src/routes/(welcome)/setup/create/__tests__/__snapshots__/page.spec.js.snap index 15e61db7de..cd18be39dd 100644 --- a/web-wallet/src/routes/(welcome)/setup/create/__tests__/__snapshots__/page.spec.js.snap +++ b/web-wallet/src/routes/(welcome)/setup/create/__tests__/__snapshots__/page.spec.js.snap @@ -75,33 +75,38 @@ exports[`Create > correctly renders the Mnemonic Preview page 1`] = `
-
- - - - - - -

- Keep this SAFE -

+ + + + + + +

+ Keep this SAFE +

+
- +

Please make sure to write your phrase down and save it in a secure location.

@@ -171,9 +176,12 @@ exports[`Create > correctly renders the Mnemonic Preview page 1`] = ` + + +
correctly renders the Mnemonic Verification page 1`] = `
-
- -

- Verification -

- -
+ Verification +

Ensure you have backed up the Mnemonic phrase.

@@ -614,6 +617,7 @@ exports[`Create > correctly renders the Mnemonic Verification page 1`] = ` +
@@ -770,22 +774,17 @@ exports[`Create > doesn't let the user proceed if they have entered mismatching
-
- -

- Verification -

- -
+ Verification +

Ensure you have backed up the Mnemonic phrase.

@@ -1066,7 +1065,7 @@ exports[`Create > doesn't let the user proceed if they have entered mismatching
doesn't let the user proceed if they have entered mismatching -

+

Mnemonic does not match.

+
@@ -1243,22 +1241,17 @@ exports[`Create > ensures that the Undo button on the Mnemonic Validate step wor
-
- -

- Verification -

- -
+ Verification +

Ensure you have backed up the Mnemonic phrase.

@@ -1538,6 +1531,7 @@ exports[`Create > ensures that the Undo button on the Mnemonic Validate step wor +
@@ -1703,19 +1697,14 @@ exports[`Create > ensures the All Done step renders as expected 1`] = `
-
- -

- You are all set! -

- -
+ You are all set! + All Set ensures the All Done step renders as expected 1`] = ` width="205" /> +
@@ -1849,28 +1839,33 @@ exports[`Create > ensures the Password step renders as expected 1`] = `
-
- - - - - - -

- Password -

+ + + + + + +

+ Password +

+
ensures the Password step renders as expected 1`] = ` tabindex="0" /> - +
+ +
+
ensures the Password step renders as expected 2`] = `
-
- - - - - - -

- Password -

+ + + + + + +

+ Password +

+
ensures the Password step renders as expected 2`] = ` tabindex="0" /> - +

ensures the Password step renders as expected 2`] = ` Password must be at least 8 characters

+ + +
lets the user proceed if they have entered a matching Mnemonic
-
- -

- Verification -

- -
+ Verification +

Ensure you have backed up the Mnemonic phrase.

@@ -2784,6 +2785,7 @@ exports[`Create > lets the user proceed if they have entered a matching Mnemonic +
@@ -2933,62 +2935,62 @@ exports[`Create > should render the \`Securely store your seed phrase!\` agreeme
-
- -

- Securely store your seed phrase! -

- -
+ Securely store your seed phrase! +
- - - - -
- - -
- - + + + + +
+ - + + + + +
+
- + @@ -3109,30 +3111,35 @@ exports[`Create > should render the Existing Wallet notice step of the Create fl class="s-0jNtmKPqmF7T" >
-
- - - - - - -

- Existing Wallet Detected -

+ + + + + + +

+ Existing Wallet Detected +

+
- +

should render the Existing Wallet notice step of the Create fl + + + @@ -3194,19 +3204,14 @@ exports[`Create > should render the Terms of Service step of the Create flow if class="s-c41QPMu_i3CH" >

-
- -

- Terms & Privacy Policy -

- -
+ Terms & Privacy Policy +

should render the Terms of Service step of the Create flow if

+ diff --git a/web-wallet/src/routes/(welcome)/setup/restore/MnemonicAuthenticate.svelte b/web-wallet/src/routes/(welcome)/setup/restore/MnemonicAuthenticate.svelte index ad14c4b4ce..c598dd671e 100644 --- a/web-wallet/src/routes/(welcome)/setup/restore/MnemonicAuthenticate.svelte +++ b/web-wallet/src/routes/(welcome)/setup/restore/MnemonicAuthenticate.svelte @@ -25,6 +25,7 @@ } - + +

Enter your Mnemonic Phrase

diff --git a/web-wallet/src/routes/(welcome)/setup/restore/__tests__/__snapshots__/page.spec.js.snap b/web-wallet/src/routes/(welcome)/setup/restore/__tests__/__snapshots__/page.spec.js.snap index 93f0a31d7c..5ac1adbc96 100644 --- a/web-wallet/src/routes/(welcome)/setup/restore/__tests__/__snapshots__/page.spec.js.snap +++ b/web-wallet/src/routes/(welcome)/setup/restore/__tests__/__snapshots__/page.spec.js.snap @@ -9,30 +9,35 @@ exports[`Restore > should render the Existing Wallet notice step of the Restore class="s-0jNtmKPqmF7T" >
-
- - - - - - -

- Existing Wallet Detected -

+ + + + + + +

+ Existing Wallet Detected +

+
- +

should render the Existing Wallet notice step of the Restore + + + @@ -142,19 +150,14 @@ exports[`Restore > should render the Mnemonic Authenticate step after accepting

-
- -

- Enter your Mnemonic Phrase -

- -
+ Enter your Mnemonic Phrase +
should render the Mnemonic Authenticate step after accepting
+ @@ -384,19 +388,14 @@ exports[`Restore > should render the Terms of Service step of the Restore flow i class="s-c41QPMu_i3CH" >
-
- -

- Terms & Privacy Policy -

- -
+ Terms & Privacy Policy +

should render the Terms of Service step of the Restore flow i

+ diff --git a/web-wallet/src/routes/components-showcase/Cards.svelte b/web-wallet/src/routes/components-showcase/Cards.svelte index 615e078db1..3c6ca8b2fe 100644 --- a/web-wallet/src/routes/components-showcase/Cards.svelte +++ b/web-wallet/src/routes/components-showcase/Cards.svelte @@ -1,12 +1,14 @@
- - - + +
+ +

Card Title

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In viverra tincidunt dolor, nec imperdiet felis tristique non. Nunc quis tempus est, @@ -17,11 +19,20 @@ ullamcorper in velit. Aenean eros dolor, condimentum sed tempor et, ornare in erat.

+
+ This is an example footer. +
- diff --git a/web-wallet/src/style/dusk-components/card.css b/web-wallet/src/style/dusk-components/card.css index 2242b3fc97..7930c6affb 100644 --- a/web-wallet/src/style/dusk-components/card.css +++ b/web-wallet/src/style/dusk-components/card.css @@ -1,34 +1,27 @@ .dusk-card { background-color: var(--surface-color); border-radius: var(--control-border-radius-size); - padding: 1.3em 2em; + padding: 1.3rem 2rem; + display: flex; + flex-direction: column; } .dusk-card--on-surface { - background-color: var(--background-color); -} - -.dusk-card__icon { - margin-right: 0.4em; - font-size: 1.1em; + background-color: var(--on-primary-color); } -.dusk-card__header { - display: flex; - margin-bottom: 1.25em; - align-items: center; +.dusk-card--gap-small { + gap: 0.5em; } -.dusk-card__header--toggle-off { - margin-bottom: 0; +.dusk-card--gap-default { + gap: 0.625em; } -.dusk-card .dusk-switch { - margin-left: auto; +.dusk-card--gap-medium { + gap: 1.25em; } -.dusk-card pre { - overflow-x: auto; - tab-size: 4; - padding: 1em 0; +.dusk-card--gap-large { + gap: 1.875em; }