-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Improve add device flow This PR aligns the add device flow closer with the elements and screens specified in [figma](https://www.figma.com/file/a8jl32LDcYODRwwzrZd5UU/Internet-Identity-Design?type=design&node-id=1013-19687&mode=design&t=Zh0ZcNOnL57MKKqp-0). The following changes are made: * there is now a prompt for device trust as a first step (on the new device) * there is now a stepper for the flow * the identity number is shown consistently on all screens * the copy has been changed to the wording specified There are still visual design differences. These will be solved separately. * Improve showcase page
- Loading branch information
Frederik Rothenberger
authored
Mar 26, 2024
1 parent
bd0dff0
commit 3246e09
Showing
18 changed files
with
250 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { checkmarkIcon } from "$src/components/icons"; | ||
import { html } from "lit-html"; | ||
|
||
export const tentativeDeviceStepper = ({ | ||
step, | ||
}: { | ||
step: "activate" | "verify" | "success"; | ||
}) => html` | ||
<div class="c-progress-container"> | ||
<ol class="c-progress-stepper"> | ||
<li class="c-progress-stepper__step" aria-current=${step === "activate"}> | ||
<span class="c-progress-stepper__label">Activate Passkey</span> | ||
</li> | ||
<li class="c-progress-stepper__step" aria-current=${step === "verify"}> | ||
<span class="c-progress-stepper__label">Verify Device</span> | ||
</li> | ||
<li | ||
class="c-progress-stepper__step c-progress-stepper__step--final" | ||
aria-current=${step === "success"} | ||
> | ||
<i class="c-progress-stepper__icon">${checkmarkIcon}</i> | ||
<span class="c-progress-stepper__label">Passkey Activated</span> | ||
</li> | ||
</ol> | ||
</div> | ||
`; |
9 changes: 9 additions & 0 deletions
9
src/frontend/src/flows/addDevice/welcomeView/promptDeviceTrusted.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"en": { | ||
"internet_identity": "Internet Identity", | ||
"activate_passkey": "Activate Passkey on this device", | ||
"trust_this_device": "Do you trust this device to connect to your Internet Identity?", | ||
"yes": "Yes", | ||
"no": "No" | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
src/frontend/src/flows/addDevice/welcomeView/promptDeviceTrusted.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { mainWindow } from "$src/components/mainWindow"; | ||
import { tentativeDeviceStepper } from "$src/flows/addDevice/stepper"; | ||
import copyJson from "$src/flows/addDevice/welcomeView/promptDeviceTrusted.json"; | ||
import { I18n } from "$src/i18n"; | ||
import { renderPage } from "$src/utils/lit-html"; | ||
import { html } from "lit-html"; | ||
|
||
export type PromptDeviceTrustedTemplateProps = Parameters< | ||
typeof promptDeviceTrustedTemplate | ||
>[0]; | ||
|
||
const promptDeviceTrustedTemplate = ({ | ||
userNumber, | ||
confirm, | ||
cancel, | ||
i18n, | ||
}: { | ||
userNumber: bigint; | ||
confirm: () => void; | ||
cancel: () => void; | ||
i18n: I18n; | ||
}) => { | ||
const copy = i18n.i18n(copyJson); | ||
|
||
const pageContentSlot = html` <article> | ||
${tentativeDeviceStepper({ step: "activate" })} | ||
<hgroup> | ||
<div class="c-card__label"> | ||
<h2>${copy.internet_identity} ${userNumber}</h2> | ||
</div> | ||
<h1 class="t-title t-title--main">${copy.activate_passkey}</h1> | ||
</hgroup> | ||
<p class="t-paragraph">${copy.trust_this_device}</p> | ||
<div class="l-stack"> | ||
<button | ||
id="trustDeviceConfirm" | ||
class="c-button" | ||
@click=${() => confirm()} | ||
> | ||
${copy.yes} | ||
</button> | ||
<button | ||
id="trustDeviceCancel" | ||
class="c-button c-button--secondary" | ||
@click=${() => cancel()} | ||
> | ||
${copy.no} | ||
</button> | ||
</div> | ||
</article>`; | ||
|
||
return mainWindow({ | ||
showLogo: false, | ||
showFooter: false, | ||
slot: pageContentSlot, | ||
}); | ||
}; | ||
|
||
export const promptDeviceTrustedPage = renderPage(promptDeviceTrustedTemplate); | ||
|
||
/** | ||
* Page to prompt the user whether they trust the current device. | ||
*/ | ||
export const promptDeviceTrusted = ( | ||
props: Pick<PromptDeviceTrustedTemplateProps, "userNumber"> | ||
): Promise<"confirmed" | "canceled"> => { | ||
return new Promise((resolve) => | ||
promptDeviceTrustedPage({ | ||
...props, | ||
confirm: () => resolve("confirmed"), | ||
cancel: () => resolve("canceled"), | ||
i18n: new I18n(), | ||
}) | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.