design: improve settings reachability

This commit is contained in:
Xylight committed 2026-02-06 15:46:33 -08:00
1 parent f673f62ce3
commit 17aedff689
13 files changed
+135 -38

No files matched your search

+1 -1
View File
@@ -944,7 +944,7 @@
"title": "Account" "title": "Account"
}, },
"donate": { "donate": {
"description": "Photon will always be free and open-source, and is continously developed and designed to be helpful. If you like Photon and want to finanically support its development, you can donate here." "description": "Photon will always be free and open-source, and is continously developed and designed to be helpful. If you like Photon and want to financially support its development, you can donate here."
} }
}, },
"error": { "error": {
+3 -1
View File
@@ -26,7 +26,7 @@
'flex gap-2 p-5', 'flex gap-2 p-5',
orientation == 'horizontal' orientation == 'horizontal'
? 'flex-row items-center' ? 'flex-row items-center'
: 'flex-col items-staRT', : 'flex-col items-start',
]} ]}
> >
<Avatar url={icon} alt={title} width={detail ? 32 : 24} circle={false} /> <Avatar url={icon} alt={title} width={detail ? 32 : 24} circle={false} />
@@ -34,9 +34,11 @@
<h3 class="font-medium text-base overflow-hidden text-ellipsis leading-5"> <h3 class="font-medium text-base overflow-hidden text-ellipsis leading-5">
{title} {title}
</h3> </h3>
{#if detail}
<p class="text-sm text-slate-600 dark:text-zinc-400"> <p class="text-sm text-slate-600 dark:text-zinc-400">
{detail} {detail}
</p> </p>
{/if}
</a> </a>
<div class="flex flex-row gap-2 items-center"> <div class="flex flex-row gap-2 items-center">
{@render children?.()} {@render children?.()}
@@ -0,0 +1,55 @@
<script lang="ts">
import { page } from '$app/state'
import { type Snippet } from 'svelte'
import { ChevronRight, Icon, type IconSource } from 'svelte-hero-icons/dist'
import CommonList from '../CommonList.svelte'
import Tabs from './Tabs.svelte'
interface Props {
baseRoute: string
routes: { icon?: IconSource; href: string; name: string; detail?: string }[]
header?: Snippet
children?: Snippet
}
let { baseRoute, routes, header, children }: Props = $props()
let onBaseRoute = $derived(page.url.pathname == baseRoute)
</script>
{#if !onBaseRoute}
<Tabs {routes} />
{/if}
{@render header?.()}
{#if onBaseRoute}
<CommonList animate={false} items={routes}>
{#snippet item(route)}
<a class="font-medium flex items-center gap-1" href={route.href}>
{#if route.icon}
<Icon
src={route.icon}
mini
size="32"
class="bg-gray-200/20 dark:bg-gray-600/20 p-1.5 rounded-lg color
text-gray-500 dark:text-gray-300 float-left mr-2 clear-both"
style="grid-area: icon;"
/>
{/if}
<div class="flex-1">
<div>
{route.name}
</div>
{#if route.detail}
<div>
{route.detail}
</div>
{/if}
</div>
<Icon src={ChevronRight} size="20" class />
</a>
{/snippet}
</CommonList>
{:else}
{@render children?.()}
{/if}
+1 -1
View File
@@ -57,7 +57,7 @@
<ViewSelect placement="bottom" /> <ViewSelect placement="bottom" />
<noscript> <noscript>
<Button class="self-end h-[34px] aspect-square" size="custom" submit> <Button class="self-end h-8.5 aspect-square" size="custom" submit>
<Icon src={ArrowRight} size="16" micro /> <Icon src={ArrowRight} size="16" micro />
</Button> </Button>
</noscript> </noscript>
+34 -17
View File
@@ -13,15 +13,17 @@
isUser, isUser,
} from '$lib/feature/legacy/item' } from '$lib/feature/legacy/item'
import { PostItem } from '$lib/feature/post' import { PostItem } from '$lib/feature/post'
import UserAutocomplete from '$lib/feature/user/UserAutocomplete.svelte'
import UserItem from '$lib/feature/user/UserItem.svelte' import UserItem from '$lib/feature/user/UserItem.svelte'
import ObjectAutocomplete from '$lib/ui/form/ObjectAutocomplete.svelte' import ObjectAutocomplete from '$lib/ui/form/ObjectAutocomplete.svelte'
import Skeleton from '$lib/ui/generic/Skeleton.svelte' import Skeleton from '$lib/ui/generic/Skeleton.svelte'
import Placeholder from '$lib/ui/info/Placeholder.svelte' import Placeholder from '$lib/ui/info/Placeholder.svelte'
import { CommonList, Header, Pageination, SearchBar } from '$lib/ui/layout' import { CommonList, Header, Pageination, SearchBar } from '$lib/ui/layout'
import { Button, Option, Select, TextLoader } from 'mono-svelte' import { Button, Option, Select, TextLoader } from 'mono-svelte'
import Menu from 'mono-svelte/popover/Menu.svelte'
import { import {
AdjustmentsHorizontal, AdjustmentsHorizontal,
ChevronDoubleDown, BarsArrowDown,
GlobeAmericas, GlobeAmericas,
Icon, Icon,
MagnifyingGlass, MagnifyingGlass,
@@ -33,8 +35,6 @@
let searchElement: HTMLInputElement | undefined = $state() let searchElement: HTMLInputElement | undefined = $state()
let form = $state<HTMLFormElement>() let form = $state<HTMLFormElement>()
let moreOptions = $state(false)
</script> </script>
<svelte:window <svelte:window
@@ -81,34 +81,51 @@
bind:selected={data.filters.value.sort} bind:selected={data.filters.value.sort}
onchange={() => form?.requestSubmit()} onchange={() => form?.requestSubmit()}
/> />
<Menu placement="bottom">
{#snippet target(attachment)}
<Button <Button
size="custom" {@attach attachment}
rounding="xl"
class="self-end justify-self-center h-8.5 w-8.5"
onclick={() => (moreOptions = !moreOptions)}
aria-label={$t('post.actions.more.label')} aria-label={$t('post.actions.more.label')}
> icon={BarsArrowDown}
<Icon src={ChevronDoubleDown} size="20" mini /> size="custom"
</Button> class="self-end h-8.5 aspect-square"
/>
{/snippet}
{@render extraOptions()}
</Menu>
</div> </div>
</form> </form>
{/snippet} {/snippet}
</Header> </Header>
{#if moreOptions} {#snippet extraOptions()}
<div <div class="p-2 flex flex-col gap-4" data-autoclose="false">
transition:slide={{ axis: 'y', easing: expoOut, duration: 500 }}
class="flex flex-row gap-2 flex-wrap"
>
<ObjectAutocomplete <ObjectAutocomplete
label={$t('nav.create.community')} label={$t('nav.create.community')}
listing_type="All" listing_type="All"
onselect={(c) =>
searchParam(
page.url,
'community',
c?.community.id || undefined,
'page',
)}
/>
<UserAutocomplete
label={$t('post.actions.more.creator')}
listing_type="All"
showWhenEmpty={true} showWhenEmpty={true}
onselect={(c) => onselect={(c) =>
searchParam(page.url, 'community', c?.id || undefined, 'page')} searchParam(
page.url,
'community',
c?.community.id || undefined,
'page',
)}
/> />
</div> </div>
{/if} {/snippet}
{#if !data.results} {#if !data.results}
{#if navigating.to?.route.id == '/search'} {#if navigating.to?.route.id == '/search'}
<div class="flex flex-col gap-3 mt-6"> <div class="flex flex-col gap-3 mt-6">
+4 -2
View File
@@ -8,7 +8,8 @@ import { getItemPublished } from '$lib/feature/legacy/item'
export async function load({ url, fetch }) { export async function load({ url, fetch }) {
const query = url.searchParams.get('q') const query = url.searchParams.get('q')
const page = Number(url.searchParams.get('page')) || 1 const page = Number(url.searchParams.get('page')) || 1
const community = Number(url.searchParams.get('community')) || undefined const community = Number(url.searchParams.get('community'))
const creator = Number(url.searchParams.get('creator'))
const sort = url.searchParams.get('sort') || 'New' const sort = url.searchParams.get('sort') || 'New'
const type = const type =
url.searchParams.get('type') || url.searchParams.get('type') ||
@@ -19,7 +20,8 @@ export async function load({ url, fetch }) {
if (query) { if (query) {
const results = await client({ func: fetch }).search({ const results = await client({ func: fetch }).search({
q: query, q: query,
community_id: community ?? undefined, community_id: community,
creator_id: creator,
limit: 20, limit: 20,
page: page, page: page,
sort: (sort as SortType) || 'TopAll', sort: (sort as SortType) || 'TopAll',
+27 -7
View File
@@ -1,9 +1,20 @@
<script lang="ts"> <script lang="ts">
import { page } from '$app/state'
import { t } from '$lib/app/i18n' import { t } from '$lib/app/i18n'
import { defaultSettings, settings } from '$lib/app/settings.svelte' import { defaultSettings, settings } from '$lib/app/settings.svelte'
import { Header, Tabs } from '$lib/ui/layout' import { Header, Tabs } from '$lib/ui/layout'
import TabbedLayoutShell from '$lib/ui/layout/pages/TabbedLayoutShell.svelte'
import { action, Button, Modal, modal, TextArea, toast } from 'mono-svelte' import { action, Button, Modal, modal, TextArea, toast } from 'mono-svelte'
import { ArrowDownTray, ArrowPath, ArrowUpTray } from 'svelte-hero-icons/dist' import {
ArrowDownTray,
ArrowPath,
ArrowUpTray,
AtSymbol,
Cog,
EllipsisHorizontal,
RectangleStack,
ShieldCheck,
} from 'svelte-hero-icons/dist'
let { children } = $props() let { children } = $props()
let importing = $state(false) let importing = $state(false)
@@ -40,32 +51,39 @@
<title>{$t('settings.title')}</title> <title>{$t('settings.title')}</title>
</svelte:head> </svelte:head>
<Tabs <!--TODO use route ID instead of pathname-->
<TabbedLayoutShell
baseRoute="/settings"
routes={[ routes={[
{ {
href: '/settings/app', href: '/settings/app',
name: $t('settings.app.title'), name: $t('settings.app.title'),
icon: Cog,
}, },
{ {
href: '/settings/lemmy', href: '/settings/lemmy',
name: $t('settings.lemmy.title'), name: $t('settings.lemmy.title'),
icon: AtSymbol,
}, },
{ {
href: '/settings/embeds', href: '/settings/embeds',
name: $t('settings.embeds.title'), name: $t('settings.embeds.title'),
icon: RectangleStack,
}, },
{ {
href: '/settings/moderation', href: '/settings/moderation',
name: $t('settings.moderation.title'), name: $t('settings.moderation.title'),
icon: ShieldCheck,
}, },
{ {
href: '/settings/other', href: '/settings/other',
name: $t('settings.other.title'), name: $t('settings.other.title'),
icon: EllipsisHorizontal,
}, },
]} ]}
/> >
{#snippet header()}
<Header pageHeader class="text-3xl font-bold flex justify-between"> <Header pageHeader class="text-3xl font-bold flex justify-between">
{$t('settings.title')} {$t('settings.title')}
{#snippet extended()} {#snippet extended()}
<div class="flex items-center tracking-normal gap-2"> <div class="flex items-center tracking-normal gap-2">
@@ -115,6 +133,8 @@
</Button> </Button>
</div> </div>
{/snippet} {/snippet}
</Header> </Header>
{/snippet}
{@render children?.()} {@render children?.()}
</TabbedLayoutShell>
View File
Whitespace-only changes.
+3 -2
View File
@@ -1,5 +1,6 @@
import { redirect } from '@sveltejs/kit' import { redirect } from '@sveltejs/kit'
import { innerWidth } from 'svelte/reactivity/window'
export function load() { export function load({ url }) {
redirect(302, '/settings/app') if ((innerWidth.current ?? 0) > 768) redirect(302, '/settings/app')
} }
+1 -1
View File
@@ -83,7 +83,7 @@
mini mini
size="32" size="32"
class="bg-red-200/20 dark:bg-red-600/20 p-1.5 rounded-lg color class="bg-red-200/20 dark:bg-red-600/20 p-1.5 rounded-lg color
text-red-500 dark:text-red-300 float-left mr-2 clear-both" text-red-300 dark:text-red-300 float-left mr-2 clear-both"
style="grid-area: icon;" style="grid-area: icon;"
/> />
{/if} {/if}
+1 -1
View File
@@ -79,7 +79,7 @@
size="32" size="32"
mini mini
class="bg-red-200/20 dark:bg-red-600/20 p-1.5 self-center class="bg-red-200/20 dark:bg-red-600/20 p-1.5 self-center
rounded-lg color text-red-500 dark:text-red-300" rounded-lg color text-red-300 dark:text-red-300"
/> />
{/if} {/if}
<Switch <Switch
+2 -2
View File
@@ -7,7 +7,7 @@
import Link from '$lib/ui/form/Link.svelte' import Link from '$lib/ui/form/Link.svelte'
import Switch from '$lib/ui/form/Switch.svelte' import Switch from '$lib/ui/form/Switch.svelte'
import { CommonList } from '$lib/ui/layout' import { CommonList } from '$lib/ui/layout'
import { Button, Option, Select, TextArea } from 'mono-svelte' import { Button, Option, Select } from 'mono-svelte'
import { import {
ArrowsPointingOut, ArrowsPointingOut,
ArrowsRightLeft, ArrowsRightLeft,
@@ -81,7 +81,7 @@
{/snippet} {/snippet}
<Button <Button
color="none" color="none"
class="bg-gradient-to-r ml-6 dark:from-pink-400 dark:to-fuchsia-400 from-pink-600 to-red-600 text-white dark:text-black" class="bg-linear-to-r ml-6 dark:from-pink-400 dark:to-fuchsia-400 from-pink-600 to-red-600 text-white dark:text-black"
href="https://buymeacoffee.com/xylight" href="https://buymeacoffee.com/xylight"
target="_blank" target="_blank"
rounding="xl" rounding="xl"
+3 -3
View File
@@ -66,8 +66,8 @@
}} }}
size="lg" size="lg"
disabled={themeData.current.id <= 0} disabled={themeData.current.id <= 0}
icon={ArrowDownTray}
> >
<Icon src={ArrowUpTray} size="16" mini />
{$t('settings.import')} {$t('settings.import')}
</Button> </Button>
<Button <Button
@@ -78,8 +78,8 @@
toast({ content: 'Copied theme to clipboard.' }) toast({ content: 'Copied theme to clipboard.' })
}} }}
size="lg" size="lg"
icon={ArrowUpTray}
> >
<Icon src={ArrowDownTray} size="16" mini />
{$t('settings.export')} {$t('settings.export')}
</Button> </Button>
<Button <Button
@@ -110,8 +110,8 @@
}) })
}} }}
size="lg" size="lg"
icon={ArrowPath}
> >
<Icon src={ArrowPath} size="16" mini />
{$t('settings.reset')} {$t('settings.reset')}
</Button> </Button>
</div> </div>