design: improve menus
This commit is contained in:
14 files changed
+177
-192
No files matched your search
@@ -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 }) {
|
||||
return (await getClient(undefined, fetch).getFederatedInstances())
|
||||
.federated_instances
|
||||
export function load() {
|
||||
redirect(302, '/instances/linked')
|
||||
}
|
||||
@@ -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