From ec7fd813040f0e08a54be52b1b3cd94ed8b8b6cf Mon Sep 17 00:00:00 2001 From: xylight <80978739+Xyphyn@users.noreply.github.com> Date: Mon, 16 Feb 2026 21:03:13 -0800 Subject: [PATCH] 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 --- .github/README.md | 2 + src/lib/app/auth/inbox.svelte.ts | 37 +++--- src/lib/app/i18n/en.json | 8 +- src/lib/app/render/VirtualList.svelte | 7 +- src/lib/ui/generic/EntityHeader.svelte | 2 +- src/lib/ui/layout/CommonList.svelte | 104 ++++++++-------- src/lib/ui/shared/button/Button.svelte | 2 + .../ui/shared/disclosure/Expandable.svelte | 2 +- src/lib/ui/shared/forms/TextInput.svelte | 23 ++-- src/lib/ui/shared/materials/Material.svelte | 10 +- src/lib/ui/shared/popover/Menu.svelte | 2 +- src/routes/signup/+page.svelte | 111 +++++++++++------- src/routes/signup/[instance]/+page.svelte | 75 ++++++------ src/routes/theme/ThemePreset.svelte | 3 - 14 files changed, 222 insertions(+), 166 deletions(-) diff --git a/.github/README.md b/.github/README.md index 1f227cd6..5b754f4a 100644 --- a/.github/README.md +++ b/.github/README.md @@ -101,6 +101,8 @@ If you're hosting Photon for a Lemmy instance, you'll almost definitely want to - `PUBLIC_THEME` `JSON`: If you'd like, you can export a theme from Photon and paste it here, which will become the default theme for users. +- `RECOMMENDED_INSTANCES` `string`: (Only suitable for unlocked Photon instances) a comma separated list of instance domains that will be displayed as "recommended" on the sign-up page. + ##### Default Photon options Photon has extensive user configuration options, and you can set the defaults for them with the environment variables found at `src/lib/settings.ts`, by looking at the `defaultSettings` object. diff --git a/src/lib/app/auth/inbox.svelte.ts b/src/lib/app/auth/inbox.svelte.ts index 9eed0b3c..fe0dfac1 100644 --- a/src/lib/app/auth/inbox.svelte.ts +++ b/src/lib/app/auth/inbox.svelte.ts @@ -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, diff --git a/src/lib/app/i18n/en.json b/src/lib/app/i18n/en.json index 5ef2c16a..2db68d9d 100644 --- a/src/lib/app/i18n/en.json +++ b/src/lib/app/i18n/en.json @@ -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", diff --git a/src/lib/app/render/VirtualList.svelte b/src/lib/app/render/VirtualList.svelte index 6dc78533..a4d91841 100644 --- a/src/lib/app/render/VirtualList.svelte +++ b/src/lib/app/render/VirtualList.svelte @@ -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;" > {#each visibleItems as item (item.index)} -
{@render itemSnippet(item.index)} -
+ {/each} {#if settings.debugInfo} diff --git a/src/lib/ui/generic/EntityHeader.svelte b/src/lib/ui/generic/EntityHeader.svelte index 3e9b980d..bcb5e954 100644 --- a/src/lib/ui/generic/EntityHeader.svelte +++ b/src/lib/ui/generic/EntityHeader.svelte @@ -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 } diff --git a/src/lib/ui/layout/CommonList.svelte b/src/lib/ui/layout/CommonList.svelte index 932e36d8..56ee9711 100644 --- a/src/lib/ui/layout/CommonList.svelte +++ b/src/lib/ui/layout/CommonList.svelte @@ -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) + ); + } + } } } diff --git a/src/lib/ui/shared/button/Button.svelte b/src/lib/ui/shared/button/Button.svelte index 98175e52..654cd168 100644 --- a/src/lib/ui/shared/button/Button.svelte +++ b/src/lib/ui/shared/button/Button.svelte @@ -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); diff --git a/src/lib/ui/shared/disclosure/Expandable.svelte b/src/lib/ui/shared/disclosure/Expandable.svelte index d1d58535..885d1a66 100644 --- a/src/lib/ui/shared/disclosure/Expandable.svelte +++ b/src/lib/ui/shared/disclosure/Expandable.svelte @@ -32,7 +32,7 @@ 'dark:hover:text-primary-100 transition-colors z-0 group relative cursor-pointer', ]} > -
+
{@render title?.(open)}
{#if icon} diff --git a/src/lib/ui/shared/forms/TextInput.svelte b/src/lib/ui/shared/forms/TextInput.svelte index b0c64598..b63913e4 100644 --- a/src/lib/ui/shared/forms/TextInput.svelte +++ b/src/lib/ui/shared/forms/TextInput.svelte @@ -1,5 +1,6 @@