Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds update stronghold view (#6087)
* feat: adds update stronghold router and route * feat: adds update stronghold view * enhancement: replace dummy prop * fix: fix tests * feat: adds update stronghold view * fix: add login option to avoid next route call in login function * fix: removes unused constant --------- Co-authored-by: Mark Nardi <mark.nardi@iota.org>
- Loading branch information
1 parent
8543221
commit 7db1923
Showing
11 changed files
with
90 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export * from './update-stronghold' | ||
|
||
export { default as EnterPinView } from './EnterPinView.svelte' | ||
export { default as LoadProfileView } from './LoadProfileView.svelte' | ||
export { default as SelectProfileView } from './SelectProfileView.svelte' |
9 changes: 9 additions & 0 deletions
9
packages/desktop/views/login/views/update-stronghold/UpdateStrongholdRouter.svelte
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 @@ | ||
<script lang="ts"> | ||
import { UpdateStrongholdView } from './views' | ||
import { UpdateStrongholdRoute } from '@core/router/enums/login' | ||
import { updateStrongholdRoute } from '@core/router/subrouters/login' | ||
</script> | ||
|
||
{#if $updateStrongholdRoute === UpdateStrongholdRoute.Update} | ||
<UpdateStrongholdView /> | ||
{/if} |
3 changes: 3 additions & 0 deletions
3
packages/desktop/views/login/views/update-stronghold/index.js
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,3 @@ | ||
export * from './views' | ||
|
||
export { default as UpdateStrongholdRouter } from './UpdateStrongholdRouter' |
56 changes: 56 additions & 0 deletions
56
packages/desktop/views/login/views/update-stronghold/views/UpdateStrongholdView.svelte
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,56 @@ | ||
<script lang="ts"> | ||
import { OnboardingLayout } from '@components' | ||
import { Animation, Button, PasswordInput, Text } from '@ui' | ||
import { HTMLButtonType, TextType } from '@ui/enums' | ||
import { localize } from '@core/i18n' | ||
import { unlockStronghold } from '@core/profile' | ||
import { loginRouter, updateStrongholdRouter } from '@core/router' | ||
let password: string = '' | ||
let passwordError: string = '' | ||
async function onSubmit(): Promise<void> { | ||
try { | ||
await unlockStronghold(password) | ||
$updateStrongholdRouter.next() | ||
} catch (err) { | ||
passwordError = localize(err.message) ?? err.message | ||
return | ||
} | ||
return | ||
} | ||
function onBackClick(): void { | ||
$loginRouter.previous() | ||
} | ||
</script> | ||
|
||
<OnboardingLayout {onBackClick}> | ||
<div slot="title"> | ||
<Text type={TextType.h2}> | ||
{localize('views.updateStronghold.update.title')} | ||
</Text> | ||
</div> | ||
<div slot="leftpane__content"> | ||
<Text secondary classes="mb-12"> | ||
{localize('views.updateStronghold.update.body')} | ||
</Text> | ||
<form on:submit|preventDefault={onSubmit} id="update-stronghold-form"> | ||
<PasswordInput bind:value={password} bind:error={passwordError} autofocus showRevealToggle /> | ||
</form> | ||
</div> | ||
<div slot="leftpane__action"> | ||
<Button | ||
type={HTMLButtonType.Submit} | ||
form="update-stronghold-form" | ||
classes="w-full" | ||
disabled={!password || !!passwordError} | ||
> | ||
{localize('actions.continue')} | ||
</Button> | ||
</div> | ||
<div slot="rightpane" class="w-full h-full flex justify-center bg-pastel-blue dark:bg-gray-900"> | ||
<Animation classes="setup-anim-aspect-ratio" animation="backup-recovery-phrase-desktop" /> | ||
</div> | ||
</OnboardingLayout> |
1 change: 1 addition & 0 deletions
1
packages/desktop/views/login/views/update-stronghold/views/index.js
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 @@ | ||
export { default as UpdateStrongholdView } from './UpdateStrongholdView.svelte' |
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
6 changes: 3 additions & 3 deletions
6
packages/shared/lib/core/profile/actions/active-profile/unlockStronghold.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
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