Merge pull request #641 from Xyphyn/aria-impr
a11y: improve accessibility for screen readers and generally
This commit is contained in:
46 files changed
+622
-497
No files matched your search
Vendored
+2
-1
@@ -2,5 +2,6 @@
|
||||
"i18n-ally.localesPaths": [
|
||||
"src/lib/i18n",
|
||||
"src/routes/inbox/messages"
|
||||
]
|
||||
],
|
||||
"i18n-ally.keystyle": "nested"
|
||||
}
|
||||
@@ -66,8 +66,9 @@
|
||||
<CommentModerationMenu bind:item={comment} />
|
||||
{/if}
|
||||
<Menu placement="bottom">
|
||||
{#snippet target()}
|
||||
{#snippet target(attachment)}
|
||||
<Button
|
||||
{@attach attachment}
|
||||
title={$t('comment.actions.label')}
|
||||
color="tertiary"
|
||||
rounding="pill"
|
||||
|
||||
@@ -270,8 +270,8 @@
|
||||
</Button>
|
||||
{/if}
|
||||
<Menu placement="top-end">
|
||||
{#snippet target()}
|
||||
<Button size="square-md" rounding="pill">
|
||||
{#snippet target(attachment)}
|
||||
<Button {@attach attachment} size="square-md" rounding="pill">
|
||||
{#snippet prefix()}
|
||||
<Icon src={EllipsisHorizontal} size="16" mini />
|
||||
{/snippet}
|
||||
|
||||
@@ -193,8 +193,8 @@
|
||||
{#if site.data}
|
||||
<div class="flex gap-2 flex-wrap flex-row">
|
||||
<Menu class="gap-px">
|
||||
{#snippet target()}
|
||||
<button type="button">
|
||||
{#snippet target(attachment)}
|
||||
<button {@attach attachment} type="button">
|
||||
<Badge color="blue-subtle">
|
||||
<Icon src={Plus} micro size="14" />
|
||||
{$t('common.add')}
|
||||
|
||||
@@ -170,8 +170,8 @@
|
||||
</Button>
|
||||
{/if}
|
||||
<Menu placement="top-end">
|
||||
{#snippet target()}
|
||||
<Button size="custom" rounding="pill" class="h-8.5 aspect-square">
|
||||
{#snippet target(attachment)}
|
||||
<Button {@attach attachment} size="custom" rounding="pill" class="h-8.5 aspect-square">
|
||||
{#snippet prefix()}
|
||||
<Icon src={EllipsisHorizontal} size="16" mini />
|
||||
{/snippet}
|
||||
|
||||
@@ -5,10 +5,13 @@
|
||||
import LabelStat from '$lib/components/ui/LabelStat.svelte'
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { client } from '$lib/lemmy.svelte'
|
||||
import { addSubscription } from '$lib/lemmy/user.js'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { fullCommunityName, isSubscribed } from '$lib/util.svelte.js'
|
||||
import type { CommunityView } from 'lemmy-js-client'
|
||||
import { Button, Modal } from 'mono-svelte'
|
||||
import { Button, modal } from 'mono-svelte'
|
||||
import type { Snippet } from 'svelte'
|
||||
import {
|
||||
Check,
|
||||
ExclamationTriangle,
|
||||
@@ -20,11 +23,7 @@
|
||||
Trash,
|
||||
} from 'svelte-hero-icons'
|
||||
import Subscribe from '../../../../routes/communities/Subscribe.svelte'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import type { Snippet } from 'svelte'
|
||||
import { client } from '$lib/lemmy.svelte'
|
||||
|
||||
let showInfo = $state(false)
|
||||
interface Props {
|
||||
community: CommunityView
|
||||
view?: 'cozy' | 'compact'
|
||||
@@ -46,11 +45,9 @@
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
{#if showInfo}
|
||||
<Modal title={$t('form.post.community')} bind:open={showInfo}>
|
||||
<CommunityCard community_view={community} />
|
||||
</Modal>
|
||||
{/if}
|
||||
{#snippet communityInfo()}
|
||||
<CommunityCard community_view={community} />
|
||||
{/snippet}
|
||||
|
||||
<div class={clazz}>
|
||||
<div
|
||||
@@ -154,7 +151,8 @@
|
||||
size="square-md"
|
||||
rounding="pill"
|
||||
color="ghost"
|
||||
onclick={() => (showInfo = !showInfo)}
|
||||
onclick={() =>
|
||||
modal({ title: $t('form.post.community'), snippet: communityInfo })}
|
||||
>
|
||||
<Icon src={InformationCircle} size="16" mini />
|
||||
</Button>
|
||||
|
||||
@@ -88,53 +88,50 @@
|
||||
</Option>
|
||||
</Select>
|
||||
{#if selected?.startsWith('Top')}
|
||||
<div transition:fly={{ easing: backOut, x: 2 }}>
|
||||
<Select
|
||||
class="border-l-0 rounded-l-none"
|
||||
bind:value={selected}
|
||||
onchange={() => {
|
||||
sort = 'TopAll'
|
||||
if (navigate)
|
||||
searchParam(page.url, 'sort', selected, 'page', 'cursor')
|
||||
}}
|
||||
>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={Clock} size="15" micro />
|
||||
{$t('filter.sort.top.time.label')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<Option value="TopAll" icon={PlusCircle}>
|
||||
{$t('filter.sort.top.time.all')}
|
||||
</Option>
|
||||
<Option value="TopNineMonths" icon={Calendar}>
|
||||
{$t('filter.sort.top.time.9months')}
|
||||
</Option>
|
||||
<Option value="TopSixMonths" icon={Calendar}>
|
||||
{$t('filter.sort.top.time.6months')}
|
||||
</Option>
|
||||
<Option value="TopThreeMonths" icon={Calendar}>
|
||||
{$t('filter.sort.top.time.3months')}
|
||||
</Option>
|
||||
<Option value="TopMonth" icon={CalendarDays}>
|
||||
{$t('filter.sort.top.time.month')}
|
||||
</Option>
|
||||
<Option value="TopWeek" icon={CalendarDays}>
|
||||
{$t('filter.sort.top.time.week')}
|
||||
</Option>
|
||||
<Option value="TopDay" icon={Sun}>
|
||||
{$t('filter.sort.top.time.day')}
|
||||
</Option>
|
||||
<Option value="TopTwelveHour" icon={Clock}>
|
||||
{$t('filter.sort.top.time.12hours')}
|
||||
</Option>
|
||||
<Option value="TopSixHour" icon={Clock}>
|
||||
{$t('filter.sort.top.time.6hours')}
|
||||
</Option>
|
||||
<Option value="TopHour" icon={Clock}>
|
||||
{$t('filter.sort.top.time.hour')}
|
||||
</Option>
|
||||
</Select>
|
||||
</div>
|
||||
<Select
|
||||
class="border-l-0 rounded-l-none"
|
||||
bind:value={selected}
|
||||
onchange={() => {
|
||||
sort = 'TopAll'
|
||||
if (navigate) searchParam(page.url, 'sort', selected, 'page', 'cursor')
|
||||
}}
|
||||
>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={Clock} size="15" micro />
|
||||
{$t('filter.sort.top.time.label')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<Option value="TopAll" icon={PlusCircle}>
|
||||
{$t('filter.sort.top.time.all')}
|
||||
</Option>
|
||||
<Option value="TopNineMonths" icon={Calendar}>
|
||||
{$t('filter.sort.top.time.9months')}
|
||||
</Option>
|
||||
<Option value="TopSixMonths" icon={Calendar}>
|
||||
{$t('filter.sort.top.time.6months')}
|
||||
</Option>
|
||||
<Option value="TopThreeMonths" icon={Calendar}>
|
||||
{$t('filter.sort.top.time.3months')}
|
||||
</Option>
|
||||
<Option value="TopMonth" icon={CalendarDays}>
|
||||
{$t('filter.sort.top.time.month')}
|
||||
</Option>
|
||||
<Option value="TopWeek" icon={CalendarDays}>
|
||||
{$t('filter.sort.top.time.week')}
|
||||
</Option>
|
||||
<Option value="TopDay" icon={Sun}>
|
||||
{$t('filter.sort.top.time.day')}
|
||||
</Option>
|
||||
<Option value="TopTwelveHour" icon={Clock}>
|
||||
{$t('filter.sort.top.time.12hours')}
|
||||
</Option>
|
||||
<Option value="TopSixHour" icon={Clock}>
|
||||
{$t('filter.sort.top.time.6hours')}
|
||||
</Option>
|
||||
<Option value="TopHour" icon={Clock}>
|
||||
{$t('filter.sort.top.time.hour')}
|
||||
</Option>
|
||||
</Select>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -3,9 +3,10 @@
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { Select } from 'mono-svelte'
|
||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||
import type { SelectProps } from 'mono-svelte/forms/select/Select.svelte'
|
||||
import { Bars3, Icon, RectangleGroup, ViewColumns } from 'svelte-hero-icons'
|
||||
|
||||
interface Props {
|
||||
interface Props extends SelectProps<string> {
|
||||
showLabel?: boolean
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,9 @@
|
||||
</script>
|
||||
|
||||
<Menu placement="bottom" class="top-0 h-[26px] w-[26px] ">
|
||||
{#snippet target()}
|
||||
{#snippet target(attachment)}
|
||||
<Button
|
||||
{@attach attachment}
|
||||
class="w-[26px] h-[26px] hover:text-green-500! dark:text-zinc-400 text-slate-600"
|
||||
size="square-md"
|
||||
color="tertiary"
|
||||
|
||||
@@ -19,10 +19,11 @@
|
||||
Trash,
|
||||
} from 'svelte-hero-icons'
|
||||
import { amMod, ban, isAdmin, remove, viewVotes } from './moderation'
|
||||
import type { Attachment } from 'svelte/attachments'
|
||||
|
||||
interface Props {
|
||||
item: PostView | CommentView
|
||||
target: Snippet<[boolean]>
|
||||
target: Snippet<[Attachment, boolean]>
|
||||
}
|
||||
|
||||
let { item = $bindable(), target: passedTarget }: Props = $props()
|
||||
@@ -75,8 +76,8 @@
|
||||
</script>
|
||||
|
||||
<Menu placement="bottom-end">
|
||||
{#snippet target()}
|
||||
{@render passedTarget(acting)}
|
||||
{#snippet target(attachment)}
|
||||
{@render passedTarget(attachment, acting)}
|
||||
{/snippet}
|
||||
{#if (profile.current?.user && amMod(profile.current.user, item.community)) || (profile.current?.user && isAdmin(profile.current.user))}
|
||||
<MenuDivider showLabel>
|
||||
|
||||
@@ -144,8 +144,9 @@
|
||||
>
|
||||
{#if showCommunity && community}
|
||||
<Popover>
|
||||
{#snippet target()}
|
||||
{#snippet target(attachment)}
|
||||
<button
|
||||
{@attach attachment}
|
||||
class={[
|
||||
'row-span-2 shrink-0 mr-2 self-center group/btn',
|
||||
'bg-slate-200 dark:bg-zinc-800 rounded-lg cursor-pointer',
|
||||
@@ -177,6 +178,7 @@
|
||||
rounding="2xl"
|
||||
elevation="high"
|
||||
class="max-w-2xl w-full max-h-128 overflow-auto"
|
||||
data-autoclose="false"
|
||||
>
|
||||
{#await import('../community/CommunityHeader.svelte') then { default: CommunityHeader }}
|
||||
<CommunityHeader {community} {subscribed} />
|
||||
|
||||
@@ -134,8 +134,9 @@
|
||||
{#if profile.current?.user && (amMod(profile.current.user, post.community) || isAdmin(profile.current.user))}
|
||||
{#await import('$lib/components/lemmy/moderation/ModerationMenu.svelte') then { default: ModerationMenu }}
|
||||
<ModerationMenu bind:item={post}>
|
||||
{#snippet target(acting)}
|
||||
{#snippet target(attachment, acting)}
|
||||
<Button
|
||||
{@attach attachment}
|
||||
size="custom"
|
||||
color="secondary"
|
||||
rounding="pill"
|
||||
@@ -172,8 +173,9 @@
|
||||
{/if}
|
||||
|
||||
<Menu placement="bottom-end">
|
||||
{#snippet target()}
|
||||
{#snippet target(popover)}
|
||||
<Button
|
||||
{@attach popover}
|
||||
title={$t('post.actions.more.label')}
|
||||
color="secondary"
|
||||
rounding="pill"
|
||||
|
||||
@@ -82,45 +82,40 @@
|
||||
{/snippet}
|
||||
{$t('post.actions.more.share')}
|
||||
</MenuButton>
|
||||
<!--svelte-ignore a11y_no_static_element_interactions -->
|
||||
<!--svelte-ignore a11y_click_events_have_key_events-->
|
||||
{#if !post.post.local}
|
||||
<div
|
||||
class="aspect-square w-max m-1 grid place-items-center"
|
||||
onclick={e => e.stopPropagation()}
|
||||
>
|
||||
<Menu>
|
||||
{#snippet target()}
|
||||
<Button
|
||||
aria-label={$t('post.actions.more.label')}
|
||||
color="tertiary"
|
||||
size="custom"
|
||||
class="w-full h-full"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon
|
||||
src={EllipsisHorizontal}
|
||||
size="16"
|
||||
micro
|
||||
class="text-slate-600 dark:text-zinc-400"
|
||||
/>
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Menu>
|
||||
{#snippet target(attachment)}
|
||||
<Button
|
||||
{@attach attachment}
|
||||
aria-label={$t('post.actions.more.label')}
|
||||
color="tertiary"
|
||||
size="custom"
|
||||
class="w-6 h-6 self-center"
|
||||
data-autoclose="false"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon
|
||||
src={EllipsisHorizontal}
|
||||
size="16"
|
||||
micro
|
||||
class="text-slate-600 dark:text-zinc-400"
|
||||
/>
|
||||
{/snippet}
|
||||
</Button>
|
||||
{/snippet}
|
||||
<MenuButton onclick={() => share(true)}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={GlobeAlt} size="16" micro />
|
||||
{/snippet}
|
||||
<MenuButton onclick={() => share(true)}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={GlobeAlt} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('filter.location.global')}
|
||||
</MenuButton>
|
||||
<MenuButton onclick={() => share(false)}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={MapPin} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('filter.location.local')}
|
||||
</MenuButton>
|
||||
</Menu>
|
||||
</div>
|
||||
{$t('filter.location.global')}
|
||||
</MenuButton>
|
||||
<MenuButton onclick={() => share(false)}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={MapPin} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('filter.location.local')}
|
||||
</MenuButton>
|
||||
</Menu>
|
||||
{/if}
|
||||
</div>
|
||||
{#if profile.current?.jwt}
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
'transition-transform duration-300 ease-out',
|
||||
]}
|
||||
>
|
||||
<Icon src={open ? Minus : Plus} size="16" micro class={[]} />
|
||||
<Icon src={open ? Minus : Plus} size="15" micro class={[]} />
|
||||
</div>
|
||||
{/if}
|
||||
<div
|
||||
|
||||
@@ -10,23 +10,21 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { page } from '$app/state'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { Button, Material, toast } from 'mono-svelte'
|
||||
import { focusTrap } from 'svelte-focus-trap'
|
||||
import { Icon, Share, XMark } from 'svelte-hero-icons'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { fade, scale } from 'svelte/transition'
|
||||
import { focusTrap } from 'svelte-focus-trap'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
|
||||
interface Props {
|
||||
/**
|
||||
* The full-resolution image URL
|
||||
*/
|
||||
alt?: string
|
||||
class?: string
|
||||
children?: import('svelte').Snippet
|
||||
}
|
||||
|
||||
let { alt = '', class: clazz = '', children }: Props = $props()
|
||||
let { alt = '' }: Props = $props()
|
||||
</script>
|
||||
|
||||
{#if page.state.openImage || '' != ''}
|
||||
@@ -88,7 +86,3 @@
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<button onclick={() => history.back()} class="contents {clazz}">
|
||||
{@render children?.()}
|
||||
</button>
|
||||
@@ -32,7 +32,7 @@
|
||||
pageHeader &&
|
||||
`w-[calc(100%+1.5rem)] sm:w-[calc(100%+3rem)]
|
||||
bg-slate-100 dark:bg-zinc-950 -mx-3 sm:-mx-6 sm:px-6 sm:pb-6 px-4 pb-4 -mt-64 pt-64
|
||||
border-b border-slate-200 dark:border-zinc-900 margin z-0`,
|
||||
border-b border-slate-200 dark:border-zinc-900 margin z-0 mb-3 sm:mb-6`,
|
||||
]}
|
||||
{style}
|
||||
aria-label={$t('aria.element.pageHeader')}
|
||||
|
||||
@@ -23,22 +23,47 @@
|
||||
style = 'header',
|
||||
}: Props = $props()
|
||||
|
||||
function isSelected(url: URL, href?: SvelteURL) {
|
||||
if (href?.search != '') return href?.search == url.search
|
||||
else if (url.search == '') return href?.pathname == url.pathname
|
||||
let matchType = $derived<('search' | 'pathname')[]>(
|
||||
routes.map(i =>
|
||||
new URL(`https://example.com${i.href}`)?.search != ''
|
||||
? 'search'
|
||||
: 'pathname',
|
||||
),
|
||||
)
|
||||
|
||||
// i am on 2 hours of sleep i apologize
|
||||
function isSelected(url: URL, href: SvelteURL, type: 'search' | 'pathname') {
|
||||
const currentSearch = new Set(url.searchParams.values())
|
||||
const hrefSearch = new Set(href.searchParams.values())
|
||||
// checks if there is any
|
||||
const usePathname = !routes.some(
|
||||
i =>
|
||||
new Set(
|
||||
new URL(`https://example.com${i.href}`).searchParams.values(),
|
||||
).intersection(currentSearch).size > 0,
|
||||
)
|
||||
|
||||
const hasSearchParam = hrefSearch.intersection(currentSearch).size > 0
|
||||
|
||||
if (hasSearchParam && !usePathname) return hasSearchParam
|
||||
else if ((url.search == '' || usePathname) && type == 'pathname')
|
||||
return href.pathname == url.pathname
|
||||
}
|
||||
</script>
|
||||
|
||||
<nav
|
||||
class={[
|
||||
'flex flex-row items-center justify-center sm:justify-start my-2 sm:mt-0 flex-wrap z-20',
|
||||
style == 'header' ? 'p-1 gap-x-8 gap-y-4' : 'gap-2',
|
||||
'flex flex-row items-center my-2 sm:mt-0 flex-wrap z-20',
|
||||
style == 'header'
|
||||
? 'p-1 gap-x-8 gap-y-4 justify-center sm:justify-start'
|
||||
: 'gap-2',
|
||||
]}
|
||||
>
|
||||
{#each routes as route (route.href)}
|
||||
{#each routes as route, index (route.href)}
|
||||
{@const selected = isSelected(
|
||||
page.url,
|
||||
new SvelteURL(`${page.url.origin}${route.href}`),
|
||||
matchType[index],
|
||||
)}
|
||||
{#if style == 'header'}
|
||||
<a
|
||||
@@ -61,3 +86,7 @@
|
||||
{/each}
|
||||
{@render children?.()}
|
||||
</nav>
|
||||
|
||||
{#if style == 'subpage'}
|
||||
<div class="h-3"></div>
|
||||
{/if}
|
||||
@@ -105,8 +105,9 @@
|
||||
href="/create"
|
||||
/>
|
||||
<Menu placement="bottom">
|
||||
{#snippet target()}
|
||||
{#snippet target(attachment)}
|
||||
<button
|
||||
{@attach attachment}
|
||||
class="w-10 h-10 rounded-full border-slate-200 dark:border-zinc-700
|
||||
transition-all bg-slate-50 dark:bg-zinc-900 relative
|
||||
hover:bg-slate-200 dark:hover:bg-zinc-700 group cursor-pointer"
|
||||
@@ -141,7 +142,7 @@
|
||||
<Spinner width={20} />
|
||||
</div>
|
||||
{:then { default: Profile }}
|
||||
<Profile />
|
||||
<Profile />
|
||||
{/await}
|
||||
{/if}
|
||||
{/snippet}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
MenuButton,
|
||||
MenuDivider,
|
||||
modal,
|
||||
Modal,
|
||||
Option,
|
||||
Select,
|
||||
Spinner,
|
||||
@@ -41,8 +40,6 @@
|
||||
UserCircle,
|
||||
UserGroup,
|
||||
} from 'svelte-hero-icons'
|
||||
|
||||
let showInstance = $state(false)
|
||||
</script>
|
||||
|
||||
{#snippet siteSnippet()}
|
||||
@@ -136,33 +133,31 @@
|
||||
{/snippet}
|
||||
{$t('nav.menu.settings')}
|
||||
</MenuButton>
|
||||
<!--svelte-ignore a11y_click_events_have_key_events-->
|
||||
<!--svelte-ignore a11y_no_static_element_interactions-->
|
||||
<div onclick={e => e.stopPropagation()}>
|
||||
<Select bind:value={theme.colorScheme} size="sm">
|
||||
{#snippet target()}
|
||||
<MenuButton
|
||||
icon={theme.colorScheme == 'system'
|
||||
? ComputerDesktop
|
||||
: theme.colorScheme == 'light'
|
||||
? Sun
|
||||
: Moon}
|
||||
class=" w-full"
|
||||
>
|
||||
{$t('nav.menu.colorscheme.label')}
|
||||
</MenuButton>
|
||||
<Option value="system" class="hidden" icon={ComputerDesktop}>
|
||||
{$t('nav.menu.colorscheme.system')}
|
||||
</Option>
|
||||
<Option value="light" class="hidden" icon={Sun}>
|
||||
{$t('nav.menu.colorscheme.light')}
|
||||
</Option>
|
||||
<Option value="dark" class="hidden" icon={Moon}>
|
||||
{$t('nav.menu.colorscheme.dark')}
|
||||
</Option>
|
||||
{/snippet}
|
||||
</Select>
|
||||
</div>
|
||||
<Select bind:value={theme.colorScheme} size="sm" placement="left">
|
||||
{#snippet target(attachment)}
|
||||
<MenuButton
|
||||
{@attach attachment}
|
||||
icon={theme.colorScheme == 'system'
|
||||
? ComputerDesktop
|
||||
: theme.colorScheme == 'light'
|
||||
? Sun
|
||||
: Moon}
|
||||
class=" w-full"
|
||||
nest
|
||||
>
|
||||
{$t('nav.menu.colorscheme.label')}
|
||||
</MenuButton>
|
||||
<Option value="system" class="hidden" icon={ComputerDesktop}>
|
||||
{$t('nav.menu.colorscheme.system')}
|
||||
</Option>
|
||||
<Option value="light" class="hidden" icon={Sun}>
|
||||
{$t('nav.menu.colorscheme.light')}
|
||||
</Option>
|
||||
<Option value="dark" class="hidden" icon={Moon}>
|
||||
{$t('nav.menu.colorscheme.dark')}
|
||||
</Option>
|
||||
{/snippet}
|
||||
</Select>
|
||||
<MenuButton href="/theme">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Swatch} size="16" micro />
|
||||
|
||||
@@ -25,8 +25,9 @@
|
||||
</script>
|
||||
|
||||
<Menu placement="bottom">
|
||||
{#snippet target()}
|
||||
{#snippet target(attachment)}
|
||||
<Button
|
||||
{@attach attachment}
|
||||
color="tertiary"
|
||||
alignment="left"
|
||||
size="md"
|
||||
|
||||
@@ -11,8 +11,10 @@
|
||||
import {
|
||||
ArrowLeftOnRectangle,
|
||||
Bookmark,
|
||||
ChevronUpDown,
|
||||
Cog6Tooth,
|
||||
ComputerDesktop,
|
||||
Icon,
|
||||
Identification,
|
||||
Inbox,
|
||||
Moon,
|
||||
@@ -83,15 +85,16 @@
|
||||
icon={Cog6Tooth}
|
||||
/>
|
||||
<Select bind:value={theme.colorScheme} size="sm">
|
||||
{#snippet target()}
|
||||
{#snippet target(attachment)}
|
||||
<SidebarButton
|
||||
{@attach attachment}
|
||||
label={$t('nav.menu.colorscheme.label')}
|
||||
icon={theme.colorScheme == 'system'
|
||||
? ComputerDesktop
|
||||
: theme.colorScheme == 'light'
|
||||
? Sun
|
||||
: Moon}
|
||||
class=" w-full"
|
||||
class="w-full relative"
|
||||
>
|
||||
<Option value="system" class="hidden" icon={ComputerDesktop}>
|
||||
{$t('nav.menu.colorscheme.system')}
|
||||
@@ -102,6 +105,7 @@
|
||||
<Option value="dark" class="hidden" icon={Moon}>
|
||||
{$t('nav.menu.colorscheme.dark')}
|
||||
</Option>
|
||||
<Icon micro size="16" src={ChevronUpDown} class="ml-auto" />
|
||||
</SidebarButton>
|
||||
{/snippet}
|
||||
</Select>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import type { HTMLAttributes } from 'svelte/elements'
|
||||
import type { ClassValue, HTMLAttributes } from 'svelte/elements'
|
||||
|
||||
interface Props extends HTMLAttributes<HTMLSpanElement> {
|
||||
for?: string | undefined
|
||||
@@ -7,7 +7,7 @@
|
||||
* The `text` prop will take precedence over the slot.
|
||||
*/
|
||||
text?: string | undefined
|
||||
class?: string
|
||||
class?: ClassValue
|
||||
children?: import('svelte').Snippet
|
||||
}
|
||||
|
||||
@@ -20,16 +20,14 @@
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
<svelte:element
|
||||
this={forID ? 'label' : 'span'}
|
||||
<label
|
||||
{...rest}
|
||||
for={forID}
|
||||
class="text-sm text-slate-800 dark:text-zinc-200 font-medium w-full {clazz ||
|
||||
''}"
|
||||
class={['text-sm text-slate-800 dark:text-zinc-200 font-medium', clazz]}
|
||||
>
|
||||
{#if text}
|
||||
{text}
|
||||
{:else if children}
|
||||
{@render children?.()}
|
||||
{/if}
|
||||
</svelte:element>
|
||||
</label>
|
||||
@@ -24,7 +24,7 @@
|
||||
},
|
||||
]
|
||||
>
|
||||
target?: Snippet
|
||||
target?: Snippet<[Attachment]>
|
||||
oncontextmenu?: HTMLSelectAttributes['oncontextmenu']
|
||||
onchange?: HTMLSelectAttributes['onchange']
|
||||
placement?: Placement
|
||||
@@ -35,12 +35,14 @@
|
||||
|
||||
<script lang="ts" generics="T">
|
||||
import { setContext, tick, type Snippet } from 'svelte'
|
||||
import type { Placement } from 'svelte-floating-ui/core'
|
||||
import {
|
||||
CheckCircle,
|
||||
ChevronUpDown,
|
||||
Icon,
|
||||
type IconSource,
|
||||
} from 'svelte-hero-icons'
|
||||
import type { Attachment } from 'svelte/attachments'
|
||||
import type { ClassValue, HTMLSelectAttributes } from 'svelte/elements'
|
||||
import {
|
||||
buttonColor,
|
||||
@@ -52,8 +54,6 @@
|
||||
import Menu from '../../popover/Menu.svelte'
|
||||
import MenuButton from '../../popover/MenuButton.svelte'
|
||||
import Label from '../Label.svelte'
|
||||
import { generateID } from '../helper.js'
|
||||
import type { Placement } from 'svelte-floating-ui/core'
|
||||
|
||||
let open = $state(false)
|
||||
let element: HTMLSelectElement | undefined = $state()
|
||||
@@ -78,7 +78,6 @@
|
||||
label = undefined,
|
||||
size = 'md',
|
||||
shadow = 'none',
|
||||
id = generateID(),
|
||||
class: clazz = '',
|
||||
baseClass = '',
|
||||
selectClass = '',
|
||||
@@ -88,52 +87,57 @@
|
||||
oncontextmenu,
|
||||
onchange,
|
||||
placement = 'bottom',
|
||||
target,
|
||||
target: passedTarget,
|
||||
...rest
|
||||
}: Props<T> = $props()
|
||||
</script>
|
||||
|
||||
{#snippet selectTarget()}
|
||||
<select
|
||||
{...rest}
|
||||
{id}
|
||||
bind:this={element}
|
||||
class={[
|
||||
buttonSize[size],
|
||||
buttonShadow[shadow],
|
||||
buttonColor.secondary,
|
||||
'appearance-none transition-colors rounded-xl text-sm w-full min-w-full cursor-pointer pr-6',
|
||||
selectClass,
|
||||
clazz,
|
||||
]}
|
||||
bind:value
|
||||
onmousedown={e => {
|
||||
e.preventDefault()
|
||||
}}
|
||||
onkeypress={e => {
|
||||
e.preventDefault()
|
||||
open = !open
|
||||
}}
|
||||
{onchange}
|
||||
{oncontextmenu}
|
||||
{placeholder}
|
||||
>
|
||||
{#if placeholder}
|
||||
<option disabled selected value="">{placeholder}</option>
|
||||
{/if}
|
||||
{@render children?.()}
|
||||
</select>
|
||||
{#snippet selectTarget(attachment: Attachment)}
|
||||
<Label text={label} class={['space-y-1 relative', clazz, baseClass]}>
|
||||
{@render customLabel?.()}
|
||||
<Icon
|
||||
src={ChevronUpDown}
|
||||
micro
|
||||
size="16"
|
||||
class="absolute right-1.5 bottom-1 box-border pointer-events-none z-10 text-slate-600 dark:text-zinc-400"
|
||||
/>
|
||||
<select
|
||||
{@attach attachment}
|
||||
{...rest}
|
||||
bind:this={element}
|
||||
class={[
|
||||
buttonSize[size],
|
||||
buttonShadow[shadow],
|
||||
buttonColor.secondary,
|
||||
'appearance-none transition-colors rounded-xl text-sm w-full min-w-full cursor-pointer pr-6',
|
||||
selectClass,
|
||||
clazz,
|
||||
]}
|
||||
bind:value
|
||||
onmousedown={e => {
|
||||
e.preventDefault()
|
||||
}}
|
||||
onkeypress={e => {
|
||||
e.preventDefault()
|
||||
open = !open
|
||||
}}
|
||||
{onchange}
|
||||
{oncontextmenu}
|
||||
{placeholder}
|
||||
>
|
||||
{#if placeholder}
|
||||
<option disabled selected value="">{placeholder}</option>
|
||||
{/if}
|
||||
{@render children?.()}
|
||||
</select>
|
||||
</Label>
|
||||
{/snippet}
|
||||
|
||||
<div class={['flex flex-col gap-1', clazz, baseClass]}>
|
||||
{#if customLabel || label}
|
||||
<Label for={id} text={label}>
|
||||
{@render customLabel?.()}
|
||||
</Label>
|
||||
{/if}
|
||||
|
||||
<div class="w-full relative">
|
||||
<Menu bind:open {placement} target={target ?? selectTarget}>
|
||||
<Menu bind:open {placement}>
|
||||
{#snippet target(attachment)}
|
||||
{@const render = passedTarget ?? selectTarget}
|
||||
{@render render?.(attachment)}
|
||||
{/snippet}
|
||||
{#each context.options as option (option)}
|
||||
{#if customOption}{@render customOption({
|
||||
option,
|
||||
@@ -177,11 +181,3 @@
|
||||
{/if}
|
||||
{/each}
|
||||
</Menu>
|
||||
<Icon
|
||||
src={ChevronUpDown}
|
||||
micro
|
||||
size="16"
|
||||
class="absolute right-0 top-1/4 mx-1.5 box-border pointer-events-none"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -8,27 +8,26 @@
|
||||
type Strategy,
|
||||
} from '@floating-ui/core'
|
||||
import Popover from '../popover/Popover.svelte'
|
||||
import type { Snippet } from 'svelte'
|
||||
import type { Attachment } from 'svelte/attachments'
|
||||
|
||||
interface Props {
|
||||
openOnHover?: boolean
|
||||
open?: boolean
|
||||
manual?: boolean
|
||||
placement?: Placement
|
||||
middleware?: Middleware[]
|
||||
strategy?: Strategy
|
||||
class?: string
|
||||
target?: import('svelte').Snippet
|
||||
target?: Snippet<[Attachment]>
|
||||
children?: import('svelte').Snippet<[boolean]>
|
||||
}
|
||||
|
||||
let {
|
||||
openOnHover = false,
|
||||
open = $bindable(false),
|
||||
manual = false,
|
||||
placement = 'bottom-start',
|
||||
middleware = [offset(6), shift({ padding: 6 }), flip()],
|
||||
strategy = 'absolute',
|
||||
class: clazz = '',
|
||||
target,
|
||||
children,
|
||||
...rest
|
||||
@@ -40,12 +39,10 @@
|
||||
{placement}
|
||||
{middleware}
|
||||
{strategy}
|
||||
{manual}
|
||||
{target}
|
||||
{...rest}
|
||||
bind:open
|
||||
popoverClass="rounded-xl w-full backdrop-blur-md max-w-72"
|
||||
class={clazz}
|
||||
{target}
|
||||
>
|
||||
{#snippet popover()}
|
||||
<div
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
type ButtonColor,
|
||||
type ButtonProps,
|
||||
} from '../button/Button.svelte'
|
||||
import { Icon, type IconSource } from 'svelte-hero-icons'
|
||||
import { ChevronRight, Icon, type IconSource } from 'svelte-hero-icons'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
|
||||
interface Props extends ButtonProps {
|
||||
@@ -18,6 +18,7 @@
|
||||
prefix?: Snippet
|
||||
children?: Snippet
|
||||
suffix?: Snippet
|
||||
nest?: boolean
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -30,6 +31,7 @@
|
||||
prefix: passedPrefix,
|
||||
children,
|
||||
suffix: passedSuffix,
|
||||
nest,
|
||||
...rest
|
||||
}: Props = $props()
|
||||
</script>
|
||||
@@ -48,6 +50,7 @@
|
||||
{alignment}
|
||||
{href}
|
||||
{disabled}
|
||||
data-autoclose={nest ? 'false' : 'true'}
|
||||
shadow="none"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
@@ -67,5 +70,8 @@
|
||||
{@render children?.()}
|
||||
{#snippet suffix()}
|
||||
{@render passedSuffix?.()}
|
||||
{#if nest}
|
||||
<Icon src={ChevronRight} size="16" micro class="ml-auto" />
|
||||
{/if}
|
||||
{/snippet}
|
||||
</Button>
|
||||
@@ -9,6 +9,7 @@
|
||||
} from '@floating-ui/core'
|
||||
import { createFloatingActions } from 'svelte-floating-ui'
|
||||
import { focusTrap } from 'svelte-focus-trap'
|
||||
import type { Attachment } from 'svelte/attachments'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { scale } from 'svelte/transition'
|
||||
import { Material } from '../index'
|
||||
@@ -21,10 +22,8 @@
|
||||
placement?: Placement
|
||||
middleware?: Middleware[]
|
||||
strategy?: Strategy
|
||||
manual?: boolean
|
||||
popoverClass?: string
|
||||
class?: string
|
||||
target?: import('svelte').Snippet
|
||||
target?: import('svelte').Snippet<[Attachment]>
|
||||
popover?: import('svelte').Snippet<[boolean]>
|
||||
children?: import('svelte').Snippet<[boolean]>
|
||||
}
|
||||
@@ -36,17 +35,12 @@
|
||||
placement = 'bottom-start',
|
||||
middleware = [offset(6), shift(), flip()],
|
||||
strategy = 'fixed',
|
||||
manual = false,
|
||||
popoverClass = '',
|
||||
class: clazz = '',
|
||||
target,
|
||||
popover,
|
||||
children,
|
||||
}: Props = $props()
|
||||
|
||||
let canUseContents = $state(true)
|
||||
|
||||
let el = $state<HTMLElement>()
|
||||
let popoverEl = $state<HTMLElement>()
|
||||
|
||||
let origins: Record<Placement, string> = {
|
||||
@@ -75,66 +69,54 @@
|
||||
},
|
||||
})
|
||||
|
||||
const customFloatingContent = (node: HTMLDivElement) => {
|
||||
floatingContent(node)
|
||||
}
|
||||
const menuAttach: Attachment = element => {
|
||||
const e = element as HTMLButtonElement
|
||||
|
||||
const customFloatingRef = (node: HTMLDivElement) => {
|
||||
const n = node.children.item(0)
|
||||
const mouseLeave = () => (openOnHover ? (open = false) : false)
|
||||
const focus = () => (openOnHover ? (open = true) : false)
|
||||
const focusout = () => (openOnHover ? (open = false) : false)
|
||||
const click = () => {
|
||||
open = !open
|
||||
|
||||
// @ts-expect-error svelte hell
|
||||
if (n) floatingRef(n)
|
||||
else {
|
||||
canUseContents = false
|
||||
floatingRef(node)
|
||||
if (autoClose) {
|
||||
const clickHandler = (event: Event) => {
|
||||
if (!e) return
|
||||
|
||||
const target = event.target as Element | null
|
||||
|
||||
if (!e?.contains(event.target as Element | null)) {
|
||||
if (target?.closest("[data-autoclose='false']") == null) {
|
||||
open = false
|
||||
document.removeEventListener('click', clickHandler)
|
||||
}
|
||||
}
|
||||
}
|
||||
document.addEventListener('click', clickHandler)
|
||||
}
|
||||
}
|
||||
const keydown = (event: KeyboardEvent) => {
|
||||
if (event.key === 'Escape') open = false
|
||||
}
|
||||
|
||||
e.addEventListener('mouseleave', mouseLeave)
|
||||
e.addEventListener('focus', focus)
|
||||
e.addEventListener('focusout', focusout)
|
||||
e.addEventListener('click', click)
|
||||
e.addEventListener('keydown', keydown)
|
||||
|
||||
floatingRef(e)
|
||||
|
||||
return () => {
|
||||
e.removeEventListener('mouseleave', mouseLeave)
|
||||
e.removeEventListener('focus', focus)
|
||||
e.removeEventListener('focusout', focusout)
|
||||
e.removeEventListener('click', click)
|
||||
e.removeEventListener('keydown', keydown)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:body
|
||||
onclick={e => {
|
||||
if (openOnHover) return
|
||||
|
||||
// @ts-expect-error svelte hell
|
||||
if (!el?.contains(e.target) && open) {
|
||||
if (!autoClose) {
|
||||
// @ts-expect-error svelte hell
|
||||
if (popoverEl && !popoverEl.contains(e.target)) {
|
||||
open = false
|
||||
}
|
||||
} else {
|
||||
open = false
|
||||
}
|
||||
}
|
||||
}}
|
||||
onkeydown={async e => {
|
||||
if (open && e.key == 'Escape') {
|
||||
open = false
|
||||
// @ts-expect-error svelte hell
|
||||
el?.firstChild.focus()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
{#if target}
|
||||
<div
|
||||
onmouseover={() => (openOnHover ? (open = true) : false)}
|
||||
onmouseleave={() => (openOnHover ? (open = false) : false)}
|
||||
onfocus={() => (openOnHover ? (open = true) : false)}
|
||||
onfocusout={() => (openOnHover ? (open = false) : false)}
|
||||
onclick={() => (!openOnHover && !manual ? (open = !open) : false)}
|
||||
onkeydown={e => {
|
||||
if (e.key == 'Escape') open = false
|
||||
}}
|
||||
tabindex="0"
|
||||
role="button"
|
||||
class="{canUseContents ? 'contents text-left' : 'w-max h-max'} {clazz}"
|
||||
bind:this={el}
|
||||
use:customFloatingRef
|
||||
>
|
||||
{@render target?.()}
|
||||
</div>
|
||||
{/if}
|
||||
{@render target?.(menuAttach)}
|
||||
|
||||
{#if open}
|
||||
<Portal class="z-150">
|
||||
@@ -146,7 +128,7 @@
|
||||
easing: expoOut,
|
||||
}}
|
||||
class="z-150 {popoverClass}"
|
||||
use:customFloatingContent
|
||||
use:floatingContent
|
||||
use:focusTrap
|
||||
bind:this={popoverEl}
|
||||
>
|
||||
|
||||
@@ -65,9 +65,10 @@
|
||||
|
||||
<div class="relative">
|
||||
<Menu bind:open={openMenu}>
|
||||
{#snippet target()}
|
||||
{#snippet target(attachment)}
|
||||
{#if input}{@render input()}{:else}
|
||||
<TextInput
|
||||
{@attach attachment}
|
||||
bind:value={query}
|
||||
oninput={e => {
|
||||
searching = true
|
||||
|
||||
@@ -3,9 +3,6 @@ import { env } from '$env/dynamic/public'
|
||||
import { locale } from './i18n/translations'
|
||||
import { browser } from '$app/environment'
|
||||
|
||||
console.log('Using the following default settings from the environment:')
|
||||
console.log(env)
|
||||
|
||||
export type View = 'cozy' | 'compact'
|
||||
|
||||
export const SSR_ENABLED = env.PUBLIC_SSR_ENABLED?.toLowerCase() == 'true'
|
||||
@@ -230,7 +227,7 @@ function isObject(item: object) {
|
||||
* @param target
|
||||
* @param ...sources
|
||||
*/
|
||||
// eslint-disable-next-line
|
||||
|
||||
function mergeDeep(target: any, ...sources: any[]) {
|
||||
if (!sources.length) return target
|
||||
const source = sources.shift()
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { browser } from '$app/environment'
|
||||
import { env } from '$env/dynamic/public'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { aliases, loadTranslations } from '$lib/i18n/translations.js'
|
||||
|
||||
export const ssr = (env.PUBLIC_SSR_ENABLED?.toLowerCase() ?? 'false') == 'true'
|
||||
export const ssr = false
|
||||
|
||||
export const load = async () => {
|
||||
if (browser) {
|
||||
|
||||
+69
-35
@@ -6,6 +6,7 @@
|
||||
import PostFeed from '$lib/components/lemmy/post/feed/PostFeed.svelte'
|
||||
import VirtualFeed from '$lib/components/lemmy/post/feed/VirtualFeed.svelte'
|
||||
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
||||
import Skeleton from '$lib/components/ui/generic/Skeleton.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
@@ -13,16 +14,19 @@
|
||||
import { postFeeds } from '$lib/lemmy/postfeed.svelte.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import Button from 'mono-svelte/button/Button.svelte'
|
||||
import { onMount } from 'svelte'
|
||||
import { ArrowRight, ChartBar, Icon } from 'svelte-hero-icons'
|
||||
|
||||
let { data = $bindable() } = $props()
|
||||
|
||||
let type = $state(data.feed.value.type_)
|
||||
let sort = $state(data.feed.value.sort)
|
||||
|
||||
$effect(() => {
|
||||
if (type) settings.defaultSort.feed = type
|
||||
if (sort) settings.defaultSort.sort = sort
|
||||
onMount(async () => {
|
||||
await data.feed.value
|
||||
$effect(() => {
|
||||
if (data.filters.value.type_)
|
||||
settings.defaultSort.feed = data.filters.value.type_
|
||||
if (data.filters.value.sort)
|
||||
settings.defaultSort.sort = data.filters.value.sort
|
||||
})
|
||||
})
|
||||
|
||||
const FeedComponent = $derived(
|
||||
@@ -42,10 +46,19 @@
|
||||
|
||||
{#snippet extended()}
|
||||
<form class="flex items-center gap-2" method="get" action="/">
|
||||
{#if type}
|
||||
<Location name="type" navigate bind:selected={type} />
|
||||
{#if data.filters.value.type_}
|
||||
<Location
|
||||
name="type"
|
||||
navigate
|
||||
bind:selected={data.filters.value.type_}
|
||||
/>
|
||||
{/if}
|
||||
<Sort placement="bottom" name="sort" navigate bind:selected={sort} />
|
||||
<Sort
|
||||
placement="bottom"
|
||||
name="sort"
|
||||
navigate
|
||||
bind:selected={data.filters.value.sort}
|
||||
/>
|
||||
<ViewSelect placement="bottom" />
|
||||
|
||||
<noscript>
|
||||
@@ -57,31 +70,52 @@
|
||||
{/snippet}
|
||||
</Header>
|
||||
|
||||
<FeedComponent
|
||||
bind:posts={data.feed.value.posts.posts}
|
||||
bind:feedData={() => data.feed.value, v => (postFeeds.value.main.data = v)}
|
||||
feedId="main"
|
||||
/>
|
||||
<svelte:element
|
||||
this={settings.infiniteScroll && !settings.posts.noVirtualize
|
||||
? 'noscript'
|
||||
: 'div'}
|
||||
class="mt-auto flex flex-col"
|
||||
>
|
||||
<EndPlaceholder>
|
||||
<Icon src={ChartBar} size="16" mini />
|
||||
<!-- <EndPlaceholder size="md">
|
||||
{$t('cards.community.activeDay')}
|
||||
{#snippet action()}
|
||||
<span class="text-primary-900 dark:text-primary-100">
|
||||
{site.data?.site_view.counts.users_active_day.toString()}
|
||||
</span>
|
||||
{/snippet}
|
||||
</EndPlaceholder> -->
|
||||
|
||||
{$t('routes.frontpage.footer', {
|
||||
users: site.data?.site_view?.counts?.users_active_day ?? '??',
|
||||
})}
|
||||
{#snippet action()}
|
||||
<Pageination
|
||||
cursor={{ next: data.feed.value.cursor.next }}
|
||||
href={page =>
|
||||
typeof page == 'number' ? `?page=${page}` : `?cursor=${page}`}
|
||||
back={false}
|
||||
/>
|
||||
{/snippet}
|
||||
</EndPlaceholder>
|
||||
</svelte:element>
|
||||
{#await data.feed.value}
|
||||
{#each new Array(5) as _, index}{_}
|
||||
<div
|
||||
class="animate-pop-in"
|
||||
style="animation-delay: {index * 50}ms; opacity: 0; width: {(1 /
|
||||
((index + 1) % 3)) *
|
||||
100}%"
|
||||
>
|
||||
<Skeleton />
|
||||
</div>{/each}
|
||||
{:then feed}
|
||||
<FeedComponent
|
||||
bind:posts={feed.posts.posts}
|
||||
bind:feedData={() => feed, v => (postFeeds.value.main.data = v)}
|
||||
feedId="main"
|
||||
/>
|
||||
<svelte:element
|
||||
this={settings.infiniteScroll && !settings.posts.noVirtualize
|
||||
? 'noscript'
|
||||
: 'div'}
|
||||
class="mt-auto flex flex-col"
|
||||
>
|
||||
<EndPlaceholder>
|
||||
<Icon src={ChartBar} size="16" mini />
|
||||
|
||||
{$t('routes.frontpage.footer', {
|
||||
users: site.data?.site_view?.counts?.users_active_day ?? '??',
|
||||
})}
|
||||
{#snippet action()}
|
||||
<Pageination
|
||||
cursor={{ next: feed.cursor.next }}
|
||||
href={page =>
|
||||
typeof page == 'number' ? `?page=${page}` : `?cursor=${page}`}
|
||||
back={false}
|
||||
/>
|
||||
{/snippet}
|
||||
</EndPlaceholder>
|
||||
</svelte:element>
|
||||
{/await}
|
||||
</div>
|
||||
+19
-15
@@ -1,6 +1,6 @@
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { postFeed } from '$lib/lemmy/postfeed.svelte.js'
|
||||
import { ReactiveState } from '$lib/promise.svelte.js'
|
||||
import { ReactiveState, awaitIfServer } from '$lib/promise.svelte.js'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import type { ListingType, SortType } from 'lemmy-js-client'
|
||||
import { ChevronDoubleUp } from 'svelte-hero-icons'
|
||||
@@ -13,21 +13,25 @@ export async function load({ url, fetch }) {
|
||||
const listingType: ListingType =
|
||||
(url.searchParams.get('type') as ListingType) || settings.defaultSort.feed
|
||||
|
||||
const feed = postFeed({
|
||||
id: 'main',
|
||||
request: {
|
||||
page_cursor: cursor,
|
||||
sort: sort,
|
||||
type_: listingType,
|
||||
limit: 20,
|
||||
show_hidden: settings.posts.showHidden,
|
||||
},
|
||||
url: url,
|
||||
fetch: fetch,
|
||||
})
|
||||
|
||||
return {
|
||||
feed: new ReactiveState(
|
||||
await postFeed({
|
||||
id: 'main',
|
||||
request: {
|
||||
page_cursor: cursor,
|
||||
sort: sort,
|
||||
type_: listingType,
|
||||
limit: 20,
|
||||
show_hidden: settings.posts.showHidden,
|
||||
},
|
||||
url: url,
|
||||
fetch: fetch,
|
||||
}),
|
||||
),
|
||||
feed: new ReactiveState((await awaitIfServer(feed)).data),
|
||||
filters: new ReactiveState({
|
||||
sort: sort,
|
||||
type_: listingType,
|
||||
}),
|
||||
contextual: {
|
||||
actions: [
|
||||
{
|
||||
|
||||
@@ -171,8 +171,9 @@
|
||||
</span>
|
||||
</div>
|
||||
<Menu placement="bottom-end">
|
||||
{#snippet target()}
|
||||
{#snippet target(attachment)}
|
||||
<Button
|
||||
{@attach attachment}
|
||||
size="square-md"
|
||||
color="tertiary"
|
||||
class="justify-self-end ml-auto z-50"
|
||||
|
||||
@@ -188,8 +188,8 @@
|
||||
{#if site.data}
|
||||
<div class="flex gap-2 flex-wrap flex-row">
|
||||
<Menu class="gap-px">
|
||||
{#snippet target()}
|
||||
<button type="button">
|
||||
{#snippet target(attachment)}
|
||||
<button {@attach attachment} type="button">
|
||||
<Badge color="blue-subtle">
|
||||
<Icon src={Plus} micro size="14" />
|
||||
{$t('common.add')}
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
import CommunityItem from '$lib/components/lemmy/community/CommunityItem.svelte'
|
||||
import Location from '$lib/components/lemmy/dropdowns/Location.svelte'
|
||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
|
||||
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
||||
import Skeleton from '$lib/components/ui/generic/Skeleton.svelte'
|
||||
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
|
||||
import { Material, Option } from 'mono-svelte'
|
||||
@@ -17,7 +17,6 @@
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { fly } from 'svelte/transition'
|
||||
import SearchBar from '../search/SearchBar.svelte'
|
||||
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
||||
|
||||
let { data } = $props()
|
||||
|
||||
@@ -44,43 +43,46 @@
|
||||
|
||||
<Header pageHeader class="justify-between">
|
||||
<span>{$t('routes.communities.title')}</span>
|
||||
|
||||
{#snippet extended()}
|
||||
<form method="get" action="/communities" class="contents" bind:this={form}>
|
||||
<SearchBar bind:query={search} />
|
||||
|
||||
<div class="flex flex-row flex-wrap gap-4 mt-4 items-center">
|
||||
<Location
|
||||
name="type"
|
||||
selected={data.type}
|
||||
onchange={() => form?.requestSubmit()}
|
||||
>
|
||||
{#if !LINKED_INSTANCE_URL}
|
||||
{@const instanceSet = new Set(
|
||||
profile.meta.profiles.map(i => i.instance),
|
||||
)}
|
||||
{#if instanceSet.size > 1}
|
||||
<Option disabled data-label="true">—</Option>
|
||||
{#each instanceSet as instance}
|
||||
<Option
|
||||
icon={ServerStack}
|
||||
value={encodeURIComponent(`instance-${instance}`)}
|
||||
>
|
||||
{instance}
|
||||
</Option>
|
||||
{/each}
|
||||
{/if}
|
||||
{/if}
|
||||
</Location>
|
||||
<Sort
|
||||
name="sort"
|
||||
selected={data.sort}
|
||||
onchange={() => form?.requestSubmit()}
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
{/snippet}
|
||||
</Header>
|
||||
|
||||
<form method="get" action="/communities" class="contents" bind:this={form}>
|
||||
<SearchBar bind:query={search} />
|
||||
|
||||
<div class="flex flex-row flex-wrap gap-4 mt-4 items-center">
|
||||
<Location
|
||||
name="type"
|
||||
selected={data.type}
|
||||
onchange={() => form?.requestSubmit()}
|
||||
>
|
||||
{#if !LINKED_INSTANCE_URL}
|
||||
{@const instanceSet = new Set(
|
||||
profile.meta.profiles.map(i => i.instance),
|
||||
)}
|
||||
{#if instanceSet.size > 1}
|
||||
<Option disabled data-label="true">—</Option>
|
||||
{#each instanceSet as instance}
|
||||
<Option
|
||||
icon={ServerStack}
|
||||
value={encodeURIComponent(`instance-${instance}`)}
|
||||
>
|
||||
{instance}
|
||||
</Option>
|
||||
{/each}
|
||||
{/if}
|
||||
{/if}
|
||||
</Location>
|
||||
<Sort
|
||||
name="sort"
|
||||
selected={data.sort}
|
||||
onchange={() => form?.requestSubmit()}
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
{#if navigating.to?.route.id == '/communities'}
|
||||
<div class="flex flex-col gap-3 mt-6">
|
||||
<div class="flex flex-col gap-3">
|
||||
{#each new Array(5) as _, index}
|
||||
{_}
|
||||
<div
|
||||
@@ -107,7 +109,7 @@
|
||||
{/if}
|
||||
|
||||
{#if showTop}
|
||||
<EndPlaceholder size="lg" margin="lg">
|
||||
<EndPlaceholder size="lg" margin="md">
|
||||
{$t('routes.search.top')}
|
||||
</EndPlaceholder>
|
||||
<div
|
||||
@@ -137,7 +139,7 @@
|
||||
{/if}
|
||||
|
||||
{#if data.communities.value.slice(showTop ? 3 : 0).length > 0}
|
||||
<EndPlaceholder size="lg" margin="lg">
|
||||
<EndPlaceholder size="lg" margin="md">
|
||||
{$t('routes.search.other')}
|
||||
</EndPlaceholder>
|
||||
{/if}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
{$t('nav.create.label')}
|
||||
</Header>
|
||||
|
||||
<div class="h-3 sm:h-6"></div>
|
||||
<Tabs
|
||||
style="subpage"
|
||||
routes={[
|
||||
@@ -24,6 +23,5 @@
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<div class="h-3 sm:h-6"></div>
|
||||
|
||||
{@render children?.()}
|
||||
@@ -73,33 +73,31 @@
|
||||
</div>
|
||||
</Header>
|
||||
|
||||
<div class="h-3 sm:h-6"></div>
|
||||
<Select
|
||||
class="relative w-max"
|
||||
bind:value={
|
||||
() => data.unreadOnly.value.toString(),
|
||||
v => (data.unreadOnly.value = v == 'true')
|
||||
}
|
||||
onchange={() =>
|
||||
searchParam(
|
||||
page.url,
|
||||
'unreadOnly',
|
||||
data.unreadOnly.value ? 'true' : 'false',
|
||||
'page',
|
||||
)}
|
||||
>
|
||||
{#snippet customLabel()}
|
||||
<div class="flex items-center gap-1">
|
||||
<Icon src={Funnel} size="15" mini />
|
||||
{$t('filter.filter')}
|
||||
</div>
|
||||
{/snippet}
|
||||
<Option value="false">{$t('filter.location.all')}</Option>
|
||||
<Option value="true">{$t('filter.unread')}</Option>
|
||||
</Select>
|
||||
|
||||
<div class="mb-3 sm:mb-6">
|
||||
<Select
|
||||
class=" w-max items-center"
|
||||
bind:value={
|
||||
() => data.unreadOnly.value.toString(),
|
||||
v => (data.unreadOnly.value = v == 'true')
|
||||
}
|
||||
onchange={() =>
|
||||
searchParam(
|
||||
page.url,
|
||||
'unreadOnly',
|
||||
data.unreadOnly.value ? 'true' : 'false',
|
||||
'page',
|
||||
)}
|
||||
>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={Funnel} size="15" mini />
|
||||
{$t('filter.filter')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<Option value="false">{$t('filter.location.all')}</Option>
|
||||
<Option value="true">{$t('filter.unread')}</Option>
|
||||
</Select>
|
||||
</div>
|
||||
<div class="h-3 sm:h-6"></div>
|
||||
|
||||
{#if !data.inbox?.value || (data.inbox.value?.length ?? 0) == 0}
|
||||
<Placeholder
|
||||
|
||||
@@ -131,7 +131,6 @@
|
||||
{@render startChat?.()}
|
||||
</Placeholder>
|
||||
{/if}
|
||||
<div class="h-3 sm:h-6"></div>
|
||||
<CommonList items={previews}>
|
||||
{#snippet item(preview)}
|
||||
<a href="/inbox/messages/{preview.user.id}" class="flex flex-row gap-2">
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
let { children } = $props()
|
||||
</script>
|
||||
|
||||
<Header pageHeader>Instances</Header>
|
||||
<Tabs
|
||||
routes={[
|
||||
{
|
||||
@@ -15,5 +14,5 @@
|
||||
{ href: '/instances/blocked', name: 'Blocked' },
|
||||
]}
|
||||
></Tabs>
|
||||
<div class="h-3 sm:h-6"></div>
|
||||
<Header pageHeader>Instances</Header>
|
||||
{@render children?.()}
|
||||
@@ -0,0 +1,69 @@
|
||||
<script lang="ts">
|
||||
import VirtualList from '$lib/components/render/VirtualList.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { Spinner, TextInput } from 'mono-svelte'
|
||||
import { Check } from 'svelte-hero-icons'
|
||||
|
||||
let { data: passedData } = $props()
|
||||
let data = $state(passedData)
|
||||
|
||||
let filter = $state('')
|
||||
|
||||
let loading = $state(false)
|
||||
|
||||
function triggerFilter(filter: string) {
|
||||
if (!passedData.blocked) return
|
||||
loading = true
|
||||
data.blocked = passedData.blocked.filter(i => i.domain.includes(filter))
|
||||
loading = false
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if data}
|
||||
<div class="flex flex-col gap-4">
|
||||
<form onsubmit={() => triggerFilter(filter)}>
|
||||
<TextInput label={$t('filter.filter')} bind:value={filter}></TextInput>
|
||||
</form>
|
||||
{#if data.blocked && data.blocked.length > 0}
|
||||
{#if loading}
|
||||
<Spinner />
|
||||
{/if}
|
||||
<VirtualList
|
||||
items={data.blocked}
|
||||
useWindow={false}
|
||||
height={600}
|
||||
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 w-full"
|
||||
>
|
||||
{#snippet item(index)}
|
||||
{#if data.blocked[index]}
|
||||
<div
|
||||
class="flex justify-between items-center first:pt-0 last:pb-0 my-3 px-6"
|
||||
>
|
||||
<div class="flex flex-col">
|
||||
<span class="font-medium">{data.blocked[index].domain}</span>
|
||||
<span
|
||||
class="text-xs text-slate-600 dark:text-zinc-400 capitalize"
|
||||
>
|
||||
{data.blocked[index].software ?? 'Unknown'} • <RelativeDate
|
||||
date={publishedToDate(data.blocked[index].published)}
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/snippet}
|
||||
</VirtualList>
|
||||
{:else}
|
||||
<Placeholder
|
||||
icon={Check}
|
||||
title="No blocked instances"
|
||||
description="This instance likely has federation disabled."
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
@@ -3,27 +3,46 @@
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import { Material } from 'mono-svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { Spinner, TextInput } from 'mono-svelte'
|
||||
import { Check } from 'svelte-hero-icons'
|
||||
|
||||
let { data } = $props()
|
||||
let { data: passedData } = $props()
|
||||
let data = $state(passedData)
|
||||
|
||||
let filter = $state('')
|
||||
|
||||
let loading = $state(false)
|
||||
|
||||
function triggerFilter(filter: string) {
|
||||
if (!passedData.linked) return
|
||||
loading = true
|
||||
data.linked = passedData.linked.filter(i => i.domain.includes(filter))
|
||||
loading = false
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if data}
|
||||
<div class="flex flex-col md:flex-row gap-4">
|
||||
<Material
|
||||
class="h-full overflow-auto divide-y *:py-3 divide-slate-200 dark:divide-zinc-800 max-h-[48rem] w-full"
|
||||
>
|
||||
{#if data.linked && data.linked.length > 0}
|
||||
<VirtualList
|
||||
useWindow={false}
|
||||
items={data.linked}
|
||||
height={473}
|
||||
estimatedHeight={100}
|
||||
>
|
||||
{#snippet item(index)}
|
||||
<div class="flex flex-col gap-4">
|
||||
<form onsubmit={() => triggerFilter(filter)}>
|
||||
<TextInput label={$t('filter.filter')} bind:value={filter}></TextInput>
|
||||
</form>
|
||||
{#if data.linked && data.linked.length > 0}
|
||||
{#if loading}
|
||||
<Spinner />
|
||||
{/if}
|
||||
<VirtualList
|
||||
items={data.linked}
|
||||
useWindow={false}
|
||||
height={600}
|
||||
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 w-full"
|
||||
>
|
||||
{#snippet item(index)}
|
||||
{#if data.linked[index]}
|
||||
<div
|
||||
class="flex justify-between items-center first:pt-0 last:pb-0 my-3"
|
||||
class="flex justify-between items-center first:pt-0 last:pb-0 my-3 px-6"
|
||||
>
|
||||
<div class="flex flex-col">
|
||||
<span class="font-medium">{data.linked[index].domain}</span>
|
||||
@@ -36,15 +55,15 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{/snippet}
|
||||
</VirtualList>
|
||||
{:else}
|
||||
<Placeholder
|
||||
icon={Check}
|
||||
title="No linked instances"
|
||||
description="This instance likely has federation disabled."
|
||||
/>
|
||||
{/if}
|
||||
</Material>
|
||||
{/if}
|
||||
{/snippet}
|
||||
</VirtualList>
|
||||
{:else}
|
||||
<Placeholder
|
||||
icon={Check}
|
||||
title="No linked instances"
|
||||
description="This instance doesn't block any others."
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
@@ -120,8 +120,8 @@
|
||||
{#if site.data && formData.discussion_languages}
|
||||
<div class="flex gap-2 flex-wrap flex-row">
|
||||
<Menu class="gap-px">
|
||||
{#snippet target()}
|
||||
<button type="button">
|
||||
{#snippet target(attachment)}
|
||||
<button {@attach attachment} type="button">
|
||||
<Badge color="blue-subtle">
|
||||
<Icon src={Plus} micro size="14" />
|
||||
{$t('common.add')}
|
||||
|
||||
@@ -48,8 +48,9 @@
|
||||
]}
|
||||
>
|
||||
<Menu class="flex-1" placement="bottom-end">
|
||||
{#snippet target()}
|
||||
{#snippet target(attachment)}
|
||||
<Button
|
||||
{@attach attachment}
|
||||
aria-label={$t('post.actions.more.label')}
|
||||
size="square-sm"
|
||||
color="none"
|
||||
|
||||
@@ -61,8 +61,6 @@
|
||||
{/snippet}
|
||||
</Header>
|
||||
|
||||
<div class="h-3 sm:h-6"></div>
|
||||
|
||||
{#if !data.data || (data.data?.length ?? 0) == 0}
|
||||
<Placeholder
|
||||
icon={Bookmark}
|
||||
|
||||
@@ -54,44 +54,52 @@
|
||||
|
||||
<Header pageHeader>
|
||||
{$t('routes.search.title')}
|
||||
{#snippet extended()}
|
||||
<form
|
||||
method="get"
|
||||
action="/search"
|
||||
class="flex flex-col gap-4"
|
||||
bind:this={form}
|
||||
>
|
||||
<SearchBar bind:query={data.filters.value.query} />
|
||||
<div class="flex flex-row flex-wrap items-center gap-4">
|
||||
<Select
|
||||
name="type"
|
||||
bind:value={data.filters.value.type}
|
||||
onchange={() => form?.requestSubmit()}
|
||||
>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={AdjustmentsHorizontal} mini size="15" />
|
||||
{$t('filter.type')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<Option value="All">{$t('content.all')}</Option>
|
||||
<Option value="Posts">{$t('content.posts')}</Option>
|
||||
<Option value="Comments">{$t('content.comments')}</Option>
|
||||
<Option value="Communities">{$t('content.communities')}</Option>
|
||||
<Option value="Users">{$t('content.users')}</Option>
|
||||
<Option value="Url">{$t('content.url')}</Option>
|
||||
</Select>
|
||||
<Sort
|
||||
name="sort"
|
||||
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>
|
||||
</div>
|
||||
</form>
|
||||
{/snippet}
|
||||
</Header>
|
||||
<form method="get" action="/search" class="contents" bind:this={form}>
|
||||
<SearchBar bind:query={data.filters.value.query} />
|
||||
<div class="flex flex-row flex-wrap items-center gap-4 my-4 sm:my-6">
|
||||
<Select
|
||||
name="type"
|
||||
bind:value={data.filters.value.type}
|
||||
onchange={() => form?.requestSubmit()}
|
||||
>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={AdjustmentsHorizontal} mini size="15" />
|
||||
{$t('filter.type')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<Option value="All">{$t('content.all')}</Option>
|
||||
<Option value="Posts">{$t('content.posts')}</Option>
|
||||
<Option value="Comments">{$t('content.comments')}</Option>
|
||||
<Option value="Communities">{$t('content.communities')}</Option>
|
||||
<Option value="Users">{$t('content.users')}</Option>
|
||||
<Option value="Url">{$t('content.url')}</Option>
|
||||
</Select>
|
||||
<Sort
|
||||
name="sort"
|
||||
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>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{#if moreOptions}
|
||||
<div
|
||||
transition:slide={{ axis: 'y', easing: expoOut, duration: 500 }}
|
||||
|
||||
@@ -96,8 +96,6 @@
|
||||
{/snippet}
|
||||
</Header>
|
||||
|
||||
<div class="h-3 sm:h-6"></div>
|
||||
|
||||
<Tabs
|
||||
routes={[
|
||||
{
|
||||
@@ -122,8 +120,6 @@
|
||||
},
|
||||
]}
|
||||
style="subpage"
|
||||
></Tabs>
|
||||
|
||||
<div class="h-3 sm:h-6"></div>
|
||||
/>
|
||||
|
||||
{@render children?.()}
|
||||
@@ -240,8 +240,8 @@
|
||||
{/if}
|
||||
{#if isAdmin(profile.current?.user)}
|
||||
<Menu class="ml-auto" placement="bottom-end">
|
||||
{#snippet target()}
|
||||
<Button size="sm" rounding="pill">
|
||||
{#snippet target(attachment)}
|
||||
<Button {@attach attachment} size="sm" rounding="pill">
|
||||
<ShieldIcon width={16} filled />
|
||||
{$t('moderation.label')}
|
||||
</Button>
|
||||
|
||||
Reference in new issue
Block a user