design: make signup page look slightly less awful (#717)

* design: make signup page look slightly less awful (allow commonlist in virtualizer)

* misc: make buttons and menus unselectable

* feat: add recommended instances

* fix: broken piefed notifications count
This commit is contained in:
xylight authored and GitHub committed 2026-02-17 05:03:13 +00:00
1 parent ee7c097f80
commit ec7fd81304
14 files changed
+222 -166

No files matched your search

+20 -17
View File
@@ -1,3 +1,4 @@
import { PiefedClient } from '$lib/api/piefed/adapter'
import type { Profile } from './profile.svelte'
interface Notifications {
@@ -56,24 +57,26 @@ export class InboxService {
.then((res) => res.mentions + res.private_messages + res.replies)
.catch(() => 0)
const reportsPromise = this.#profile.isMod()
? this.#profile.client
.getReportCount({})
.then(
(res) =>
res.comment_reports +
res.post_reports +
(res.private_message_reports ?? 0),
)
.catch(() => 0)
: Promise.resolve(0)
const reportsPromise =
!(this.#profile.client instanceof PiefedClient) && this.#profile.isMod()
? this.#profile.client
.getReportCount({})
.then(
(res) =>
res.comment_reports +
res.post_reports +
(res.private_message_reports ?? 0),
)
.catch(() => 0)
: Promise.resolve(0)
const applicationsPromise = this.#profile.isAdmin
? this.#profile.client
.getUnreadRegistrationApplicationCount()
.then((res) => res.registration_applications)
.catch(() => 0)
: Promise.resolve(0)
const applicationsPromise =
!(this.#profile.client instanceof PiefedClient) && this.#profile.isAdmin
? this.#profile.client
.getUnreadRegistrationApplicationCount()
.then((res) => res.registration_applications)
.catch(() => 0)
: Promise.resolve(0)
const [unreads, reports, applications] = await Promise.all([
unreadsPromise,
+5 -3
View File
@@ -194,9 +194,10 @@
"setup": "Setup",
"signup": {
"title": "Sign Up",
"description": "Choose a server that interests you, or type the URL manually.",
"info": "The server you choose is where your account will live. However, every server is connected, and you can still access almost all linked content.",
"description": "Choose the server your account's information will be hosted on.",
"info": "You can access all content across the Fediverse regardless of your account's server, it is generally okay to pick any of the following.",
"chooseInstance": "Choose a server",
"recommended": "Recommended",
"application": {
"label": "Application",
"info": "To join this server, you must fill out this application, and wait to be accepted. You will receive an email if your application is accepted.",
@@ -696,7 +697,8 @@
"remove": "Remove",
"download": "Download",
"attach": "Attach file",
"info": "Info"
"info": "Info",
"continue": "Continue"
},
"message": {
"success": "Success",
+5 -2
View File
@@ -19,6 +19,7 @@
debounceResize?: number
useWindow?: boolean
height?: number
itemContainer?: string
}
let {
@@ -31,6 +32,7 @@
debounceResize = 100,
useWindow = true,
height = 0,
itemContainer = 'div',
...rest
}: Props = $props()
@@ -235,13 +237,14 @@
0}px; border: 0 !important;"
></div>
{#each visibleItems as item (item.index)}
<div
<svelte:element
this={itemContainer}
data-index={item.index}
class="post-container fix-divide group/virtual"
use:resizeObserver
>
{@render itemSnippet(item.index)}
</div>
</svelte:element>
{/each}
</div>
{#if settings.debugInfo}
+1 -1
View File
@@ -22,7 +22,7 @@
nameDetail?: import('svelte').Snippet
actions?: import('svelte').Snippet
children?: import('svelte').Snippet
compact?: 'always' | 'lg'
compact?: 'always' | 'lg' | 'never'
avatarCircle?: boolean
}
+53 -51
View File
@@ -53,13 +53,13 @@
@reference '../../../app.css';
ul {
:global {
:where(& > :not(:last-child)) {
li:not(:last-child) {
margin-block-start: calc(calc(var(--spacing) * 1));
margin-block-end: calc(calc(var(--spacing) * 1));
}
}
}
ul > :global(li) {
ul :global(li:not(ul li li)) {
transition: background-color 0.1s;
background-color: var(--color-white);
container-type: inline-size;
@@ -68,11 +68,11 @@
border-radius: var(--radius-lg) var(--radius-lg);
&:first-child {
&:first-of-type {
border-top-left-radius: var(--radius-2xl);
border-top-right-radius: var(--radius-2xl);
}
&:last-child {
&:last-of-type {
border-bottom-left-radius: var(--radius-2xl);
border-bottom-right-radius: var(--radius-2xl);
}
@@ -80,57 +80,59 @@
&:hover {
background-color: var(--color-slate-25);
}
}
ul > :global(li:not(.xs) > *) {
padding-block: calc(var(--spacing) * 3);
padding-inline: calc(var(--spacing) * 3.5);
@media screen and (min-width: 40rem) {
padding-block: calc(var(--spacing) * 3);
padding-inline: calc(var(--spacing) * 4);
}
}
ul > :global(li.xs > *) {
padding-block: calc(var(--spacing) * 0.5);
padding-block: calc(var(--spacing) * 1);
}
ul > :global(li.selected) {
background-color: color-mix(
in oklab,
var(--color-white),
var(--color-slate-50)
);
}
:global(.dark) ul > :global(li.selected) {
background-color: color-mix(
in oklab,
var(--color-zinc-900) 90%,
var(--color-zinc-800)
);
}
:global(.dark) ul > :global(li) {
border: 1px solid var(--color-zinc-900);
background-color: color-mix(
in oklab,
var(--color-zinc-925),
var(--color-zinc-900)
);
&:hover {
background-color: var(--color-zinc-900);
}
&:active {
@variant dark {
border: 1px solid var(--color-zinc-900);
background-color: color-mix(
in oklab,
var(--color-zinc-900) 80%,
var(--color-zinc-925)
var(--color-zinc-925),
var(--color-zinc-900)
);
&:hover {
background-color: var(--color-zinc-900);
}
&:active {
background-color: color-mix(
in oklab,
var(--color-zinc-900) 80%,
var(--color-zinc-925)
);
}
}
:global {
&:not(.xs) > * {
padding-block: calc(var(--spacing) * 3);
padding-inline: calc(var(--spacing) * 3.5);
@media screen and (min-width: 40rem) {
padding-block: calc(var(--spacing) * 3);
padding-inline: calc(var(--spacing) * 4);
}
}
&.xs > * {
padding-block: calc(var(--spacing) * 0.5);
padding-block: calc(var(--spacing) * 1);
}
&.selected {
background-color: color-mix(
in oklab,
var(--color-white),
var(--color-slate-50)
);
@variant dark {
background-color: color-mix(
in oklab,
var(--color-zinc-900) 90%,
var(--color-zinc-800)
);
}
}
}
}
+2
View File
@@ -178,6 +178,8 @@
flex-direction: row;
align-items: center;
font-size: var(--text-sm);
user-select: none;
-webkit-user-select: none;
transition: 75ms cubic-bezier(0.075, 0.82, 0.165, 1);
@@ -32,7 +32,7 @@
'dark:hover:text-primary-100 transition-colors z-0 group relative cursor-pointer',
]}
>
<div class="flex flex-row gap-1 items-center w-full">
<div class="flex flex-row gap-1 items-center w-full select-none">
{@render title?.(open)}
</div>
{#if icon}
+15 -8
View File
@@ -1,5 +1,6 @@
<script module lang="ts">
import { Label } from 'mono-svelte'
import { Icon, type IconSource } from 'svelte-hero-icons/dist'
import type { HTMLInputAttributes } from 'svelte/elements'
import { generateID } from './helper'
@@ -28,6 +29,7 @@
shadow?: Shadow
element?: HTMLInputElement | undefined
class?: string
icon?: IconSource
customLabel?: import('svelte').Snippet
prefix?: import('svelte').Snippet
suffix?: import('svelte').Snippet
@@ -41,14 +43,15 @@
const borderClass = `border border-slate-200 border-b-slate-300 dark:border-zinc-800`
let {
label = undefined,
label,
value = $bindable(),
placeholder = '',
disabled = false,
required = false,
size = 'md',
id = generateID(),
inlineAffixes = false,
icon,
inlineAffixes = !!icon,
shadow = 'sm',
element = $bindable(),
class: clazz = '',
@@ -84,15 +87,19 @@
clazz,
]}
>
{#if prefix}
{#if prefix || icon}
<div
class={[
'rounded-xl rounded-r-none text-slate-600 dark:text-zinc-400',
inlineAffixes && 'bg-white dark:bg-zinc-900 pr-0 w-8',
sizeClass[size],
inlineAffixes &&
'bg-white dark:bg-zinc-900 pr-0 px-3 h-full flex items-center',
]}
>
{@render prefix?.()}
{#if prefix}
{@render prefix?.()}
{:else if icon}
<Icon src={icon} size="20" mini />
{/if}
</div>
{/if}
<input
@@ -110,8 +117,8 @@
focus:outline-hidden rounded-xl text-sm w-full disabled:bg-slate-100
disabled:cursor-not-allowed dark:disabled:bg-zinc-800 invalid:border-red-500!
peer invalid:text-red-500 z-10`,
prefix && 'rounded-l-none',
prefix && inlineAffixes && 'border-l-0',
(prefix || icon) && 'rounded-l-none',
(prefix || icon) && inlineAffixes && 'border-l-0',
suffix && 'rounded-r-none',
suffix && inlineAffixes && 'border-r-0',
clazz,
+8 -2
View File
@@ -220,8 +220,8 @@
.material-info {
background: linear-gradient(
to bottom,
--alpha(var(--color-slate-300) / 10%),
--alpha(var(--color-slate-500) / 15%)
--alpha(var(--color-slate-200) / 10%),
--alpha(var(--color-slate-300) / 15%)
);
color: var(--color-slate-900);
@@ -229,6 +229,12 @@
@variant dark {
color: var(--color-slate-300);
background: linear-gradient(
to bottom,
--alpha(var(--color-slate-300) / 10%),
--alpha(var(--color-slate-500) / 15%)
);
}
}
}
+1 -1
View File
@@ -46,7 +46,7 @@
>
{#snippet popover()}
<div
class="w-full max-w-sm max-h-128 overflow-auto list-none shadow-lg rounded-xl"
class="w-full max-w-sm max-h-128 overflow-auto list-none shadow-lg rounded-xl select-none"
>
<div
class="flex flex-col p-1 list-none bg-white/80 dark:bg-zinc-900/90 rounded-xl
+68 -43
View File
@@ -10,20 +10,22 @@
langs?: string[]
tags?: string[]
score: number
recommended?: boolean
}
</script>
<script lang="ts">
import { goto } from '$app/navigation'
import { env } from '$env/dynamic/public'
import { validateInstance } from '$lib/api/client.svelte'
import { t } from '$lib/app/i18n'
import { DEFAULT_INSTANCE_URL } from '$lib/app/instance.svelte'
import VirtualList from '$lib/app/render/VirtualList.svelte'
import Avatar from '$lib/ui/generic/Avatar.svelte'
import { Header } from '$lib/ui/layout'
import { Button, TextInput, toast } from 'mono-svelte'
import { CommonList, Header } from '$lib/ui/layout'
import { Button, Note, TextInput, toast } from 'mono-svelte'
import { onMount } from 'svelte'
import { ArrowLeft, Icon } from 'svelte-hero-icons/dist'
import { ArrowLeft, CheckCircle, Icon } from 'svelte-hero-icons/dist'
import { preventDefault } from 'svelte/legacy'
let selectedInstance: string = $state('')
@@ -34,15 +36,22 @@
onMount(async () => {
try {
const recommended = env.PUBLIC_RECOMMENDED_INSTANCES?.split(',')
const res: Instance[] = (
await fetch(`https://data.lemmyverse.net/data/instance.full.json`).then(
(r) => r.json(),
)
(await fetch(`https://servers.infra.phtn.app?limit=50`).then((r) =>
r.json(),
)) as Instance[]
)
.filter((i: Instance) => i.fed)
.sort((a: Instance, b: Instance) => b.score - a.score)
.slice(0, 100)
recommended?.forEach((rec) => {
const found = res.find((i) => i.baseurl == rec)
if (found) res.unshift({ ...found, recommended: true })
})
instances = res
let placeholderIndex = 0
@@ -72,44 +81,60 @@
</Button>
<Header>{$t('form.signup.title')}</Header>
<p>{$t('form.signup.description')}</p>
<p>
{$t('form.signup.info')}
</p>
<Note>{$t('form.signup.info')}</Note>
{#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"
>
{#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>
<CommonList>
<VirtualList
items={instances}
useWindow={false}
height={384}
estimatedHeight={50}
class="overflow-auto overflow-x-hidden w-full min-w-0 min-h-96"
itemContainer="li"
>
{#snippet item(i)}
{@const instance = instances![i]}
<button
onclick={() => (selectedInstance = instance.baseurl ?? '')}
class={[
'flex flex-row items-center text-left gap-2 w-full cursor-pointer rounded-[inherit]',
instance.recommended && 'material-success',
]}
>
<Avatar
width={32}
url={instance.icon}
alt={instance.name}
class="shrink-0"
/>
<div class="flex flex-col max-h-full w-full">
<div
class="font-medium text-base whitespace-nowrap text-ellipsis flex"
>
<span>
{instance.name}
</span>
<span class="text-slate-500 dark:text-zinc-500 ml-auto">
{instance.baseurl}
</span>
</div>
<p
class="overflow-hidden overflow-ellipsis w-full text-sm text-slate-600 dark:text-zinc-400"
>
{instance.desc}
</p>
{#if instance.recommended}
<p class="text-xs inline-flex items-center gap-1">
<Icon src={CheckCircle} size="14" micro class="inline" />
{$t('form.signup.recommended')}
</p>
{/if}
</div>
</button>
{/snippet}
</VirtualList>
</CommonList>
{/if}
<form
class="flex flex-col gap-4"
+41 -34
View File
@@ -8,9 +8,7 @@
import { errorMessage } from '$lib/app/error'
import { t } from '$lib/app/i18n'
import Markdown from '$lib/app/markdown/Markdown.svelte'
import MarkdownEditor from '$lib/app/markdown/MarkdownEditor.svelte'
import InstanceCard from '$lib/feature/instance/InstanceCard.svelte'
import Avatar from '$lib/ui/generic/Avatar.svelte'
import EntityHeader from '$lib/ui/generic/EntityHeader.svelte'
import ErrorContainer, {
clearErrorScope,
pushError,
@@ -23,14 +21,18 @@
Material,
Spinner,
Switch,
TextArea,
TextInput,
toast,
} from 'mono-svelte'
import {
ArrowLeft,
ArrowPath,
AtSymbol,
Envelope,
ExclamationTriangle,
Icon,
Key,
Plus,
QuestionMarkCircle,
XCircle,
@@ -151,7 +153,7 @@
<title>{$t('account.signup')}</title>
</svelte:head>
<div class="flex flex-col md:flex-row flex-1/3 gap-8 h-full max-w-5xl mx-auto">
<div class="flex flex-col md:flex-row flex-1/2 gap-8 h-full max-w-6xl mx-auto">
{#if stage == 'signup'}
<form
class="flex flex-col gap-4 h-full w-full flex-2/3"
@@ -160,23 +162,22 @@
submit()
}}
>
<Button href="/accounts" class=" mb-4 w-max" rounding="pill">
<Button href="/accounts" class=" mb-4 w-max">
<Icon src={ArrowLeft} size="16" micro />
{$t('common.back')}
</Button>
<Header>
{$t('form.signup.title')}
{#snippet extended()}
<span class="flex gap-4 items-center text-xl text-center mx-auto">
{#if data.site_view.site.icon}
<Avatar
circle={false}
width={48}
url={data.site_view.site.icon}
/>
{/if}
{data.site_view.site.name}
</span>
<div class="md:hidden">
<EntityHeader
name={data.site_view.site.name}
avatar={data.site_view.site.icon}
banner={data.site_view.site.banner || null}
compact="always"
avatarCircle={false}
/>
</div>
{/snippet}
</Header>
<ErrorContainer scope={page.url.pathname} />
@@ -188,35 +189,44 @@
label={$t('form.email')}
required={data.site_view.local_site.require_email_verification}
type="email"
icon={Envelope}
size="md"
/>
<TextInput
bind:value={username}
label={$t('form.username')}
required
icon={AtSymbol}
/>
</div>
<div class="flex flex-col md:flex-row gap-2 *:flex-1">
<div class="flex flex-col md:flex-row *:flex-1 gap-2">
<TextInput
bind:value={password}
label={$t('form.password')}
required
type="password"
icon={Key}
/>
<TextInput
bind:value={passwordVerify}
label={$t('form.confirmPassword')}
required
type="password"
icon={Key}
/>
</div>
{#if data.site_view.local_site.registration_mode == 'RequireApplication'}
<Material rounding="2xl" color="warning" icon={ExclamationTriangle}>
{$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
<Material rounding="2xl" color="info">
{#if data.site_view.local_site.application_question}
<Markdown
source={data.site_view.local_site.application_question}
/>
{/if}
</Material>
<TextArea
label={$t('form.signup.application.label')}
required
bind:value={application}
@@ -318,18 +328,15 @@
</Button>
</div>
{/if}
<Material
color="uniform"
class="flex-1/3 overflow-auto max-h-full max-md:hidden"
rounding="2xl"
padding="none"
>
<InstanceCard
admins={data.admins}
site={data.site_view}
taglines={data.taglines}
version={data.version}
class="w-full p-4"
/>
</Material>
<div class="flex-1/2 flex flex-col gap-2 max-md:hidden">
<div class=" w-full sticky top-0">
<EntityHeader
name={data.site_view.site.name}
avatar={data.site_view.site.icon}
banner={data.site_view.site.banner || null}
avatarCircle={false}
bio={data.site_view.site.sidebar}
/>
</div>
</div>
</div>
-3
View File
@@ -10,9 +10,6 @@
}
let { theme = $bindable() }: Props = $props()
let selected = $derived(theme.id == themeData.data.currentTheme)
let editingName = $state(false)
</script>
<button class="h-full" onclick={() => (themeData.data.currentTheme = theme.id)}>