impr: make signup page more user friendly
This commit is contained in:
8 files changed
+350
-181
No files matched your search
@@ -17,13 +17,15 @@
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { goto } from '$app/navigation'
|
||||
import VirtualList from '$lib/components/render/VirtualList.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { DEFAULT_INSTANCE_URL } from '$lib/instance.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 { ArrowLeft, Icon } from 'svelte-hero-icons'
|
||||
|
||||
let selectedInstance: string = $state('')
|
||||
let validating: boolean = $state(false)
|
||||
@@ -65,49 +67,51 @@
|
||||
</svelte:head>
|
||||
|
||||
<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>
|
||||
<p>{$t('form.signup.description')}</p>
|
||||
<p>
|
||||
{$t('form.signup.info')}
|
||||
</p>
|
||||
<Material color="distinct" class="h-96 overflow-auto" rounding="2xl">
|
||||
<div
|
||||
class="flex flex-col h-full divide-y divide-slate-200 dark:divide-zinc-800"
|
||||
{#if instances}
|
||||
<VirtualList
|
||||
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}
|
||||
{#each instances as instance (instance)}
|
||||
<button
|
||||
onclick={() => (selectedInstance = instance.baseurl ?? '')}
|
||||
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"
|
||||
>
|
||||
<Avatar
|
||||
width={32}
|
||||
url={instance.icon}
|
||||
alt={instance.name}
|
||||
class="shrink-0"
|
||||
/>
|
||||
<div class="flex flex-col max-h-full w-full">
|
||||
<span
|
||||
class="font-medium text-base whitespace-nowrap text-ellipsis"
|
||||
>
|
||||
{instance.name}
|
||||
</span>
|
||||
<span
|
||||
class="whitespace-nowrap text-ellipsis overflow-hidden w-full"
|
||||
>
|
||||
{instance.desc}
|
||||
</span>
|
||||
</div>
|
||||
</button>
|
||||
{/each}
|
||||
{:else}
|
||||
<div class="mx-auto my-auto self-center justify-self-center">
|
||||
<Spinner width={32} />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</Material>
|
||||
{#snippet item(i)}
|
||||
<button
|
||||
onclick={() => (selectedInstance = instances![i].baseurl ?? '')}
|
||||
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
|
||||
p-4"
|
||||
>
|
||||
<Avatar
|
||||
width={32}
|
||||
url={instances![i].icon}
|
||||
alt={instances![i].name}
|
||||
class="shrink-0"
|
||||
/>
|
||||
<div class="flex flex-col max-h-full w-full">
|
||||
<span class="font-medium text-base whitespace-nowrap text-ellipsis">
|
||||
{instances![i].name}
|
||||
</span>
|
||||
<span
|
||||
class="whitespace-nowrap text-ellipsis overflow-hidden w-full"
|
||||
>
|
||||
{instances![i].desc}
|
||||
</span>
|
||||
</div>
|
||||
</button>
|
||||
{/snippet}
|
||||
</VirtualList>
|
||||
{/if}
|
||||
<form
|
||||
class="flex flex-col gap-4"
|
||||
onsubmit={preventDefault(async () => {
|
||||
|
||||
Reference in new issue
Block a user