-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
129 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<script> | ||
//To handle true and false, or in this case show and hide. | ||
import { fade } from 'svelte/transition'; | ||
import { createEventDispatcher } from 'svelte'; | ||
const dispatch = createEventDispatcher(); | ||
const close = () => { | ||
dispatch('close'); | ||
}; | ||
</script> | ||
|
||
<div on:click|self={close} in:fade={{ duration: 100 }} out:fade={{ duration: 100 }} class="backdrop"> | ||
<slot></slot> | ||
</div> | ||
|
||
<style lang="scss"> | ||
.backdrop { | ||
position: fixed; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
top: 0; | ||
bottom: 0; | ||
left: 0; | ||
width: 100%; | ||
background-color: var(--backdrop-color); | ||
backdrop-filter: blur(8px); | ||
z-index: 103; | ||
border-radius: 15px; | ||
} | ||
</style> |
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,76 @@ | ||
<script> | ||
import { fly } from 'svelte/transition'; | ||
import Backdrop from '$lib/components/Backdrop.svelte'; | ||
import { createEventDispatcher } from 'svelte'; | ||
import { goto } from '$app/navigation'; | ||
import { wallet } from '$lib/stores/wallet'; | ||
import Button from './buttons/Button.svelte'; | ||
const dispatch = createEventDispatcher(); | ||
let password = ''; | ||
let enableButton = false; | ||
$: if (password.length > 1) enableButton = true; | ||
else enableButton = false; | ||
const verify = async () => { | ||
const result = await window.api.verifyPass(password); | ||
if (!result) { | ||
window.api.errorMessage('Wrong password'); | ||
return; | ||
} | ||
goto('/auth/backup-wallet'); | ||
close(); | ||
}; | ||
const keyDown = (e) => { | ||
if (e.key === 'Enter' && password.length > 0) { | ||
verify(); | ||
} else if (e.key === 'Escape') { | ||
close(); | ||
} | ||
}; | ||
const close = () => { | ||
$wallet.verify = false; | ||
}; | ||
</script> | ||
|
||
<svelte:window on:keydown={keyDown} /> | ||
<Backdrop on:close={close}> | ||
<div in:fly={{ y: 20 }} out:fly={{ y: -50 }} class="field"> | ||
<input placeholder="Enter password" spellcheck="false" type="password" autocomplete="false" bind:value={password} /> | ||
<Button on:click={verify} enabled={enableButton} disabled={!enableButton} text="Confirm" /> | ||
</div> | ||
</Backdrop> | ||
|
||
<style lang="scss"> | ||
.field { | ||
width: 50%; | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
position: absolute; | ||
padding: 0 0 0 0.5rem; | ||
background-color: var(--card-background); | ||
border: 1px solid var(--card-border); | ||
border-radius: 0.4rem; | ||
padding-right: 10px; | ||
} | ||
input { | ||
margin: 0 auto; | ||
width: 100%; | ||
height: 50px; | ||
transition: 200ms ease-in-out; | ||
color: var(--text-color); | ||
background-color: transparent; | ||
border: none; | ||
font-size: 1.1rem; | ||
&:focus { | ||
outline: none; | ||
border: none; | ||
} | ||
} | ||
</style> |
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