design: improve instances page
This commit is contained in:
5 files changed
+111
-20
No files matched your search
Vendored
+2
-1
@@ -2,5 +2,6 @@
|
|||||||
"i18n-ally.localesPaths": [
|
"i18n-ally.localesPaths": [
|
||||||
"src/lib/i18n",
|
"src/lib/i18n",
|
||||||
"src/routes/inbox/messages"
|
"src/routes/inbox/messages"
|
||||||
]
|
],
|
||||||
|
"i18n-ally.keystyle": "nested"
|
||||||
}
|
}
|
||||||
@@ -4,12 +4,12 @@
|
|||||||
import CommunityItem from '$lib/components/lemmy/community/CommunityItem.svelte'
|
import CommunityItem from '$lib/components/lemmy/community/CommunityItem.svelte'
|
||||||
import Location from '$lib/components/lemmy/dropdowns/Location.svelte'
|
import Location from '$lib/components/lemmy/dropdowns/Location.svelte'
|
||||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.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 Skeleton from '$lib/components/ui/generic/Skeleton.svelte'
|
||||||
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||||
import Placeholder from '$lib/components/ui/Placeholder.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 { t } from '$lib/i18n/translations.js'
|
||||||
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
|
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
|
||||||
import { Material, Option } from 'mono-svelte'
|
import { Material, Option } from 'mono-svelte'
|
||||||
@@ -17,7 +17,6 @@
|
|||||||
import { expoOut } from 'svelte/easing'
|
import { expoOut } from 'svelte/easing'
|
||||||
import { fly } from 'svelte/transition'
|
import { fly } from 'svelte/transition'
|
||||||
import SearchBar from '../search/SearchBar.svelte'
|
import SearchBar from '../search/SearchBar.svelte'
|
||||||
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
|
||||||
|
|
||||||
let { data } = $props()
|
let { data } = $props()
|
||||||
|
|
||||||
@@ -44,8 +43,8 @@
|
|||||||
|
|
||||||
<Header pageHeader class="justify-between">
|
<Header pageHeader class="justify-between">
|
||||||
<span>{$t('routes.communities.title')}</span>
|
<span>{$t('routes.communities.title')}</span>
|
||||||
</Header>
|
|
||||||
|
|
||||||
|
{#snippet extended()}
|
||||||
<form method="get" action="/communities" class="contents" bind:this={form}>
|
<form method="get" action="/communities" class="contents" bind:this={form}>
|
||||||
<SearchBar bind:query={search} />
|
<SearchBar bind:query={search} />
|
||||||
|
|
||||||
@@ -79,8 +78,11 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
{/snippet}
|
||||||
|
</Header>
|
||||||
|
|
||||||
{#if navigating.to?.route.id == '/communities'}
|
{#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}
|
{#each new Array(5) as _, index}
|
||||||
{_}
|
{_}
|
||||||
<div
|
<div
|
||||||
@@ -107,7 +109,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if showTop}
|
{#if showTop}
|
||||||
<EndPlaceholder size="lg" margin="lg">
|
<EndPlaceholder size="lg" margin="md">
|
||||||
{$t('routes.search.top')}
|
{$t('routes.search.top')}
|
||||||
</EndPlaceholder>
|
</EndPlaceholder>
|
||||||
<div
|
<div
|
||||||
@@ -137,7 +139,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if data.communities.value.slice(showTop ? 3 : 0).length > 0}
|
{#if data.communities.value.slice(showTop ? 3 : 0).length > 0}
|
||||||
<EndPlaceholder size="lg" margin="lg">
|
<EndPlaceholder size="lg" margin="md">
|
||||||
{$t('routes.search.other')}
|
{$t('routes.search.other')}
|
||||||
</EndPlaceholder>
|
</EndPlaceholder>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
let { children } = $props()
|
let { children } = $props()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header pageHeader>Instances</Header>
|
|
||||||
<Tabs
|
<Tabs
|
||||||
routes={[
|
routes={[
|
||||||
{
|
{
|
||||||
@@ -15,4 +14,5 @@
|
|||||||
{ href: '/instances/blocked', name: 'Blocked' },
|
{ href: '/instances/blocked', name: 'Blocked' },
|
||||||
]}
|
]}
|
||||||
></Tabs>
|
></Tabs>
|
||||||
|
<Header pageHeader>Instances</Header>
|
||||||
{@render children?.()}
|
{@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 Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||||
import { publishedToDate } from '$lib/components/util/date.js'
|
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'
|
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>
|
</script>
|
||||||
|
|
||||||
{#if data}
|
{#if data}
|
||||||
<div class="flex flex-col md:flex-row gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<Material
|
<form onsubmit={() => triggerFilter(filter)}>
|
||||||
class="h-full overflow-auto divide-y *:py-3 divide-slate-200 dark:divide-zinc-800 max-h-[48rem] w-full"
|
<TextInput label={$t('filter.filter')} bind:value={filter}></TextInput>
|
||||||
>
|
</form>
|
||||||
{#if data.linked && data.linked.length > 0}
|
{#if data.linked && data.linked.length > 0}
|
||||||
|
{#if loading}
|
||||||
|
<Spinner />
|
||||||
|
{/if}
|
||||||
<VirtualList
|
<VirtualList
|
||||||
useWindow={false}
|
|
||||||
items={data.linked}
|
items={data.linked}
|
||||||
height={473}
|
useWindow={false}
|
||||||
estimatedHeight={100}
|
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)}
|
{#snippet item(index)}
|
||||||
|
{#if data.linked[index]}
|
||||||
<div
|
<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">
|
<div class="flex flex-col">
|
||||||
<span class="font-medium">{data.linked[index].domain}</span>
|
<span class="font-medium">{data.linked[index].domain}</span>
|
||||||
@@ -36,15 +55,15 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
{/snippet}
|
{/snippet}
|
||||||
</VirtualList>
|
</VirtualList>
|
||||||
{:else}
|
{:else}
|
||||||
<Placeholder
|
<Placeholder
|
||||||
icon={Check}
|
icon={Check}
|
||||||
title="No linked instances"
|
title="No linked instances"
|
||||||
description="This instance likely has federation disabled."
|
description="This instance doesn't block any others."
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
</Material>
|
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
Reference in new issue
Block a user