flotilla/src/app/components/SignUpProfile.svelte

49 lines
1.4 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"
2026-01-30 22:14:12 +00:00
import Modal from "@lib/components/Modal.svelte"
import ModalBody from "@lib/components/ModalBody.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>
2026-01-30 22:14:12 +00:00
<Modal>
<ModalBody>
<ProfileEditForm isSignup {initialValues} {onsubmit}>
{#snippet footer()}
<ModalFooter>
<Button class="btn btn-link" onclick={back}>
<Icon icon={AltArrowLeft} />
Go back
</Button>
<Button class="btn btn-primary" type="submit">
Create Account
<Icon icon={AltArrowRight} />
</Button>
</ModalFooter>
{/snippet}
</ProfileEditForm>
</ModalBody>
</Modal>