design: improve menus
This commit is contained in:
14 files changed
+176
-191
No files matched your search
@@ -11,7 +11,7 @@
|
|||||||
import { deleteItem, save } from '$lib/lemmy/contentview.js'
|
import { deleteItem, save } from '$lib/lemmy/contentview.js'
|
||||||
import { settings } from '$lib/settings.svelte'
|
import { settings } from '$lib/settings.svelte'
|
||||||
import type { CommentView } from 'lemmy-js-client'
|
import type { CommentView } from 'lemmy-js-client'
|
||||||
import { Button, Menu, MenuButton, MenuDivider } from 'mono-svelte'
|
import { Button, Menu, MenuButton } from 'mono-svelte'
|
||||||
import {
|
import {
|
||||||
Bookmark,
|
Bookmark,
|
||||||
BookmarkSlash,
|
BookmarkSlash,
|
||||||
@@ -69,15 +69,14 @@
|
|||||||
title={$t('comment.actions.label')}
|
title={$t('comment.actions.label')}
|
||||||
color="tertiary"
|
color="tertiary"
|
||||||
rounding="pill"
|
rounding="pill"
|
||||||
size="square-sm"
|
size="square-md"
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
class="text-slate-600 dark:text-zinc-400"
|
||||||
>
|
>
|
||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
<Icon src={EllipsisHorizontal} width={16} height={16} mini />
|
<Icon src={EllipsisHorizontal} size="16" micro />
|
||||||
{/snippet}
|
{/snippet}
|
||||||
</Button>
|
</Button>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<MenuDivider>{$t('comment.actions.label')}</MenuDivider>
|
|
||||||
<MenuButton
|
<MenuButton
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
if (navigator.share)
|
if (navigator.share)
|
||||||
|
|||||||
@@ -41,19 +41,14 @@
|
|||||||
<div bind:this={offsetEl}>
|
<div bind:this={offsetEl}>
|
||||||
{#if offsetEl}
|
{#if offsetEl}
|
||||||
<VirtualList
|
<VirtualList
|
||||||
class="divide-y divide-slate-100 dark:divide-zinc-900 -mx-3 sm:-mx-6"
|
class="divide-y-2 divide-slate-100 dark:divide-zinc-900 -mx-3 sm:-mx-6"
|
||||||
overscan={5}
|
overscan={5}
|
||||||
estimatedHeight={500}
|
estimatedHeight={500}
|
||||||
items={nodes}
|
items={nodes}
|
||||||
{initialOffset}
|
{initialOffset}
|
||||||
>
|
>
|
||||||
{#snippet item(index)}
|
{#snippet item(index)}
|
||||||
<div
|
<div class={['px-3 sm:px-6', index % 2 == 1 && '']}>
|
||||||
class={[
|
|
||||||
'px-3 sm:px-6',
|
|
||||||
index % 2 == 1 && 'bg-slate-25 dark:bg-zinc-950',
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<Comments
|
<Comments
|
||||||
bind:nodes={() => [nodes[index]], v => (nodes[index] = v[0])}
|
bind:nodes={() => [nodes[index]], v => (nodes[index] = v[0])}
|
||||||
{post}
|
{post}
|
||||||
|
|||||||
@@ -1,28 +1,25 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { goto } from '$app/navigation'
|
import { goto } from '$app/navigation'
|
||||||
import { profile } from '$lib/auth.svelte'
|
import { profile } from '$lib/auth.svelte'
|
||||||
import TextProps from '$lib/components/ui/text/TextProps.svelte'
|
|
||||||
import { t } from '$lib/i18n/translations'
|
import { t } from '$lib/i18n/translations'
|
||||||
import { deleteItem, markAsRead } from '$lib/lemmy/contentview'
|
import { deleteItem, markAsRead } from '$lib/lemmy/contentview'
|
||||||
import { communityLink, userLink } from '$lib/lemmy/generic'
|
|
||||||
import { setSessionStorage } from '$lib/session'
|
import { setSessionStorage } from '$lib/session'
|
||||||
import { settings } from '$lib/settings.svelte'
|
import { settings } from '$lib/settings.svelte'
|
||||||
import { instanceToURL } from '$lib/util.svelte'
|
import { instanceToURL } from '$lib/util.svelte'
|
||||||
import type { PostView } from 'lemmy-js-client'
|
import type { PostView } from 'lemmy-js-client'
|
||||||
import { Button, MenuButton, MenuDivider, toast } from 'mono-svelte'
|
import { Button, Menu, MenuButton, toast } from 'mono-svelte'
|
||||||
import {
|
import {
|
||||||
ArrowTopRightOnSquare,
|
ArrowTopRightOnSquare,
|
||||||
|
EllipsisHorizontal,
|
||||||
Eye,
|
Eye,
|
||||||
EyeSlash,
|
EyeSlash,
|
||||||
Flag,
|
Flag,
|
||||||
GlobeAmericas,
|
GlobeAlt,
|
||||||
Icon,
|
Icon,
|
||||||
MapPin,
|
MapPin,
|
||||||
Newspaper,
|
|
||||||
PencilSquare,
|
PencilSquare,
|
||||||
Share,
|
Share,
|
||||||
Trash,
|
Trash,
|
||||||
UserCircle,
|
|
||||||
XMark,
|
XMark,
|
||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import { report } from '../../moderation/moderation'
|
import { report } from '../../moderation/moderation'
|
||||||
@@ -34,14 +31,24 @@
|
|||||||
editing: boolean
|
editing: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
let localShare = $state(false)
|
|
||||||
|
|
||||||
let { post, onhide, editing = $bindable() }: Props = $props()
|
let { post, onhide, editing = $bindable() }: Props = $props()
|
||||||
|
|
||||||
|
function share(global: boolean = true) {
|
||||||
|
const link = global
|
||||||
|
? post.post.ap_id
|
||||||
|
: `${instanceToURL(profile.current.instance)}/post/${post.post.id}`
|
||||||
|
|
||||||
|
if (navigator.share)
|
||||||
|
navigator.share?.({
|
||||||
|
url: link,
|
||||||
|
})
|
||||||
|
else {
|
||||||
|
navigator.clipboard.writeText(link)
|
||||||
|
toast({ content: $t('toast.copied') })
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<MenuDivider>
|
|
||||||
{$t('post.actions.more.actions')}
|
|
||||||
</MenuDivider>
|
|
||||||
{#if profile.current?.user && profile.current?.jwt && profile.current.user.local_user_view.person.id == post.creator.id}
|
{#if profile.current?.user && profile.current?.jwt && profile.current.user.local_user_view.person.id == post.creator.id}
|
||||||
<MenuButton onclick={() => (editing = true)}>
|
<MenuButton onclick={() => (editing = true)}>
|
||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
@@ -65,52 +72,52 @@
|
|||||||
: $t('post.actions.more.markRead')}
|
: $t('post.actions.more.markRead')}
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
{/if}
|
{/if}
|
||||||
<MenuButton
|
<div class="flex flex-row">
|
||||||
onclick={() => {
|
<MenuButton
|
||||||
if (navigator.share)
|
onclick={() => share()}
|
||||||
navigator.share?.({
|
class={['flex-1', !post.post.local && 'rounded-r-xl']}
|
||||||
url: localShare
|
>
|
||||||
? `${instanceToURL(profile.current.instance)}/post/${post.post.id}`
|
{#snippet prefix()}
|
||||||
: post.post.ap_id,
|
<Icon src={Share} size="16" micro />
|
||||||
})
|
{/snippet}
|
||||||
else
|
{$t('post.actions.more.share')}
|
||||||
navigator.clipboard.writeText(
|
</MenuButton>
|
||||||
localShare
|
<!--svelte-ignore a11y_no_static_element_interactions -->
|
||||||
? `${instanceToURL(profile.current.instance)}/post/${post.post.id}`
|
<!--svelte-ignore a11y_click_events_have_key_events-->
|
||||||
: post.post.ap_id,
|
<div
|
||||||
)
|
class="aspect-square w-max m-1 grid place-items-center text-slate-600 dark:text-zinc-400"
|
||||||
toast({ content: $t('toast.copied') })
|
onclick={e => e.stopPropagation()}
|
||||||
}}
|
>
|
||||||
class="flex-1 py-0!"
|
{#if !post.post.local}
|
||||||
>
|
<Menu>
|
||||||
{#snippet prefix()}
|
{#snippet target()}
|
||||||
<Icon src={Share} size="16" micro />
|
<Button
|
||||||
{/snippet}
|
aria-label={$t('post.actions.more.label')}
|
||||||
{$t('post.actions.more.share')}
|
color="tertiary"
|
||||||
<div class="flex-1"></div>
|
size="custom"
|
||||||
{#if !post.post.local}
|
class="w-full h-full"
|
||||||
<div class="flex gap-1">
|
>
|
||||||
<Button
|
{#snippet prefix()}
|
||||||
color={!localShare ? 'primary' : 'secondary'}
|
<Icon src={EllipsisHorizontal} size="16" micro />
|
||||||
size="square-sm"
|
{/snippet}
|
||||||
rounding="pill"
|
</Button>
|
||||||
onclick={() => (localShare = false)}
|
{/snippet}
|
||||||
title={$t('filter.location.global')}
|
<MenuButton onclick={() => share(true)}>
|
||||||
>
|
{#snippet prefix()}
|
||||||
<Icon src={GlobeAmericas} size="16" micro />
|
<Icon src={GlobeAlt} size="16" micro />
|
||||||
</Button>
|
{/snippet}
|
||||||
<Button
|
{$t('filter.location.global')}
|
||||||
color={localShare ? 'primary' : 'secondary'}
|
</MenuButton>
|
||||||
size="square-sm"
|
<MenuButton onclick={() => share(false)}>
|
||||||
rounding="pill"
|
{#snippet prefix()}
|
||||||
onclick={() => (localShare = true)}
|
<Icon src={MapPin} size="16" micro />
|
||||||
title={$t('filter.location.local')}
|
{/snippet}
|
||||||
>
|
{$t('filter.location.local')}
|
||||||
<Icon src={MapPin} size="16" micro />
|
</MenuButton>
|
||||||
</Button>
|
</Menu>
|
||||||
</div>
|
{/if}
|
||||||
{/if}
|
</div>
|
||||||
</MenuButton>
|
</div>
|
||||||
{#if profile.current?.jwt}
|
{#if profile.current?.jwt}
|
||||||
<MenuButton
|
<MenuButton
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { parseURL } from '$lib/components/input/Link.svelte'
|
import { parseURL } from '$lib/components/input/Link.svelte'
|
||||||
import type { View } from '$lib/settings.svelte'
|
import type { View } from '$lib/settings.svelte'
|
||||||
import { Button, Material } from 'mono-svelte'
|
import { Material } from 'mono-svelte'
|
||||||
import { optimizeImageURL } from '../helpers'
|
import { optimizeImageURL } from '../helpers'
|
||||||
|
import { Icon, Link } from 'svelte-hero-icons'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
url: string
|
url: string
|
||||||
@@ -89,23 +90,20 @@
|
|||||||
</Material>
|
</Material>
|
||||||
</a>
|
</a>
|
||||||
{:else}
|
{:else}
|
||||||
<Button
|
<a
|
||||||
href={url}
|
href={url}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
class="text-slate-900 dark:text-zinc-300 items-center
|
class="flex flex-row text-slate-900 dark:text-zinc-400 items-center overflow-hidden group/link hover:underline space-x-1 my-1"
|
||||||
text-xs overflow-hidden max-w-full block shrink self-start w-max"
|
|
||||||
size="xs"
|
|
||||||
color="ghost"
|
|
||||||
rounding="pill"
|
|
||||||
>
|
>
|
||||||
|
<Icon src={Link} size="16" micro class="shrink-0" />
|
||||||
{#if richURL}
|
{#if richURL}
|
||||||
<div
|
<div
|
||||||
class="flex max-w-full overflow-hidden font-medium self-start justify-self-start w-max"
|
class="flex max-w-full overflow-hidden font-medium self-start justify-self-start w-max text-sm"
|
||||||
>
|
>
|
||||||
{richURL.hostname}
|
{richURL.hostname}
|
||||||
{#if richURL.pathname != '/'}
|
{#if richURL.pathname != '/'}
|
||||||
<span
|
<span
|
||||||
class="text-slate-500 dark:text-zinc-500 whitespace-nowrap font-normal"
|
class="text-slate-500 dark:text-zinc-500 whitespace-nowrap font-normal group-hover/link:opacity-100 opacity-0 transition-opacity duration-100"
|
||||||
>
|
>
|
||||||
{richURL.pathname}
|
{richURL.pathname}
|
||||||
</span>
|
</span>
|
||||||
@@ -114,5 +112,5 @@
|
|||||||
{:else}
|
{:else}
|
||||||
{url}
|
{url}
|
||||||
{/if}
|
{/if}
|
||||||
</Button>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -58,8 +58,8 @@
|
|||||||
let {
|
let {
|
||||||
elevation = 'flat',
|
elevation = 'flat',
|
||||||
padding = 'md',
|
padding = 'md',
|
||||||
rounding = 'lg',
|
rounding = 'xl',
|
||||||
color = 'default',
|
color = 'uniform',
|
||||||
element = 'div',
|
element = 'div',
|
||||||
class: clazz = '',
|
class: clazz = '',
|
||||||
children,
|
children,
|
||||||
|
|||||||
@@ -49,12 +49,10 @@
|
|||||||
>
|
>
|
||||||
{#snippet popover()}
|
{#snippet popover()}
|
||||||
<div
|
<div
|
||||||
class="w-full max-w-[280px] origin-top-left
|
class="w-full max-w-sm origin-top-left max-h-128 overflow-auto list-none shadow-lg rounded-2xl"
|
||||||
max-h-128 overflow-auto list-none shadow-lg rounded-2xl"
|
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="flex flex-col py-2 list-none bg-white/80 dark:bg-zinc-900/90 px-2 gap-px
|
class="flex flex-col px-0 list-none bg-white/80 dark:bg-zinc-900/90 gap-px rounded-2xl
|
||||||
rounded-2xl
|
|
||||||
border border-slate-300 dark:border-zinc-800 border-opacity-50"
|
border border-slate-300 dark:border-zinc-800 border-opacity-50"
|
||||||
>
|
>
|
||||||
{@render children?.(open)}
|
{@render children?.(open)}
|
||||||
|
|||||||
@@ -37,9 +37,10 @@
|
|||||||
<Button
|
<Button
|
||||||
{...rest}
|
{...rest}
|
||||||
{color}
|
{color}
|
||||||
|
size="custom"
|
||||||
rounding="none"
|
rounding="none"
|
||||||
class={[
|
class={[
|
||||||
'w-full px-2 rounded-lg min-h-8 font-normal duration-100',
|
'w-full px-4 py-2 min-h-7 font-normal duration-100',
|
||||||
disabled && 'opacity-70 pointer-events-none cursor-not-allowed',
|
disabled && 'opacity-70 pointer-events-none cursor-not-allowed',
|
||||||
color == 'tertiary' && 'dark:hover:bg-zinc-800/70',
|
color == 'tertiary' && 'dark:hover:bg-zinc-800/70',
|
||||||
clazz,
|
clazz,
|
||||||
@@ -53,7 +54,7 @@
|
|||||||
<div
|
<div
|
||||||
class={[
|
class={[
|
||||||
'contents shrink-0',
|
'contents shrink-0',
|
||||||
color == 'tertiary' && 'text-slate-600 dark:text-zinc-400',
|
color == 'tertiary' && 'text-slate-500 dark:text-zinc-500',
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
{#if icon}
|
{#if icon}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="text-slate-800 dark:text-zinc-200 text-xs font-medium py-2 px-2 flex items-center gap-1"
|
class="text-slate-800 dark:text-zinc-200 text-xs font-medium m-4 mb-1 flex items-center gap-1"
|
||||||
>
|
>
|
||||||
<div>{@render children?.()}</div>
|
<div>{@render children?.()}</div>
|
||||||
<hr
|
<hr
|
||||||
|
|||||||
@@ -134,7 +134,12 @@
|
|||||||
{#if open}
|
{#if open}
|
||||||
<Portal class="z-150">
|
<Portal class="z-150">
|
||||||
<div
|
<div
|
||||||
transition:scale={{ duration: 300, start: 0.97, easing: expoOut }}
|
transition:scale={{
|
||||||
|
duration: 175,
|
||||||
|
start: 0.95,
|
||||||
|
opacity: 0,
|
||||||
|
easing: expoOut,
|
||||||
|
}}
|
||||||
class="z-150 {popoverClass}"
|
class="z-150 {popoverClass}"
|
||||||
use:customFloatingContent
|
use:customFloatingContent
|
||||||
use:focusTrap
|
use:focusTrap
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
|
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||||
|
|
||||||
|
let { children } = $props()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Header pageHeader>Instances</Header>
|
||||||
|
<div
|
||||||
|
class="mt-4 mb-2 z-30 mx-auto max-w-full flex gap-2 md:flex-row flex-col
|
||||||
|
items-center px-2 w-max top-6 lg:top-22"
|
||||||
|
>
|
||||||
|
<Tabs
|
||||||
|
routes={[
|
||||||
|
{
|
||||||
|
href: '/instances/linked',
|
||||||
|
name: 'Linked',
|
||||||
|
},
|
||||||
|
{ href: '/instances/blocked', name: 'Blocked' },
|
||||||
|
]}
|
||||||
|
></Tabs>
|
||||||
|
</div>
|
||||||
|
<div class="h-3 sm:h-6"></div>
|
||||||
|
{@render children?.()}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import { getClient } from '$lib/lemmy.svelte.js'
|
||||||
|
|
||||||
|
export async function load({ fetch }) {
|
||||||
|
return (await getClient(undefined, fetch).getFederatedInstances())
|
||||||
|
.federated_instances
|
||||||
|
}
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
|
||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
|
||||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
|
||||||
import { publishedToDate } from '$lib/components/util/date.js'
|
|
||||||
import { Material, Popover } from 'mono-svelte'
|
|
||||||
import { Check, Icon, InformationCircle } from 'svelte-hero-icons'
|
|
||||||
|
|
||||||
let { data } = $props()
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<Header pageHeader>Linked Instances</Header>
|
|
||||||
{#if data}
|
|
||||||
<div class="flex flex-col md:flex-row gap-4">
|
|
||||||
<div class="flex-1 w-full max-h-168 h-full flex flex-col gap-2">
|
|
||||||
<h2 class="font-bold text-xl flex flex-row items-center gap-1">
|
|
||||||
Linked
|
|
||||||
<Popover openOnHover>
|
|
||||||
{#snippet target()}
|
|
||||||
<Icon src={InformationCircle} mini size="20" />
|
|
||||||
{/snippet}
|
|
||||||
<p class="font-normal">
|
|
||||||
These are the instances your instance can see and interact with
|
|
||||||
content from.
|
|
||||||
</p>
|
|
||||||
</Popover>
|
|
||||||
</h2>
|
|
||||||
<Material
|
|
||||||
class="h-full overflow-auto divide-y *:py-3 divide-slate-200 dark:divide-zinc-800"
|
|
||||||
color="distinct"
|
|
||||||
>
|
|
||||||
{#if data.linked && data.linked.length > 0}
|
|
||||||
{#each data.linked?.sort((b, a) => b.id - a.id) as instance (instance.id)}
|
|
||||||
<div class="flex justify-between items-center first:pt-0 last:pb-0">
|
|
||||||
<div class="flex flex-col">
|
|
||||||
<span class="font-medium">{instance.domain}</span>
|
|
||||||
<span
|
|
||||||
class="text-xs text-slate-600 dark:text-zinc-400 capitalize"
|
|
||||||
>
|
|
||||||
{instance.software ?? 'Unknown'} • <RelativeDate
|
|
||||||
date={publishedToDate(instance.published)}
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/each}
|
|
||||||
{:else}
|
|
||||||
<Placeholder
|
|
||||||
icon={Check}
|
|
||||||
title="No linked instances"
|
|
||||||
description="This instance likely has federation disabled."
|
|
||||||
/>
|
|
||||||
{/if}
|
|
||||||
</Material>
|
|
||||||
</div>
|
|
||||||
<div class="flex-1 w-full max-h-168 h-full flex flex-col gap-2">
|
|
||||||
<h2 class="font-bold text-xl flex flex-row items-center gap-1">
|
|
||||||
Blocked
|
|
||||||
|
|
||||||
<Popover openOnHover placement="bottom">
|
|
||||||
{#snippet target()}
|
|
||||||
<Icon src={InformationCircle} mini size="20" />
|
|
||||||
{/snippet}
|
|
||||||
<p class="font-normal">
|
|
||||||
These are the instances your instance is explicitly blocking content
|
|
||||||
from.
|
|
||||||
</p>
|
|
||||||
</Popover>
|
|
||||||
</h2>
|
|
||||||
<Material
|
|
||||||
class="h-full overflow-auto divide-y *:py-3 divide-slate-200 dark:divide-zinc-800"
|
|
||||||
color="distinct"
|
|
||||||
>
|
|
||||||
{#if data.blocked && data.blocked.length > 0}
|
|
||||||
{#each data.blocked?.sort((b, a) => b.id - a.id) as instance (instance.id)}
|
|
||||||
<div class="flex justify-between items-center first:pt-0 last:pb-0">
|
|
||||||
<div class="flex flex-col">
|
|
||||||
<span class="font-medium">{instance.domain}</span>
|
|
||||||
<span
|
|
||||||
class="text-xs text-slate-600 dark:text-zinc-400 capitalize"
|
|
||||||
>
|
|
||||||
{instance.software ?? 'Unknown'} • <RelativeDate
|
|
||||||
date={publishedToDate(instance.published)}
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/each}
|
|
||||||
{:else}
|
|
||||||
<Placeholder
|
|
||||||
icon={Check}
|
|
||||||
title="No blocked instances"
|
|
||||||
description="Blocking an instance will hide submissions from that instance."
|
|
||||||
/>
|
|
||||||
{/if}
|
|
||||||
</Material>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import { getClient } from '$lib/lemmy.svelte.js'
|
import { redirect } from '@sveltejs/kit'
|
||||||
|
|
||||||
export async function load({ fetch }) {
|
export function load() {
|
||||||
return (await getClient(undefined, fetch).getFederatedInstances())
|
redirect(302, '/instances/linked')
|
||||||
.federated_instances
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import VirtualList from '$lib/components/render/VirtualList.svelte'
|
||||||
|
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||||
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
|
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||||
|
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||||
|
import { publishedToDate } from '$lib/components/util/date.js'
|
||||||
|
import { Material, Popover } from 'mono-svelte'
|
||||||
|
import { Check, Icon, InformationCircle } from 'svelte-hero-icons'
|
||||||
|
|
||||||
|
let { data } = $props()
|
||||||
|
</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 justify-between items-center first:pt-0 last:pb-0 my-3"
|
||||||
|
>
|
||||||
|
<div class="flex flex-col">
|
||||||
|
<span class="font-medium">{data.linked[index].domain}</span>
|
||||||
|
<span
|
||||||
|
class="text-xs text-slate-600 dark:text-zinc-400 capitalize"
|
||||||
|
>
|
||||||
|
{data.linked[index].software ?? 'Unknown'} • <RelativeDate
|
||||||
|
date={publishedToDate(data.linked[index].published)}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/snippet}
|
||||||
|
</VirtualList>
|
||||||
|
{:else}
|
||||||
|
<Placeholder
|
||||||
|
icon={Check}
|
||||||
|
title="No linked instances"
|
||||||
|
description="This instance likely has federation disabled."
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
</Material>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
Reference in new issue
Block a user