forked from coracle/flotilla
73 lines
2.1 KiB
Svelte
73 lines
2.1 KiB
Svelte
<script lang="ts">
|
|
import {sleep} from "@welshman/lib"
|
|
import {preventDefault} from "@lib/html"
|
|
import {getKey} from "@lib/implicit"
|
|
import Spinner from "@lib/components/Spinner.svelte"
|
|
import Button from "@lib/components/Button.svelte"
|
|
import FieldInline from "@lib/components/FieldInline.svelte"
|
|
import Key from "@assets/icons/key-minimalistic.svg?dataurl"
|
|
import AltArrowLeft from "@assets/icons/alt-arrow-left.svg?dataurl"
|
|
import AltArrowRight from "@assets/icons/alt-arrow-right.svg?dataurl"
|
|
import Icon from "@lib/components/Icon.svelte"
|
|
import ModalHeader from "@lib/components/ModalHeader.svelte"
|
|
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
|
|
|
type Props = {
|
|
next: () => void
|
|
}
|
|
|
|
const {next}: Props = $props()
|
|
|
|
const email = getKey<string>("signup.email")
|
|
|
|
const back = () => history.back()
|
|
|
|
const onSubmit = async () => {
|
|
loading = true
|
|
|
|
// Just pretend we're validating, they clearly got a code from somewhere
|
|
await sleep(800)
|
|
|
|
next()
|
|
}
|
|
|
|
let challenge = $state("")
|
|
let loading = $state(false)
|
|
</script>
|
|
|
|
<form class="column gap-4" onsubmit={preventDefault(onSubmit)}>
|
|
<ModalHeader>
|
|
{#snippet title()}
|
|
<div>Verify your Email Address</div>
|
|
{/snippet}
|
|
{#snippet info()}
|
|
<div>Enter the one-time confirmation code sent to your email</div>
|
|
{/snippet}
|
|
</ModalHeader>
|
|
<FieldInline>
|
|
{#snippet label()}
|
|
<p>Confirmation Code*</p>
|
|
{/snippet}
|
|
{#snippet input()}
|
|
<label class="input input-bordered flex w-full items-center gap-2">
|
|
<Icon icon={Key} />
|
|
<input bind:value={challenge} />
|
|
</label>
|
|
{/snippet}
|
|
</FieldInline>
|
|
<p class="text-sm">
|
|
We just sent a one-time confirmation code to {email}. Once you receive it, you can enter it
|
|
above.
|
|
</p>
|
|
<ModalFooter>
|
|
<Button class="btn btn-link" onclick={back} disabled={loading}>
|
|
<Icon icon={AltArrowLeft} />
|
|
Go back
|
|
</Button>
|
|
<Button type="submit" class="btn btn-primary" disabled={loading || !challenge}>
|
|
<Spinner {loading}>Log In</Spinner>
|
|
<Icon icon={AltArrowRight} />
|
|
</Button>
|
|
</ModalFooter>
|
|
</form>
|