Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Mark Nardi <mark.nardi@iota.org>
- Loading branch information
1 parent
b4b18f7
commit fb2a772
Showing
4 changed files
with
74 additions
and
11 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
54 changes: 54 additions & 0 deletions
54
...ages/mobile/views/dashboard/drawers/profile/views/settings/views/DeleteProfileView.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,54 @@ | ||
<script lang="typescript"> | ||
import { deleteProfile } from '@contexts/settings' | ||
import { localize } from '@core/i18n' | ||
import { isSoftwareProfile } from '@core/profile' | ||
import { setStrongholdPassword } from '@core/profile-manager' | ||
import { Button, ButtonSize, ButtonVariant, PasswordInput, Text, TextType } from 'shared/components' | ||
let isBusy = false | ||
let error = '' | ||
let password: string | ||
async function handleDeleteClick(): Promise<void> { | ||
isBusy = true | ||
error = '' | ||
try { | ||
await setStrongholdPassword(password) | ||
await deleteProfile() | ||
} catch (err) { | ||
error = localize(err.error) | ||
} | ||
isBusy = false | ||
} | ||
</script> | ||
|
||
<div class="flex-1 flex flex-col justify-between space-y-4"> | ||
<div class="flex flex-col space-y-4"> | ||
<Text type={TextType.p}>{localize('popups.deleteProfile.confirmation')}</Text> | ||
{#if $isSoftwareProfile} | ||
<Text type={TextType.p} secondary classes="mb-3">{localize('popups.deleteProfile.typePassword')}</Text> | ||
<PasswordInput | ||
{error} | ||
classes="w-full mb-8" | ||
bind:value={password} | ||
showRevealToggle | ||
placeholder={localize('general.password')} | ||
autofocus | ||
submitHandler={handleDeleteClick} | ||
disabled={isBusy} | ||
/> | ||
{/if} | ||
</div> | ||
<Button | ||
disabled={(!password && $isSoftwareProfile) || isBusy} | ||
size={ButtonSize.Medium} | ||
classes="w-full" | ||
onClick={handleDeleteClick} | ||
variant={ButtonVariant.Warning} | ||
{isBusy} | ||
> | ||
{localize('actions.delete')} | ||
</Button> | ||
</div> |
3 changes: 2 additions & 1 deletion
3
packages/mobile/views/dashboard/drawers/profile/views/settings/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