design: improve settings reachability
This commit is contained in:
13 files changed
+188
-91
No files matched your search
@@ -944,7 +944,7 @@
|
||||
"title": "Account"
|
||||
},
|
||||
"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": {
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
'flex gap-2 p-5',
|
||||
orientation == 'horizontal'
|
||||
? 'flex-row items-center'
|
||||
: 'flex-col items-staRT',
|
||||
: 'flex-col items-start',
|
||||
]}
|
||||
>
|
||||
<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">
|
||||
{title}
|
||||
</h3>
|
||||
<p class="text-sm text-slate-600 dark:text-zinc-400">
|
||||
{detail}
|
||||
</p>
|
||||
{#if detail}
|
||||
<p class="text-sm text-slate-600 dark:text-zinc-400">
|
||||
{detail}
|
||||
</p>
|
||||
{/if}
|
||||
</a>
|
||||
<div class="flex flex-row gap-2 items-center">
|
||||
{@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}
|
||||
@@ -57,7 +57,7 @@
|
||||
<ViewSelect placement="bottom" />
|
||||
|
||||
<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 />
|
||||
</Button>
|
||||
</noscript>
|
||||
|
||||
@@ -13,15 +13,17 @@
|
||||
isUser,
|
||||
} from '$lib/feature/legacy/item'
|
||||
import { PostItem } from '$lib/feature/post'
|
||||
import UserAutocomplete from '$lib/feature/user/UserAutocomplete.svelte'
|
||||
import UserItem from '$lib/feature/user/UserItem.svelte'
|
||||
import ObjectAutocomplete from '$lib/ui/form/ObjectAutocomplete.svelte'
|
||||
import Skeleton from '$lib/ui/generic/Skeleton.svelte'
|
||||
import Placeholder from '$lib/ui/info/Placeholder.svelte'
|
||||
import { CommonList, Header, Pageination, SearchBar } from '$lib/ui/layout'
|
||||
import { Button, Option, Select, TextLoader } from 'mono-svelte'
|
||||
import Menu from 'mono-svelte/popover/Menu.svelte'
|
||||
import {
|
||||
AdjustmentsHorizontal,
|
||||
ChevronDoubleDown,
|
||||
BarsArrowDown,
|
||||
GlobeAmericas,
|
||||
Icon,
|
||||
MagnifyingGlass,
|
||||
@@ -33,8 +35,6 @@
|
||||
|
||||
let searchElement: HTMLInputElement | undefined = $state()
|
||||
let form = $state<HTMLFormElement>()
|
||||
|
||||
let moreOptions = $state(false)
|
||||
</script>
|
||||
|
||||
<svelte:window
|
||||
@@ -81,34 +81,51 @@
|
||||
bind:selected={data.filters.value.sort}
|
||||
onchange={() => form?.requestSubmit()}
|
||||
/>
|
||||
<Button
|
||||
size="custom"
|
||||
rounding="xl"
|
||||
class="self-end justify-self-center h-8.5 w-8.5"
|
||||
onclick={() => (moreOptions = !moreOptions)}
|
||||
aria-label={$t('post.actions.more.label')}
|
||||
>
|
||||
<Icon src={ChevronDoubleDown} size="20" mini />
|
||||
</Button>
|
||||
<Menu placement="bottom">
|
||||
{#snippet target(attachment)}
|
||||
<Button
|
||||
{@attach attachment}
|
||||
aria-label={$t('post.actions.more.label')}
|
||||
icon={BarsArrowDown}
|
||||
size="custom"
|
||||
class="self-end h-8.5 aspect-square"
|
||||
/>
|
||||
{/snippet}
|
||||
{@render extraOptions()}
|
||||
</Menu>
|
||||
</div>
|
||||
</form>
|
||||
{/snippet}
|
||||
</Header>
|
||||
|
||||
{#if moreOptions}
|
||||
<div
|
||||
transition:slide={{ axis: 'y', easing: expoOut, duration: 500 }}
|
||||
class="flex flex-row gap-2 flex-wrap"
|
||||
>
|
||||
{#snippet extraOptions()}
|
||||
<div class="p-2 flex flex-col gap-4" data-autoclose="false">
|
||||
<ObjectAutocomplete
|
||||
label={$t('nav.create.community')}
|
||||
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}
|
||||
onselect={(c) =>
|
||||
searchParam(page.url, 'community', c?.id || undefined, 'page')}
|
||||
searchParam(
|
||||
page.url,
|
||||
'community',
|
||||
c?.community.id || undefined,
|
||||
'page',
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
{/snippet}
|
||||
|
||||
{#if !data.results}
|
||||
{#if navigating.to?.route.id == '/search'}
|
||||
<div class="flex flex-col gap-3 mt-6">
|
||||
|
||||
@@ -8,7 +8,8 @@ import { getItemPublished } from '$lib/feature/legacy/item'
|
||||
export async function load({ url, fetch }) {
|
||||
const query = url.searchParams.get('q')
|
||||
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 type =
|
||||
url.searchParams.get('type') ||
|
||||
@@ -19,7 +20,8 @@ export async function load({ url, fetch }) {
|
||||
if (query) {
|
||||
const results = await client({ func: fetch }).search({
|
||||
q: query,
|
||||
community_id: community ?? undefined,
|
||||
community_id: community,
|
||||
creator_id: creator,
|
||||
limit: 20,
|
||||
page: page,
|
||||
sort: (sort as SortType) || 'TopAll',
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/state'
|
||||
import { t } from '$lib/app/i18n'
|
||||
import { defaultSettings, settings } from '$lib/app/settings.svelte'
|
||||
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 { 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 importing = $state(false)
|
||||
@@ -40,81 +51,90 @@
|
||||
<title>{$t('settings.title')}</title>
|
||||
</svelte:head>
|
||||
|
||||
<Tabs
|
||||
<!--TODO use route ID instead of pathname-->
|
||||
<TabbedLayoutShell
|
||||
baseRoute="/settings"
|
||||
routes={[
|
||||
{
|
||||
href: '/settings/app',
|
||||
name: $t('settings.app.title'),
|
||||
icon: Cog,
|
||||
},
|
||||
{
|
||||
href: '/settings/lemmy',
|
||||
name: $t('settings.lemmy.title'),
|
||||
icon: AtSymbol,
|
||||
},
|
||||
{
|
||||
href: '/settings/embeds',
|
||||
name: $t('settings.embeds.title'),
|
||||
icon: RectangleStack,
|
||||
},
|
||||
{
|
||||
href: '/settings/moderation',
|
||||
name: $t('settings.moderation.title'),
|
||||
icon: ShieldCheck,
|
||||
},
|
||||
{
|
||||
href: '/settings/other',
|
||||
name: $t('settings.other.title'),
|
||||
icon: EllipsisHorizontal,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
<Header pageHeader class="text-3xl font-bold flex justify-between">
|
||||
{$t('settings.title')}
|
||||
{#snippet extended()}
|
||||
<div class="flex items-center tracking-normal gap-2">
|
||||
<Button
|
||||
onclick={() => {
|
||||
importText = ''
|
||||
importing = true
|
||||
}}
|
||||
icon={ArrowDownTray}
|
||||
size="lg"
|
||||
>
|
||||
{$t('settings.import')}
|
||||
</Button>
|
||||
<Button
|
||||
onclick={() => {
|
||||
const json = JSON.stringify(settings)
|
||||
navigator?.clipboard?.writeText?.(json)
|
||||
toast({ content: $t('toast.copied') })
|
||||
}}
|
||||
icon={ArrowUpTray}
|
||||
size="lg"
|
||||
>
|
||||
{$t('settings.export')}
|
||||
</Button>
|
||||
<Button
|
||||
onclick={() => {
|
||||
modal({
|
||||
title: $t('settings.reset'),
|
||||
body: $t('toast.resetSettings'),
|
||||
actions: [
|
||||
action({
|
||||
action: () => Object.assign(settings, defaultSettings),
|
||||
close: true,
|
||||
type: 'danger',
|
||||
content: $t('settings.reset'),
|
||||
}),
|
||||
action({
|
||||
content: $t('common.cancel'),
|
||||
}),
|
||||
],
|
||||
})
|
||||
}}
|
||||
icon={ArrowPath}
|
||||
size="lg"
|
||||
>
|
||||
{$t('settings.reset')}
|
||||
</Button>
|
||||
</div>
|
||||
>
|
||||
{#snippet header()}
|
||||
<Header pageHeader class="text-3xl font-bold flex justify-between">
|
||||
{$t('settings.title')}
|
||||
{#snippet extended()}
|
||||
<div class="flex items-center tracking-normal gap-2">
|
||||
<Button
|
||||
onclick={() => {
|
||||
importText = ''
|
||||
importing = true
|
||||
}}
|
||||
icon={ArrowDownTray}
|
||||
size="lg"
|
||||
>
|
||||
{$t('settings.import')}
|
||||
</Button>
|
||||
<Button
|
||||
onclick={() => {
|
||||
const json = JSON.stringify(settings)
|
||||
navigator?.clipboard?.writeText?.(json)
|
||||
toast({ content: $t('toast.copied') })
|
||||
}}
|
||||
icon={ArrowUpTray}
|
||||
size="lg"
|
||||
>
|
||||
{$t('settings.export')}
|
||||
</Button>
|
||||
<Button
|
||||
onclick={() => {
|
||||
modal({
|
||||
title: $t('settings.reset'),
|
||||
body: $t('toast.resetSettings'),
|
||||
actions: [
|
||||
action({
|
||||
action: () => Object.assign(settings, defaultSettings),
|
||||
close: true,
|
||||
type: 'danger',
|
||||
content: $t('settings.reset'),
|
||||
}),
|
||||
action({
|
||||
content: $t('common.cancel'),
|
||||
}),
|
||||
],
|
||||
})
|
||||
}}
|
||||
icon={ArrowPath}
|
||||
size="lg"
|
||||
>
|
||||
{$t('settings.reset')}
|
||||
</Button>
|
||||
</div>
|
||||
{/snippet}
|
||||
</Header>
|
||||
{/snippet}
|
||||
</Header>
|
||||
|
||||
{@render children?.()}
|
||||
{@render children?.()}
|
||||
</TabbedLayoutShell>
|
||||
Whitespace-only changes.
@@ -1,5 +1,6 @@
|
||||
import { redirect } from '@sveltejs/kit'
|
||||
import { innerWidth } from 'svelte/reactivity/window'
|
||||
|
||||
export function load() {
|
||||
redirect(302, '/settings/app')
|
||||
export function load({ url }) {
|
||||
if ((innerWidth.current ?? 0) > 768) redirect(302, '/settings/app')
|
||||
}
|
||||
@@ -83,7 +83,7 @@
|
||||
mini
|
||||
size="32"
|
||||
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;"
|
||||
/>
|
||||
{/if}
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
size="32"
|
||||
mini
|
||||
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}
|
||||
<Switch
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import Link from '$lib/ui/form/Link.svelte'
|
||||
import Switch from '$lib/ui/form/Switch.svelte'
|
||||
import { CommonList } from '$lib/ui/layout'
|
||||
import { Button, Option, Select, TextArea } from 'mono-svelte'
|
||||
import { Button, Option, Select } from 'mono-svelte'
|
||||
import {
|
||||
ArrowsPointingOut,
|
||||
ArrowsRightLeft,
|
||||
@@ -81,7 +81,7 @@
|
||||
{/snippet}
|
||||
<Button
|
||||
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"
|
||||
target="_blank"
|
||||
rounding="xl"
|
||||
|
||||
@@ -66,8 +66,8 @@
|
||||
}}
|
||||
size="lg"
|
||||
disabled={themeData.current.id <= 0}
|
||||
icon={ArrowDownTray}
|
||||
>
|
||||
<Icon src={ArrowUpTray} size="16" mini />
|
||||
{$t('settings.import')}
|
||||
</Button>
|
||||
<Button
|
||||
@@ -78,8 +78,8 @@
|
||||
toast({ content: 'Copied theme to clipboard.' })
|
||||
}}
|
||||
size="lg"
|
||||
icon={ArrowUpTray}
|
||||
>
|
||||
<Icon src={ArrowDownTray} size="16" mini />
|
||||
{$t('settings.export')}
|
||||
</Button>
|
||||
<Button
|
||||
@@ -110,8 +110,8 @@
|
||||
})
|
||||
}}
|
||||
size="lg"
|
||||
icon={ArrowPath}
|
||||
>
|
||||
<Icon src={ArrowPath} size="16" mini />
|
||||
{$t('settings.reset')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user