impr: improve signup experience (#608)

* impr: make signup page more user friendly

* feat: improve email verification stage

* lint: unused imports erro
This commit is contained in:
Xylight authored and GitHub committed 2025-07-11 19:47:17 -07:00
commit 7ca16663c1
9 files changed
+374 -195

No files matched your search

+17 -4
View File
@@ -15,6 +15,8 @@
} }
initialOffset?: number initialOffset?: number
debounceResize?: number debounceResize?: number
useWindow?: boolean
height?: number
} }
let { let {
@@ -25,6 +27,8 @@
initialOffset = 0, initialOffset = 0,
restore = $bindable(), restore = $bindable(),
debounceResize = 100, debounceResize = 100,
useWindow = true,
height = 0,
...rest ...rest
}: Props = $props() }: Props = $props()
@@ -177,15 +181,24 @@
}) })
</script> </script>
<svelte:window bind:scrollY /> <svelte:window
bind:scrollY={
() => (useWindow ? scrollY : 0),
v => {
if (useWindow) scrollY = v
}
}
/>
<div <div
bind:this={virtualListEl} bind:this={virtualListEl}
style="position: relative; height: {cumulativeItemHeights[ style="position: relative; height: {height ||
visibleItems?.[visibleItems.length - 1]?.index cumulativeItemHeights[visibleItems?.[visibleItems.length - 1]?.index]}px;"
]}px;"
{...rest} {...rest}
id="feed" id="feed"
onscroll={() => {
if (!useWindow) scrollY = virtualListEl?.scrollTop ?? 0
}}
> >
<div <div
style="height: {cumulativeItemHeights[visibleItems?.[0]?.index - 1] || style="height: {cumulativeItemHeights[visibleItems?.[0]?.index - 1] ||
+1 -1
View File
@@ -64,7 +64,7 @@
style: 'grid-area: sidebar; width: 100% !important;', style: 'grid-area: sidebar; width: 100% !important;',
})} })}
{@render main?.({ {@render main?.({
class: `w-full bg-slate-25 dark:bg-zinc-925 justify-self-center shadow-xs z-0 main pb-22 lg:pb-0 lg:pt-20!`, class: `w-full bg-slate-25 dark:bg-zinc-925 justify-self-center shadow-xs main pb-22 lg:pt-20! pb-4 sm:pb-6`,
style: 'grid-area: main', style: 'grid-area: main',
})} })}
{@render suffix?.({ {@render suffix?.({
+21 -6
View File
@@ -20,6 +20,7 @@
} from 'mono-svelte' } from 'mono-svelte'
import type { Placement } from 'svelte-floating-ui/core' import type { Placement } from 'svelte-floating-ui/core'
import { import {
ArrowLeftOnRectangle,
Bars3, Bars3,
Bookmark, Bookmark,
BugAnt, BugAnt,
@@ -27,6 +28,7 @@
Cog6Tooth, Cog6Tooth,
ComputerDesktop, ComputerDesktop,
Icon, Icon,
Identification,
Inbox, Inbox,
Moon, Moon,
ServerStack, ServerStack,
@@ -91,13 +93,13 @@
{#if profile.data?.jwt} {#if profile.data?.jwt}
<MenuButton href="/profile"> <MenuButton href="/profile">
{#snippet prefix()} {#snippet prefix()}
<Icon src={UserCircle} micro width={16} /> <Icon src={UserCircle} micro size="16" />
{/snippet} {/snippet}
{$t('profile.profile')} {$t('profile.profile')}
</MenuButton> </MenuButton>
<MenuButton href="/inbox"> <MenuButton href="/inbox">
{#snippet prefix()} {#snippet prefix()}
<Icon src={Inbox} micro width={16} /> <Icon src={Inbox} micro size="16" />
{/snippet} {/snippet}
{$t('profile.inbox')} {$t('profile.inbox')}
{#if $notifications.inbox > 0} {#if $notifications.inbox > 0}
@@ -108,21 +110,34 @@
</MenuButton> </MenuButton>
<MenuButton href="/saved"> <MenuButton href="/saved">
{#snippet prefix()} {#snippet prefix()}
<Icon src={Bookmark} micro width={16} /> <Icon src={Bookmark} micro size="16" />
{/snippet} {/snippet}
{$t('profile.saved')} {$t('profile.saved')}
</MenuButton> </MenuButton>
{:else}
<MenuButton href="/accounts/login">
{#snippet prefix()}
<Icon src={ArrowLeftOnRectangle} mini size="16" />
{/snippet}
{$t('account.login')}
</MenuButton>
<MenuButton href="/signup">
{#snippet prefix()}
<Icon src={Identification} micro size="16" />
{/snippet}
{$t('account.signup')}
</MenuButton>
{/if} {/if}
<MenuButton href="/accounts"> <MenuButton href="/accounts">
{#snippet prefix()} {#snippet prefix()}
<Icon src={UserGroup} micro width={16} /> <Icon src={UserGroup} micro size="16" />
{/snippet} {/snippet}
{$t('account.accounts')} {$t('account.accounts')}
</MenuButton> </MenuButton>
<MenuDivider>{$t('nav.menu.app')}</MenuDivider> <MenuDivider>{$t('nav.menu.app')}</MenuDivider>
<MenuButton href="/settings"> <MenuButton href="/settings">
{#snippet prefix()} {#snippet prefix()}
<Icon src={Cog6Tooth} micro width={16} /> <Icon src={Cog6Tooth} micro size="16" />
{/snippet} {/snippet}
{$t('nav.menu.settings')} {$t('nav.menu.settings')}
</MenuButton> </MenuButton>
@@ -166,7 +181,7 @@
{#if settings.debugInfo} {#if settings.debugInfo}
<MenuButton href="/util"> <MenuButton href="/util">
{#snippet prefix()} {#snippet prefix()}
<Icon src={BugAnt} mini width={16} /> <Icon src={BugAnt} mini size="16" />
{/snippet} {/snippet}
Debug Debug
</MenuButton> </MenuButton>
+13 -6
View File
@@ -183,12 +183,19 @@
"chooseInstance": "Choose an instance", "chooseInstance": "Choose an instance",
"application": { "application": {
"label": "Application", "label": "Application",
"info": "To join this instance, you must fill out this application, and wait to be accepted. You will receive an email if your application is accepted." "info": "To join this instance, you must fill out this application, and wait to be accepted. You will receive an email if your application is accepted.",
"notice": "Your signup is now pending. Once an administrator reviews it, you will receive an email if it was accepted. You then can log in."
}, },
"closed": { "closed": {
"title": "Registrations closed", "title": "Registrations closed",
"description": "This instance has registrations closed. Find another instance.", "description": "This instance has registrations closed. Find another instance.",
"anotherInstance": "Find another instance" "anotherInstance": "Find another instance"
},
"verify": {
"title": "Verify email",
"description": "Check your inbox for a verification link. Once you've clicked it, press the button below.",
"submit": "I've verified my email",
"error": "Your email has not been verified."
} }
}, },
"description": "Description", "description": "Description",
@@ -927,14 +934,14 @@
"incorrect_login": "Incorrect login credentials. Please try again.", "incorrect_login": "Incorrect login credentials. Please try again.",
"incorrect_login_2": "Incorrect login credentials. Try again.", "incorrect_login_2": "Incorrect login credentials. Try again.",
"incorrect_login_3": "Incorrect, again. Try a few more times.", "incorrect_login_3": "Incorrect, again. Try a few more times.",
"incorrect_login_4": "Those still aren't the right credentials. Keep trying.", "incorrect_login_4": "Successfully logged-wait no. Incorrect credentials.",
"incorrect_login_5": "I swear, you need to look at the keys you're pressing.", "incorrect_login_5": "Look at your keyboard while typing this time.",
"incorrect_login_6": "Is this a joke to you?", "incorrect_login_6": "I believe in you.",
"incorrect_login_7": "Either you struggle with typing or you're harassing me at this point.", "incorrect_login_7": "Okay, you're messing with me now.",
"incorrect_login_8": "I give up.", "incorrect_login_8": "I give up.",
"incorrect_login_9": "Each of these requests you make are sending data through via an incredible technology. And you're using it to make failed logins.", "incorrect_login_9": "Each of these requests you make are sending data through via an incredible technology. And you're using it to make failed logins.",
"incorrect_login_10": "Think about this. The poor instance admins have to maintain their server just for you to make these useless requests.", "incorrect_login_10": "Think about this. The poor instance admins have to maintain their server just for you to make these useless requests.",
"incorrect_login_11": "I give up, for real this time.", "incorrect_login_11": "Each press of the button uses thousands of CPU cycles to process your request, which ends up failing.",
"incorrect_login_12": "...", "incorrect_login_12": "...",
"registration_application_is_pending": "The registration application for that account hasn't been accepted yet.", "registration_application_is_pending": "The registration application for that account hasn't been accepted yet.",
"couldnt_find_post": "That post doesn't exist, isn't on this instance, or was removed.", "couldnt_find_post": "That post doesn't exist, isn't on this instance, or was removed.",
+8 -1
View File
@@ -23,6 +23,7 @@
ChevronUp, ChevronUp,
EllipsisHorizontal, EllipsisHorizontal,
Icon, Icon,
Identification,
Plus, Plus,
QuestionMarkCircle, QuestionMarkCircle,
} from 'svelte-hero-icons' } from 'svelte-hero-icons'
@@ -119,6 +120,12 @@
{/snippet} {/snippet}
{$t('account.login')} {$t('account.login')}
</Button> </Button>
<Button href="/signup" rounding="pill" class="px-4">
{#snippet prefix()}
<Icon src={Identification} size="16" mini />
{/snippet}
{$t('account.signup')}
</Button>
{#if !LINKED_INSTANCE_URL} {#if !LINKED_INSTANCE_URL}
<Button href="/accounts/login/guest" rounding="pill"> <Button href="/accounts/login/guest" rounding="pill">
{#snippet prefix()} {#snippet prefix()}
@@ -177,7 +184,7 @@
size="custom" size="custom"
class="absolute top-0 right-0 w-6 h-6 m-1" class="absolute top-0 right-0 w-6 h-6 m-1"
color="tertiary" color="tertiary"
aria-label={$t('post.actions.more')} aria-label={$t('post.actions.more.label')}
> >
{#snippet prefix()} {#snippet prefix()}
<Icon src={EllipsisHorizontal} mini size="16" /> <Icon src={EllipsisHorizontal} mini size="16" />
+9
View File
@@ -0,0 +1,9 @@
<script lang="ts">
let { children } = $props()
</script>
<div
class="fixed inset-0 bg-slate-50 dark:bg-zinc-925 z-50 p-8 sm:p-16 lg:p-24 overflow-auto"
>
{@render children?.()}
</div>
+42 -38
View File
@@ -17,13 +17,15 @@
import { preventDefault } from 'svelte/legacy' import { preventDefault } from 'svelte/legacy'
import { goto } from '$app/navigation' import { goto } from '$app/navigation'
import VirtualList from '$lib/components/render/VirtualList.svelte'
import Avatar from '$lib/components/ui/Avatar.svelte' import Avatar from '$lib/components/ui/Avatar.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte' import Header from '$lib/components/ui/layout/pages/Header.svelte'
import { t } from '$lib/i18n/translations' import { t } from '$lib/i18n/translations'
import { DEFAULT_INSTANCE_URL } from '$lib/instance.svelte.js' import { DEFAULT_INSTANCE_URL } from '$lib/instance.svelte.js'
import { validateInstance } from '$lib/lemmy.svelte.js' import { validateInstance } from '$lib/lemmy.svelte.js'
import { Button, Material, Spinner, TextInput, toast } from 'mono-svelte' import { Button, TextInput, toast } from 'mono-svelte'
import { onMount } from 'svelte' import { onMount } from 'svelte'
import { ArrowLeft, Icon } from 'svelte-hero-icons'
let selectedInstance: string = $state('') let selectedInstance: string = $state('')
let validating: boolean = $state(false) let validating: boolean = $state(false)
@@ -65,49 +67,51 @@
</svelte:head> </svelte:head>
<div class="mx-auto max-w-xl flex flex-col gap-4 my-auto h-max w-full"> <div class="mx-auto max-w-xl flex flex-col gap-4 my-auto h-max w-full">
<Button href="/accounts" class="inline-block mb-4 w-max" rounding="pill">
<Icon src={ArrowLeft} size="16" micro />
{$t('common.back')}
</Button>
<Header>{$t('form.signup.title')}</Header> <Header>{$t('form.signup.title')}</Header>
<p>{$t('form.signup.description')}</p> <p>{$t('form.signup.description')}</p>
<p> <p>
{$t('form.signup.info')} {$t('form.signup.info')}
</p> </p>
<Material color="distinct" class="h-96 overflow-auto" rounding="2xl"> {#if instances}
<div <VirtualList
class="flex flex-col h-full divide-y divide-slate-200 dark:divide-zinc-800" items={instances}
useWindow={false}
height={400}
estimatedHeight={50}
class="overflow-auto border rounded-2xl border-slate-200 dark:border-zinc-900 bg-white dark:bg-zinc-950
divide-y divide-slate-200 dark:divide-zinc-900"
> >
{#if instances} {#snippet item(i)}
{#each instances as instance (instance)} <button
<button onclick={() => (selectedInstance = instances![i].baseurl ?? '')}
onclick={() => (selectedInstance = instance.baseurl ?? '')} class="flex flex-row gap-2 text-left py-2 first:pt-0 last:pb-0 items-center
class="flex flex-row gap-2 text-left py-2 first:pt-0 last:pb-0 items-center h-16 max-h-16 min-h-16 overflow-hidden w-full cursor-pointer hover:bg-slate-50 hover:dark:bg-zinc-925 duration-100
h-16 max-h-16 min-h-16 overflow-hidden w-full" p-4"
> >
<Avatar <Avatar
width={32} width={32}
url={instance.icon} url={instances![i].icon}
alt={instance.name} alt={instances![i].name}
class="shrink-0" class="shrink-0"
/> />
<div class="flex flex-col max-h-full w-full"> <div class="flex flex-col max-h-full w-full">
<span <span class="font-medium text-base whitespace-nowrap text-ellipsis">
class="font-medium text-base whitespace-nowrap text-ellipsis" {instances![i].name}
> </span>
{instance.name} <span
</span> class="whitespace-nowrap text-ellipsis overflow-hidden w-full"
<span >
class="whitespace-nowrap text-ellipsis overflow-hidden w-full" {instances![i].desc}
> </span>
{instance.desc} </div>
</span> </button>
</div> {/snippet}
</button> </VirtualList>
{/each} {/if}
{:else}
<div class="mx-auto my-auto self-center justify-self-center">
<Spinner width={32} />
</div>
{/if}
</div>
</Material>
<form <form
class="flex flex-col gap-4" class="flex flex-col gap-4"
onsubmit={preventDefault(async () => { onsubmit={preventDefault(async () => {
+256 -134
View File
@@ -4,15 +4,31 @@
import { goto } from '$app/navigation' import { goto } from '$app/navigation'
import { page } from '$app/state' import { page } from '$app/state'
import { setUser } from '$lib/auth.svelte.js' import { setUser } from '$lib/auth.svelte.js'
import ErrorContainer, {
clearErrorScope,
pushError,
} from '$lib/components/error/ErrorContainer.svelte'
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
import Markdown from '$lib/components/markdown/Markdown.svelte' import Markdown from '$lib/components/markdown/Markdown.svelte'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte' import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import Avatar from '$lib/components/ui/Avatar.svelte' import Avatar from '$lib/components/ui/Avatar.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import Placeholder from '$lib/components/ui/Placeholder.svelte' import Placeholder from '$lib/components/ui/Placeholder.svelte'
import { Checkbox, Material, Spinner, toast } from 'mono-svelte' import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
import { t } from '$lib/i18n/translations.js'
import { getClient } from '$lib/lemmy.svelte.js' import { getClient } from '$lib/lemmy.svelte.js'
import { errorMessage } from '$lib/lemmy/error.js'
import type { GetCaptchaResponse } from 'lemmy-js-client' import type { GetCaptchaResponse } from 'lemmy-js-client'
import { Button, TextInput } from 'mono-svelte'
import { import {
Button,
Checkbox,
Material,
Spinner,
TextInput,
toast,
} from 'mono-svelte'
import {
ArrowLeft,
ArrowPath, ArrowPath,
ExclamationCircle, ExclamationCircle,
ExclamationTriangle, ExclamationTriangle,
@@ -21,15 +37,13 @@
QuestionMarkCircle, QuestionMarkCircle,
XCircle, XCircle,
} from 'svelte-hero-icons' } from 'svelte-hero-icons'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import { t } from '$lib/i18n/translations.js'
let { data } = $props() let { data } = $props()
let stage = $state<'signup' | 'verify' | 'application'>('signup')
const instance = page.params.instance const instance = page.params.instance
let captchaRequired = data.site_view.local_site.captcha_enabled let captchaRequired = data.site_view.local_site.captcha_enabled
let email: string | undefined = $state('') let email: string | undefined = $state('')
$effect(() => { $effect(() => {
@@ -44,7 +58,8 @@
application: string = $state(''), application: string = $state(''),
submitting: boolean = $state(false), submitting: boolean = $state(false),
honeypot: string | undefined = $state(undefined), honeypot: string | undefined = $state(undefined),
nsfw: boolean = $state(false) nsfw: boolean = $state(false),
verifying: boolean = $state(false)
const getCaptcha = async () => const getCaptcha = async () =>
(captcha = await getClient(instance, fetch).getCaptcha()) (captcha = await getClient(instance, fetch).getCaptcha())
@@ -54,6 +69,7 @@
) )
async function submit() { async function submit() {
clearErrorScope(page.url.pathname)
submitting = true submitting = true
try { try {
@@ -69,30 +85,21 @@
honeypot, honeypot,
}) })
const registrationMode = data.site_view.local_site.registration_mode
if (res?.jwt) { if (res?.jwt) {
await setUser(res.jwt, page.params.instance, username) await setUser(res.jwt, page.params.instance)
toast({ content: $t('toast.logIn'), type: 'success' }) toast({ content: $t('toast.logIn'), type: 'success' })
goto('/') goto('/')
} else if ( } else if (
res.verify_email_sent || res.verify_email_sent ||
data.site_view.local_site.registration_mode == 'RequireApplication' registrationMode == 'RequireApplication'
) { ) {
if (res.verify_email_sent) { if (res.verify_email_sent) return (stage = 'verify')
toast({
content: $t('toast.verifyEmail'), if (registrationMode == 'RequireApplication')
type: 'info', return stage == 'application'
})
}
if (
data.site_view.local_site.registration_mode == 'RequireApplication'
) {
toast({
content: $t('toast.waitApplication'),
type: 'info',
})
}
goto('/')
} else { } else {
throw new Error($t('toast.failSignup')) throw new Error($t('toast.failSignup'))
} }
@@ -102,126 +109,241 @@
type: 'success', type: 'success',
}) })
} catch (err) { } catch (err) {
toast({ pushError({
content: err as string, scope: page.url.pathname,
type: 'error', message: errorMessage(err as string),
}) })
} }
submitting = false submitting = false
} }
async function verifiedEmail() {
verifying = true
clearErrorScope(page.url.pathname)
try {
const res = await getClient(instance, fetch).login({
username_or_email: username,
password: password,
})
if (res.jwt) {
await setUser(res.jwt, page.params.instance)
goto('/')
} else if (res.verify_email_sent) {
pushError({
scope: page.url.pathname,
message: $t('form.signup.verify.error'),
})
} else {
stage = 'application'
}
} catch (err) {
pushError({
scope: page.url.pathname,
message: errorMessage(err as string),
})
}
verifying = false
}
</script> </script>
<svelte:head> <svelte:head>
<title>Sign up</title> <title>{$t('account.signup')}</title>
</svelte:head> </svelte:head>
<form <div class="flex flex-col md:flex-row flex-1/3 gap-8 h-full max-w-5xl mx-auto">
class="flex flex-col gap-4 max-w-2xl mx-auto h-full w-full" {#if stage == 'signup'}
onsubmit={preventDefault(submit)} <form
> class="flex flex-col gap-4 h-full w-full flex-2/3"
<span class="flex gap-4 items-center font-bold text-xl text-center mx-auto"> onsubmit={preventDefault(submit)}
{#if data.site_view.site.icon}
<Avatar circle={false} width={48} url={data.site_view.site.icon} />
{/if}
{data.site_view.site.name}
</span>
{#if data.site_view.local_site.registration_mode != 'Closed'}
<Header>{$t('form.signup.title')}</Header>
<TextInput
bind:value={email}
label={$t('form.email')}
required={data.site_view.local_site.require_email_verification}
type="email"
/>
<TextInput bind:value={username} label={$t('form.username')} required />
<TextInput
bind:value={password}
label={$t('form.password')}
required
type="password"
/>
<TextInput
bind:value={passwordVerify}
label={$t('form.confirmPassword')}
required
type="password"
/>
{#if data.site_view.local_site.registration_mode == 'RequireApplication'}
<Material class="dark:text-yellow-200 text-yellow-800 bg-yellow-500/20">
<Icon src={ExclamationTriangle} mini size="20" />
{$t('form.signup.application.info')}
</Material>
{#if data.site_view.local_site.application_question}
<Markdown source={data.site_view.local_site.application_question} />
{/if}
<MarkdownEditor
label={$t('form.signup.application.label')}
required
bind:value={application}
/>
{/if}
{#if captchaRequired}
<div>
<div class="block my-1 font-bold text-sm">Captcha</div>
<div class="flex flex-col gap-4">
{#await getCaptcha()}
<Spinner width={32} />
{:then}
{#if captcha?.ok}
<img
src="data:image/png;base64,{captcha.ok.png}"
alt="Captcha"
class="w-max"
/>
<audio controls src={captchaAudio}></audio>
{:else}
<Material
class="flex gap-2 dark:text-yellow-200 text-yellow-800 bg-yellow-500/20"
>
<Icon src={QuestionMarkCircle} mini size="24" />
No captcha was returned
</Material>
{/if}
{:catch err}
<Material
padding="sm"
class="flex gap-2 dark:text-yellow-200 text-yellow-800 bg-yellow-500/20"
>
<Icon src={ExclamationCircle} mini size="24" />
{err}
</Material>
{/await}
<Button onclick={() => getCaptcha()} size="square-md">
<Icon src={ArrowPath} size="16" mini />
</Button>
<TextInput required bind:value={verifyCaptcha} />
</div>
</div>
{/if}
<Checkbox bind:checked={nsfw}>{$t('form.profile.showNSFW')}</Checkbox>
<input type="dn" name="honeypot" bind:value={honeypot} class="hidden" />
<Button
submit
color="primary"
size="lg"
loading={submitting}
disabled={submitting}
class="mt-auto"
> >
{$t('form.submit')} <Button href="/signup" class="inline-block mb-4 w-max" rounding="pill">
</Button> <Icon src={ArrowLeft} size="16" micro />
{:else} {$t('common.back')}
<div class="my-auto"> </Button>
<Placeholder <Header>
icon={XCircle} {$t('form.signup.title')}
title={$t('form.signup.closed.title')} {#snippet extended()}
description={$t('form.signup.closed.description')} <span class="flex gap-4 items-center text-xl text-center mx-auto">
> {#if data.site_view.site.icon}
<Button icon={Plus} href="/signup"> <Avatar
{$t('form.signup.closed.anotherInstance')} circle={false}
width={48}
url={data.site_view.site.icon}
/>
{/if}
{data.site_view.site.name}
</span>
{/snippet}
</Header>
{#if data.site_view.local_site.registration_mode != 'Closed'}
<div class="flex flex-col md:flex-row gap-2 *:flex-1">
<TextInput
bind:value={email}
label={$t('form.email')}
required={data.site_view.local_site.require_email_verification}
type="email"
/>
<TextInput
bind:value={username}
label={$t('form.username')}
required
/>
</div>
<div class="flex flex-col md:flex-row gap-2 *:flex-1">
<TextInput
bind:value={password}
label={$t('form.password')}
required
type="password"
/>
<TextInput
bind:value={passwordVerify}
label={$t('form.confirmPassword')}
required
type="password"
/>
</div>
{#if data.site_view.local_site.registration_mode == 'RequireApplication'}
<Material
rounding="2xl"
color="none"
class="bg-yellow-200/10 border border-yellow-500/30 text-yellow-900 dark:text-yellow-50"
>
<Icon
src={ExclamationTriangle}
size="32"
mini
class="inline-block rounded-lg bg-yellow-500 p-1 text-white clear-both float-left mr-2"
/>
{$t('form.signup.application.info')}
</Material>
{#if data.site_view.local_site.application_question}
<Markdown source={data.site_view.local_site.application_question} />
{/if}
<MarkdownEditor
label={$t('form.signup.application.label')}
required
bind:value={application}
/>
{/if}
{#if captchaRequired}
<SectionTitle class="block -mb-3 font-medium text-sm">
Captcha
</SectionTitle>
<Material rounding="2xl">
<div class="flex flex-col gap-4">
{#await getCaptcha()}
<Spinner width={32} />
{:then}
{#if captcha?.ok}
<img
src="data:image/png;base64,{captcha.ok.png}"
alt="Captcha"
class="w-max"
/>
<audio controls src={captchaAudio}></audio>
{:else}
<Material
class="flex gap-2 dark:text-yellow-200 text-yellow-800 bg-yellow-500/20"
>
<Icon src={QuestionMarkCircle} mini size="24" />
No captcha was returned
</Material>
{/if}
{:catch err}
<Material
padding="sm"
class="flex gap-2 dark:text-yellow-200 text-yellow-800 bg-yellow-500/20"
>
<Icon src={ExclamationCircle} mini size="24" />
{err}
</Material>
{/await}
<Button onclick={() => getCaptcha()} size="square-md">
<Icon src={ArrowPath} size="16" mini />
</Button>
<TextInput required bind:value={verifyCaptcha} />
</div>
</Material>
{/if}
<Checkbox bind:checked={nsfw}>{$t('form.profile.showNSFW')}</Checkbox>
<input type="dn" name="honeypot" bind:value={honeypot} class="hidden" />
<Button
submit
color="primary"
size="lg"
loading={submitting}
disabled={submitting}
class="mt-auto"
>
{$t('form.submit')}
</Button> </Button>
</Placeholder> {:else}
<div class="my-auto">
<Placeholder
icon={XCircle}
title={$t('form.signup.closed.title')}
description={$t('form.signup.closed.description')}
>
<Button icon={Plus} href="/signup">
{$t('form.signup.closed.anotherInstance')}
</Button>
</Placeholder>
</div>
{/if}
</form>
{:else if stage == 'verify'}
<div class="flex-2/3 flex flex-col h-full justify-center gap-8">
<h2 class="font-medium text-3xl">{$t('toast.verifyEmail')}</h2>
<ErrorContainer scope={page.url.pathname} />
<form
onsubmit={e => {
e.preventDefault()
verifiedEmail()
}}
class="flex items-center gap-2"
>
<Button
loading={verifying}
disabled={verifying}
submit
color="primary"
rounding="pill"
class="self-start"
>
{$t('form.signup.verify.submit')}
</Button>
<Button href="/signup" rounding="pill">
<Icon src={ArrowLeft} size="16" micro />
{$t('common.back')}
</Button>
</form>
</div>
{:else if stage == 'application'}
<div class="flex-2/3 flex flex-col h-full justify-center gap-8">
<h2 class="font-medium text-3xl">
{$t('form.signup.application.notice')}
</h2>
<Button href="/signup" rounding="pill">
<Icon src={ArrowLeft} size="16" micro />
{$t('common.back')}
</Button>
</div> </div>
{/if} {/if}
</form> <Material
color="uniform"
class="flex-1/3 overflow-auto max-h-full max-md:hidden"
rounding="2xl"
padding="none"
>
<SiteCard
admins={data.admins}
site={data.site_view}
taglines={data.taglines}
version={data.version}
class="w-full p-4"
/>
</Material>
</div>
+7 -5
View File
@@ -1,16 +1,18 @@
<script> <script>
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte' import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
import { t } from '$lib/i18n/translations' import { t } from '$lib/i18n/translations'
import { Check, Icon } from 'svelte-hero-icons' import { CheckCircle, Icon } from 'svelte-hero-icons'
</script> </script>
<div class="flex flex-col items-center h-max my-auto gap-2"> <div class="flex flex-col h-max my-auto gap-2 max-w-xl mx-auto">
<div <div
class="rounded-full bg-green-200 dark:bg-green-700 text-green-600 dark:text-green-200 p-3" class="rounded-full bg-green-200 dark:bg-green-500/20 text-white p-2 w-max"
> >
<Icon src={Check} size="32" mini /> <Icon src={CheckCircle} size="48" solid />
</div> </div>
<h1 class="text-green-800 dark:text-green-200 text-2xl font-semibold"> <h1
class="text-green-800 dark:text-green-200 text-2xl font-medium tracking-tight"
>
{$t('message.success')} {$t('message.success')}
</h1> </h1>
<p class="text-green-800 dark:text-green-200"> <p class="text-green-800 dark:text-green-200">