Skip to content

Commit

Permalink
feat: adds update stronghold view
Browse files Browse the repository at this point in the history
  • Loading branch information
jeeanribeiro authored and MarkNerdi996 committed Mar 7, 2023
1 parent ee68d8c commit b79be2c
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/desktop/views/login/LoginRouter.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import { Transition } from 'shared/components'
import { EnterPinView, SelectProfileView, LoadProfileView } from './views'
import { EnterPinView, SelectProfileView, LoadProfileView, UpdateStrongholdRouter } from './views'
import { loginRoute, LoginRoute } from '@core/router'
</script>

Expand All @@ -12,6 +12,10 @@
<Transition>
<EnterPinView />
</Transition>
{:else if $loginRoute === LoginRoute.UpdateStronghold}
<Transition>
<UpdateStrongholdRouter />
</Transition>
{:else if $loginRoute === LoginRoute.LoadProfile}
<Transition>
<LoadProfileView />
Expand Down
2 changes: 2 additions & 0 deletions packages/desktop/views/login/views/index.js
@@ -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'
@@ -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 packages/desktop/views/login/views/update-stronghold/index.js
@@ -0,0 +1,3 @@
export * from './views'

export { default as UpdateStrongholdRouter } from './UpdateStrongholdRouter'
@@ -0,0 +1,55 @@
<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 } from '@core/router'
let password: string = ''
let passwordError: string = ''
async function onSubmit(): Promise<void> {
try {
await unlockStronghold(password)
} catch (err) {
passwordError = localize(err.message) ?? err.message
return
}
return // TODO: implement update stronghold functionality
}
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>
@@ -0,0 +1 @@
export { default as UpdateStrongholdView } from './UpdateStrongholdView.svelte'
6 changes: 6 additions & 0 deletions packages/shared/locales/en.json
Expand Up @@ -616,6 +616,12 @@
"fetching": "Fetching proposal data",
"hintVote": "You can not vote on a proposal that is in the announcement phase, voting will open in {time}."
}
},
"updateStronghold": {
"update": {
"title": "Update Stronghold",
"body": "Your Stronghold's version is out of date. Provide your password to update Stronghold."
}
}
},
"popups": {
Expand Down

0 comments on commit b79be2c

Please sign in to comment.