flotilla/src/app/components/SignUpProfile.svelte

45 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"
2025-08-18 22:02:17 +00:00
import ModalFooter from "@lib/components/ModalFooter.svelte"
2025-02-14 18:53:36 +00:00
import ProfileEditForm from "@app/components/ProfileEditForm.svelte"
2025-12-18 02:43:13 +00:00
type Props = {
2026-01-16 18:06:25 +00:00
next: () => void
2025-12-18 02:43:13 +00:00
}
2026-01-16 18:06:25 +00:00
const {next}: Props = $props()
2025-12-18 02:43:13 +00:00
2026-01-16 18:06:25 +00:00
const profile = getKey<Profile>("signup.profile")!
const initialValues = {profile, shouldBroadcast: false}
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>
2025-08-18 22:02:17 +00:00
<div class="flex flex-col gap-4">
<ProfileEditForm isSignup {initialValues} {onsubmit}>
{#snippet footer()}
<ModalFooter>
<Button class="btn btn-link" onclick={back}>
2025-09-10 22:26:39 +00:00
<Icon icon={AltArrowLeft} />
2025-08-18 22:02:17 +00:00
Go back
</Button>
<Button class="btn btn-primary" type="submit">
Create Account
2025-09-10 22:26:39 +00:00
<Icon icon={AltArrowRight} />
2025-08-18 22:02:17 +00:00
</Button>
</ModalFooter>
{/snippet}
</ProfileEditForm>
</div>