flotilla/src/app/components/SignUpProfile.svelte

47 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-08-18 22:02:17 +00:00
import {makeProfile} 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"
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-08-18 22:02:17 +00:00
import SignUpKey from "@app/components/SignUpKey.svelte"
2025-12-18 02:43:13 +00:00
import SignUpEmail from "@app/components/SignUpEmail.svelte"
import {pushModal} from "@app/util/modal"
2025-02-14 18:53:36 +00:00
2025-12-18 02:43:13 +00:00
type Props = {
flow: "nostr" | "email"
}
const {flow}: Props = $props()
2025-04-15 16:36:39 +00:00
const initialValues = {
profile: makeProfile(),
2025-08-18 22:02:17 +00:00
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
2025-12-18 02:43:13 +00:00
const onsubmit = (values: {profile: Profile}) =>
pushModal(flow === "nostr" ? SignUpKey : SignUpEmail, values)
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>