From b8a8b9f247a3672640585f0d0ea1ffc87d3a4a7e 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 | 9 +- .../__snapshots__/Stake.spec.js.snap | 41 ++- web-wallet/src/lib/containers/Cards/Card.css | 11 + .../containers/Cards/IconHeadingCard.svelte | 29 ++ .../containers/Cards/ToggleableCard.svelte | 35 ++ web-wallet/src/lib/containers/Cards/index.js | 2 + .../__tests__/IconHeadingCard.spec.js | 28 ++ .../__tests__/ToggleableCard.spec.js | 40 +++ .../IconHeaderToggleCard.spec.js.snap | 124 +++++++ .../IconHeadingCard.spec.js.snap | 59 ++++ .../__snapshots__/ToggleableCard.spec.js.snap | 120 +++++++ .../src/lib/dusk/components/Card/Card.svelte | 37 +- .../dusk/components/__tests__/Card.spec.js | 12 +- .../__tests__/__snapshots__/Card.spec.js.snap | 9 + .../lib/dusk/components/dusk.components.d.ts | 2 + .../(welcome)/forced-logout/+page.svelte | 25 +- .../__tests__/__snapshots__/page.spec.js.snap | 67 ++-- .../src/routes/(welcome)/login/+page.svelte | 12 +- .../__tests__/__snapshots__/page.spec.js.snap | 82 +++-- .../src/routes/(welcome)/setup/AllSet.svelte | 8 +- .../(welcome)/setup/PasswordSetup.svelte | 7 +- .../(welcome)/setup/TermsOfService.svelte | 7 +- .../setup/create/MnemonicPhrase.svelte | 16 +- .../setup/create/MnemonicPreSetup.svelte | 11 +- .../setup/create/MnemonicValidate.svelte | 13 +- .../__tests__/__snapshots__/page.spec.js.snap | 325 +++++++++++------- .../setup/restore/MnemonicAuthenticate.svelte | 11 +- .../__tests__/__snapshots__/page.spec.js.snap | 83 +++-- .../routes/components-showcase/Cards.svelte | 21 +- web-wallet/src/style/dusk-components/card.css | 31 +- 31 files changed, 920 insertions(+), 367 deletions(-) create mode 100644 web-wallet/src/lib/containers/Cards/Card.css create mode 100644 web-wallet/src/lib/containers/Cards/IconHeadingCard.svelte create mode 100644 web-wallet/src/lib/containers/Cards/ToggleableCard.svelte create mode 100644 web-wallet/src/lib/containers/Cards/index.js create mode 100644 web-wallet/src/lib/containers/__tests__/IconHeadingCard.spec.js create mode 100644 web-wallet/src/lib/containers/__tests__/ToggleableCard.spec.js create mode 100644 web-wallet/src/lib/containers/__tests__/__snapshots__/IconHeaderToggleCard.spec.js.snap create mode 100644 web-wallet/src/lib/containers/__tests__/__snapshots__/IconHeadingCard.spec.js.snap create mode 100644 web-wallet/src/lib/containers/__tests__/__snapshots__/ToggleableCard.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..62fcab5c50 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..69b0e364ba 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..143640cc3f 100644 --- a/web-wallet/src/routes/(welcome)/setup/TermsOfService.svelte +++ b/web-wallet/src/routes/(welcome)/setup/TermsOfService.svelte @@ -1,13 +1,14 @@
- +

Our

- + diff --git a/web-wallet/src/routes/(welcome)/setup/create/MnemonicPreSetup.svelte b/web-wallet/src/routes/(welcome)/setup/create/MnemonicPreSetup.svelte index 5dbf7b4a72..1f0ee121c8 100644 --- a/web-wallet/src/routes/(welcome)/setup/create/MnemonicPreSetup.svelte +++ b/web-wallet/src/routes/(welcome)/setup/create/MnemonicPreSetup.svelte @@ -1,5 +1,6 @@ - + - +
@@ -37,7 +38,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..d6738a2a0d 100644 --- a/web-wallet/src/routes/(welcome)/setup/create/MnemonicValidate.svelte +++ b/web-wallet/src/routes/(welcome)/setup/create/MnemonicValidate.svelte @@ -1,7 +1,8 @@ - +

Ensure you have backed up the Mnemonic phrase.

Mnemonic does not match.

