flotilla/src/app/components/SignUpProfile.svelte

48 lines
1.3 KiB
Svelte
Raw Normal View History

2025-02-14 18:53:36 +00:00
<script lang="ts">
import type {Profile} from "@welshman/util"
2025-09-10 22:26:39 +00:00
import AltArrowLeft from "@assets/icons/alt-arrow-left.svg?dataurl"
import AltArrowRight from "@assets/icons/alt-arrow-right.svg?dataurl"
2026-01-16 18:06:25 +00:00
import {getKey, setKey} from "@lib/implicit"
2025-08-18 22:02:17 +00:00
import Icon from "@lib/components/Icon.svelte"
2025-02-14 18:53:36 +00:00
import Button from "@lib/components/Button.svelte"
import ProfileEditForm from "@app/components/ProfileEditForm.svelte"
import ProgressBar from "@app/components/ProgressBar.svelte"
2025-02-14 18:53:36 +00:00
2025-12-18 02:43:13 +00:00
type Props = {
2026-01-16 18:06:25 +00:00
next: () => void
step?: number
totalSteps?: number
2025-12-18 02:43:13 +00:00
}
const {next, step, totalSteps}: Props = $props()
2025-12-18 02:43:13 +00:00
2026-01-16 18:06:25 +00:00
const profile = getKey<Profile>("signup.profile")!
2026-04-16 18:30:59 +00:00
const initialValues = {profile}
2025-04-15 16:36:39 +00:00
2025-08-18 22:02:17 +00:00
const back = () => history.back()
2025-02-14 18:53:36 +00:00
2026-01-16 18:06:25 +00:00
const onsubmit = ({profile}: {profile: Profile}) => {
setKey("signup.profile", profile)
next()
}
2025-02-14 18:53:36 +00:00
</script>
<ProfileEditForm isSignup {initialValues} {onsubmit}>
{#snippet footer()}
<Button class="button button-link" onclick={back}>
<Icon icon={AltArrowLeft} />
Go back
</Button>
<Button class="button button-primary" type="submit">
Create Account
<Icon icon={AltArrowRight} />
</Button>
{/snippet}
{#snippet progressBar()}
{#if step && totalSteps}
<ProgressBar current={step} total={totalSteps} />
{/if}
{/snippet}
</ProfileEditForm>