~james/core

core/web/src/lib/components/settings/VerifyEmailCard.svelte -rw-r--r-- 1.6 KiB
452f17b7 — james chore(import): snapshot james.dad.town/core at f70c71c7696a 15 hours ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<script lang="ts">
	import Button from "#lib/components/ui/Button.svelte";
	import MailCheck from "$icon/mail-check";
	import Settings from "$icon/settings";
	import TriangleAlert from "$icon/triangle-alert";

	type VerifyEmailState =
		| { kind: "verifying" }
		| { kind: "done"; email: string }
		| { kind: "error"; message: string };

	interface Props {
		state: VerifyEmailState;
	}

	let { state }: Props = $props();
</script>

<div
	class="flex w-full flex-col items-center gap-4 rounded-md border border-border-default bg-background-default p-8 text-center"
>
	{#if state.kind === "verifying"}
		<span class="typography-paragraph-regular text-foreground-muted"
			>Verifying your email address…</span
		>
	{:else if state.kind === "done"}
		<MailCheck class="size-8 text-foreground-success" aria-hidden="true" />
		<h1 class="typography-heading-2 text-foreground-default">Email verified</h1>
		<p class="typography-paragraph-regular text-foreground-muted">
			<span class="font-medium wrap-anywhere text-foreground-default">{state.email}</span> is now
			verified on your account.
		</p>
		<p class="typography-paragraph-small text-foreground-muted">
			Return to the tab you started in to continue.
		</p>
	{:else}
		<TriangleAlert class="size-8 text-foreground-danger" aria-hidden="true" />
		<h1
			data-testid="verificationFailedHeading"
			class="typography-heading-2 text-foreground-default"
		>
			Verification failed
		</h1>
		<p
			data-testid="verificationErrorMessage"
			class="typography-paragraph-regular text-foreground-muted"
		>
			{state.message}
		</p>
		<Button icon={Settings} href="/settings/emails">Go to email settings</Button>
	{/if}
</div>