{/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 06cf83ef30..d5cfc3fd0b 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 @@ -68,32 +68,36 @@ 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.

@@ -162,6 +166,7 @@ exports[`Create > correctly renders the Mnemonic Preview page 1`] = ` sad + @@ -297,22 +302,26 @@ exports[`Create > correctly renders the Mnemonic Verification page 1`] = `
- -

- Verification -

- + +

+ Verification +

+

Ensure you have backed up the Mnemonic phrase.

@@ -566,6 +575,7 @@ exports[`Create > correctly renders the Mnemonic Verification page 1`] = ` + @@ -700,22 +710,26 @@ exports[`Create > doesn't let the user proceed if they have entered mismatching
- -

- Verification -

- + +

+ Verification +

+

Ensure you have backed up the Mnemonic phrase.

@@ -980,7 +994,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

+ @@ -1132,22 +1147,26 @@ exports[`Create > ensures that the Undo button on the Mnemonic Validate step wor
- -

- Verification -

- + +

+ Verification +

+

Ensure you have backed up the Mnemonic phrase.

@@ -1411,6 +1430,7 @@ exports[`Create > ensures that the Undo button on the Mnemonic Validate step wor + @@ -1551,18 +1571,22 @@ exports[`Create > ensures the All Done step renders as expected 1`] = `
- -

- You are all set! -

- + +

+ You are all set! +

+
ensures the All Done step renders as expected 1`] = ` src="/some-base-path/images/onboarding/all_set_illustration.svg" width="205" /> + @@ -1678,27 +1703,32 @@ exports[`Create > ensures the Password step renders as expected 1`] = `
- - - - - -

- Password -

+ + + + + +

+ Password +

+
ensures the Password step renders as expected 1`] = ` /> + +
@@ -1864,27 +1896,32 @@ exports[`Create > ensures the Password step renders as expected 2`] = `
- - - - - -

- Password -

+ + + + + +

+ Password +

+
ensures the Password step renders as expected 2`] = ` Password must be at least 8 characters
+ + @@ -2237,22 +2276,26 @@ exports[`Create > lets the user proceed if they have entered a matching Mnemonic
- -

- Verification -

- + +

+ Verification +

+

Ensure you have backed up the Mnemonic phrase.

@@ -2517,6 +2560,7 @@ exports[`Create > lets the user proceed if they have entered a matching Mnemonic + @@ -2646,18 +2690,22 @@ exports[`Create > should render the \`Securely store your seed phrase!\` agreeme
- -

- Securely store your seed phrase! -

- + +

+ Securely store your seed phrase! +

+
should render the \`Securely store your seed phrase!\` agreeme for="dusk-checkbox-16" > I understand that securing my recovery phrase is my own responsibility. - Only I have access to my recovery phrase + Only I have access to my recovery phrase
+ @@ -2794,28 +2843,32 @@ exports[`Create > should render the Existing Wallet notice step of the Create fl >
- - - - - -

- Existing Wallet Detected -

- + + + + + +

+ Existing Wallet Detected +

+

@@ -2852,6 +2905,7 @@ exports[`Create > should render the Existing Wallet notice step of the Create fl +

@@ -2864,18 +2918,22 @@ exports[`Create > should render the Terms of Service step of the Create flow if >
- -

- Terms & Privacy Policy -

- + +

+ Terms & Privacy Policy +

+

@@ -2919,6 +2977,7 @@ exports[`Create > 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..07cff9eca0 100644 --- a/web-wallet/src/routes/(welcome)/setup/restore/MnemonicAuthenticate.svelte +++ b/web-wallet/src/routes/(welcome)/setup/restore/MnemonicAuthenticate.svelte @@ -1,9 +1,12 @@ - + - + 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 45c4fa2446..2cf45c40a4 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 @@ -6,28 +6,32 @@ exports[`Restore > should render the Existing Wallet notice step of the Restore >
- - - - - -

- Existing Wallet Detected -

- + + + + + +

+ Existing Wallet Detected +

+

@@ -64,6 +68,7 @@ exports[`Restore > should render the Existing Wallet notice step of the Restore +

@@ -121,18 +126,22 @@ 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
+ @@ -338,18 +348,22 @@ exports[`Restore > should render the Terms of Service step of the Restore flow i >
- -

- Terms & Privacy Policy -

- + +

+ Terms & Privacy Policy +

+

@@ -393,6 +407,7 @@ exports[`Restore > 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; }