design: use CommonList component
This commit is contained in:
14 files changed
+134
-164
No files matched your search
@@ -29,7 +29,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Material
|
<Material
|
||||||
class={['flex flex-col flex-1 rounded-none py-4 list-none', clazz]}
|
class={['flex flex-col flex-1 rounded-none list-none', clazz]}
|
||||||
color="none"
|
color="none"
|
||||||
padding="none"
|
padding="none"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
community = $bindable(),
|
community = $bindable(),
|
||||||
view = 'compact',
|
view = 'compact',
|
||||||
showCounts = true,
|
showCounts = true,
|
||||||
class: clazz = 'py-4 flex flex-col gap-4 text-sm max-w-full relative',
|
class: clazz = 'flex flex-col gap-4 text-sm max-w-full relative',
|
||||||
icon,
|
icon,
|
||||||
children,
|
children,
|
||||||
}: Props = $props()
|
}: Props = $props()
|
||||||
@@ -51,10 +51,10 @@
|
|||||||
|
|
||||||
<div class={clazz}>
|
<div class={clazz}>
|
||||||
<div
|
<div
|
||||||
class="flex
|
class={[
|
||||||
{view == 'cozy'
|
view == 'cozy' ? 'flex-col gap-2 items-center' : 'flex-row',
|
||||||
? 'flex-col gap-2 items-center'
|
'flex max-w-full w-full',
|
||||||
: 'flex-row'} max-w-full w-full"
|
]}
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
href="/c/{fullCommunityName(
|
href="/c/{fullCommunityName(
|
||||||
@@ -70,11 +70,12 @@
|
|||||||
: 'flex-row'} gap-2 items-center"
|
: 'flex-row'} gap-2 items-center"
|
||||||
>
|
>
|
||||||
{#if icon}{@render icon()}{:else if community.community.nsfw && settings.nsfwBlur}
|
{#if icon}{@render icon()}{:else if community.community.nsfw && settings.nsfwBlur}
|
||||||
<div class="w-8 h-8 rounded-full bg-red-400"></div>
|
<div class="w-8 h-8 rounded-xl bg-red-400"></div>
|
||||||
{:else}
|
{:else}
|
||||||
<Avatar
|
<Avatar
|
||||||
url={community.community.icon}
|
url={community.community.icon}
|
||||||
width={32}
|
width={32}
|
||||||
|
circle={false}
|
||||||
alt={community.community.name}
|
alt={community.community.name}
|
||||||
class={[
|
class={[
|
||||||
community.community.nsfw && settings.nsfwBlur && 'blur-3xl',
|
community.community.nsfw && settings.nsfwBlur && 'blur-3xl',
|
||||||
@@ -154,6 +155,7 @@
|
|||||||
</Button>
|
</Button>
|
||||||
<Subscribe {community}>
|
<Subscribe {community}>
|
||||||
{#snippet children({ subscribe, subscribing })}
|
{#snippet children({ subscribe, subscribing })}
|
||||||
|
{@const subscribed = isSubscribed(community.subscribed)}
|
||||||
<Button
|
<Button
|
||||||
disabled={subscribing || !profile.current?.jwt}
|
disabled={subscribing || !profile.current?.jwt}
|
||||||
loading={subscribing}
|
loading={subscribing}
|
||||||
@@ -174,26 +176,24 @@
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
size="custom"
|
size="custom"
|
||||||
title={isSubscribed(community.subscribed)
|
title={subscribed
|
||||||
? $t('cards.community.subscribed')
|
? $t('cards.community.subscribed')
|
||||||
: $t('cards.community.subscribe')}
|
: $t('cards.community.subscribe')}
|
||||||
color={isSubscribed(community.subscribed)
|
color={subscribed ? 'secondary' : 'primary'}
|
||||||
? 'secondary'
|
rounding="pill"
|
||||||
: 'primary'}
|
class={[
|
||||||
class="{isSubscribed(community.subscribed)
|
subscribed && 'text-slate-600 dark:text-zinc-400',
|
||||||
? 'text-slate-600 dark:text-zinc-400'
|
' h-8.5 rounded-full',
|
||||||
: ''}
|
view == 'compact'
|
||||||
aspect-square h-8.5 @md:px-2 @md:min-w-30 @md:aspect-auto @md:rounded-full"
|
? 'aspect-square @md:px-2 @md:min-w-30 @md:aspect-auto'
|
||||||
|
: 'px-3',
|
||||||
|
]}
|
||||||
>
|
>
|
||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
<Icon
|
<Icon src={subscribed ? Check : Plus} size="16" micro />
|
||||||
src={isSubscribed(community.subscribed) ? Check : Plus}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
/>
|
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<span class="hidden @md:block">
|
<span class={[view == 'compact' && 'hidden', '@md:block']}>
|
||||||
{#if isSubscribed(community.subscribed)}
|
{#if subscribed}
|
||||||
{$t('cards.community.subscribed')}
|
{$t('cards.community.subscribed')}
|
||||||
{:else}
|
{:else}
|
||||||
{$t('cards.community.subscribe')}
|
{$t('cards.community.subscribe')}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import type { PostView } from 'lemmy-js-client'
|
||||||
|
import Post from './Post.svelte'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
post: PostView
|
||||||
|
}
|
||||||
|
|
||||||
|
let { post } = $props()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Post {post} class="py-0!" />
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
user,
|
user,
|
||||||
view = 'compact',
|
view = 'compact',
|
||||||
showCounts = true,
|
showCounts = true,
|
||||||
class: clazz = 'py-4 flex flex-col gap-4 text-sm max-w-full relative',
|
class: clazz = 'flex flex-col gap-4 text-sm max-w-full relative',
|
||||||
icon,
|
icon,
|
||||||
}: Props = $props()
|
}: Props = $props()
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<script lang="ts" generics="T">
|
||||||
|
import type { Snippet } from 'svelte'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
items: T[]
|
||||||
|
item: Snippet<[T, number]>
|
||||||
|
}
|
||||||
|
|
||||||
|
let { items, item: itemSnippet }: Props = $props()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<ul class="divide-y">
|
||||||
|
{#each items as item, index}
|
||||||
|
<li
|
||||||
|
class={[
|
||||||
|
'py-3 px-4',
|
||||||
|
'hover:bg-slate-100 dark:hover:bg-zinc-900/25 transition-colors',
|
||||||
|
'@container border-slate-100 dark:border-zinc-900',
|
||||||
|
'bg-slate-50 dark:bg-zinc-950 first:rounded-t-2xl last:rounded-b-2xl',
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
{@render itemSnippet(item, index)}
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
transparent:
|
transparent:
|
||||||
'border border-slate-200 dark:border-zinc-900 border-b-slate-300 dark:border-t-zinc-800',
|
'border border-slate-200 dark:border-zinc-900 border-b-slate-300 dark:border-t-zinc-800',
|
||||||
uniform:
|
uniform:
|
||||||
'bg-white dark:bg-zinc-900 border border-slate-100 dark:border-zinc-800',
|
'bg-white dark:bg-zinc-950 border border-slate-100 dark:border-zinc-900',
|
||||||
none: '',
|
none: '',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
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 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 Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||||
@@ -103,7 +104,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<ul
|
<ul
|
||||||
class="flex flex-col divide-y divide-slate-100 dark:divide-zinc-800 my-6 h-full"
|
class="flex flex-col divide-y-2 divide-slate-100 dark:divide-zinc-800 my-6 h-full"
|
||||||
>
|
>
|
||||||
{#if data.communities.value.length == 0}
|
{#if data.communities.value.length == 0}
|
||||||
<Placeholder
|
<Placeholder
|
||||||
@@ -130,12 +131,7 @@
|
|||||||
y: 16,
|
y: 16,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Material
|
<Material color="uniform" padding="none" rounding="2xl">
|
||||||
color="distinct"
|
|
||||||
padding="none"
|
|
||||||
rounding="xl"
|
|
||||||
class="dark:border-t-zinc-800 h-full"
|
|
||||||
>
|
|
||||||
<CommunityItem
|
<CommunityItem
|
||||||
{community}
|
{community}
|
||||||
showCounts={false}
|
showCounts={false}
|
||||||
@@ -155,22 +151,11 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{#if data.communities.value}
|
{#if data.communities.value}
|
||||||
{@const sliced = data.communities.value.slice(showTop ? 3 : 0)}
|
{@const sliced = data.communities.value.slice(showTop ? 3 : 0)}
|
||||||
<div class="-mx-4 sm:-mx-6 h-full">
|
<CommonList items={sliced}>
|
||||||
{#each sliced as community, index (community.community.id)}
|
{#snippet item(community, index)}
|
||||||
<div
|
<CommunityItem {community} showCounts={false} />
|
||||||
class="px-6 hover:bg-slate-50 dark:hover:bg-zinc-900 transition-colors @container
|
{/snippet}
|
||||||
border-b border-slate-100 dark:border-zinc-900"
|
</CommonList>
|
||||||
in:fly|global={{
|
|
||||||
duration: 1000,
|
|
||||||
easing: expoOut,
|
|
||||||
delay: index < 20 ? index * 35 : 0,
|
|
||||||
y: 16,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<CommunityItem {community} showCounts={false} class="py-3" />
|
|
||||||
</div>
|
|
||||||
{/each}
|
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
</ul>
|
</ul>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { goto } from '$app/navigation'
|
import { goto } from '$app/navigation'
|
||||||
import { page } from '$app/state'
|
import { page } from '$app/state'
|
||||||
import { notifications, profile } from '$lib/auth.svelte.js'
|
import { notifications, profile } from '$lib/auth.svelte.js'
|
||||||
|
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 Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||||
@@ -10,8 +11,6 @@
|
|||||||
import { getClient } from '$lib/lemmy.svelte.js'
|
import { getClient } from '$lib/lemmy.svelte.js'
|
||||||
import { Button } from 'mono-svelte'
|
import { Button } from 'mono-svelte'
|
||||||
import { ArrowPath, Check, Icon, Inbox } from 'svelte-hero-icons'
|
import { ArrowPath, Check, Icon, Inbox } from 'svelte-hero-icons'
|
||||||
import { expoOut } from 'svelte/easing'
|
|
||||||
import { fly } from 'svelte/transition'
|
|
||||||
import InboxItem from './InboxItem.svelte'
|
import InboxItem from './InboxItem.svelte'
|
||||||
|
|
||||||
let { data } = $props()
|
let { data } = $props()
|
||||||
@@ -63,11 +62,10 @@
|
|||||||
<title>{$t('routes.inbox.title')}</title>
|
<title>{$t('routes.inbox.title')}</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<div class=" gap-2">
|
<div
|
||||||
<div
|
|
||||||
class="mt-4 mb-2 z-30 mx-auto max-w-full flex gap-2 md:flex-row flex-col
|
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"
|
items-center px-2 w-max top-6 lg:top-22"
|
||||||
>
|
>
|
||||||
<Tabs
|
<Tabs
|
||||||
routes={[
|
routes={[
|
||||||
{
|
{
|
||||||
@@ -112,8 +110,8 @@ items-center px-2 w-max top-6 lg:top-22"
|
|||||||
defaultRoute="?unreadOnly=true"
|
defaultRoute="?unreadOnly=true"
|
||||||
class="overflow-auto"
|
class="overflow-auto"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Header pageHeader class="lg:flex-row justify-between flex-col">
|
<Header pageHeader class="lg:flex-row justify-between flex-col">
|
||||||
{$t('routes.inbox.title')}
|
{$t('routes.inbox.title')}
|
||||||
|
|
||||||
<div class="flex items-center gap-2 tracking-normal">
|
<div class="flex items-center gap-2 tracking-normal">
|
||||||
@@ -141,39 +139,25 @@ items-center px-2 w-max top-6 lg:top-22"
|
|||||||
{$t('routes.inbox.markAsRead')}
|
{$t('routes.inbox.markAsRead')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</Header>
|
</Header>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
<div class="h-4 sm:h-6"></div>
|
||||||
class="flex flex-col list-none flex-1 h-full divide-y divide-slate-200 dark:divide-zinc-900 *:py-4"
|
|
||||||
>
|
{#if !data.inbox?.value || (data.inbox.value?.length ?? 0) == 0}
|
||||||
{#if !data.inbox?.value || (data.inbox.value?.length ?? 0) == 0}
|
|
||||||
<Placeholder
|
<Placeholder
|
||||||
icon={Inbox}
|
icon={Inbox}
|
||||||
title={$t('routes.inbox.empty.title')}
|
title={$t('routes.inbox.empty.title')}
|
||||||
description={$t('routes.inbox.empty.description')}
|
description={$t('routes.inbox.empty.description')}
|
||||||
class="self-center justify-self-center my-auto"
|
class="self-center justify-self-center my-auto"
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
{#each data.inbox.value as item, index}
|
<CommonList items={data.inbox.value}>
|
||||||
{#if item.creator.id != profile.current.user?.local_user_view.person.id}
|
{#snippet item(item)}
|
||||||
<div
|
<InboxItem {item} />
|
||||||
class="-mx-4 sm:-mx-6 px-4 sm:px-6
|
{/snippet}
|
||||||
{item.read ? '' : 'bg-blue-50/50 dark:bg-blue-500/5'}"
|
</CommonList>
|
||||||
in:fly|global={{
|
{/if}
|
||||||
duration: 1000,
|
{#if !(data.page == 1 && (data?.inbox?.value.length ?? 0) == 0)}
|
||||||
y: 16,
|
|
||||||
opacity: 0,
|
|
||||||
easing: expoOut,
|
|
||||||
delay: index * 50,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<InboxItem bind:item={data.inbox.value[index]} />
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{/each}
|
|
||||||
{/if}
|
|
||||||
{#if !(data.page == 1 && (data?.inbox?.value.length ?? 0) == 0)}
|
|
||||||
<div
|
<div
|
||||||
class="sticky z-30 mx-auto max-w-full self-end mt-auto bottom-22 lg:bottom-6"
|
class="sticky z-30 mx-auto max-w-full self-end mt-auto bottom-22 lg:bottom-6"
|
||||||
>
|
>
|
||||||
@@ -187,5 +171,4 @@ items-center px-2 w-max top-6 lg:top-22"
|
|||||||
/>
|
/>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
|
||||||
@@ -65,12 +65,7 @@
|
|||||||
<Expandable open icon={false}>
|
<Expandable open icon={false}>
|
||||||
{#snippet title()}
|
{#snippet title()}
|
||||||
<div class="flex flex-row gap-2 items-center w-full">
|
<div class="flex flex-row gap-2 items-center w-full">
|
||||||
<Avatar
|
<Avatar url={item.creator.avatar} width={28} alt={item.creator.name} />
|
||||||
url={item.creator.avatar}
|
|
||||||
circle={false}
|
|
||||||
width={28}
|
|
||||||
alt={item.creator.name}
|
|
||||||
/>
|
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<div class="text-sm font-normal text-slate-600 dark:text-zinc-400">
|
<div class="text-sm font-normal text-slate-600 dark:text-zinc-400">
|
||||||
{#if item.type == 'comment_reply'}
|
{#if item.type == 'comment_reply'}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { goto } from '$app/navigation'
|
import { goto } from '$app/navigation'
|
||||||
import { page } from '$app/state'
|
import { page } from '$app/state'
|
||||||
|
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.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 Placeholder from '$lib/components/ui/Placeholder.svelte'
|
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||||
import ProgressBar from '$lib/components/ui/ProgressBar.svelte'
|
import ProgressBar from '$lib/components/ui/ProgressBar.svelte'
|
||||||
import { t } from '$lib/i18n/translations'
|
import { t } from '$lib/i18n/translations'
|
||||||
@@ -11,10 +14,7 @@
|
|||||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||||
import { tick } from 'svelte'
|
import { tick } from 'svelte'
|
||||||
import { Check, Funnel, Icon, Inbox, XMark } from 'svelte-hero-icons'
|
import { Check, Funnel, Icon, Inbox, XMark } from 'svelte-hero-icons'
|
||||||
import { fly } from 'svelte/transition'
|
|
||||||
import Report from './Report.svelte'
|
import Report from './Report.svelte'
|
||||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
|
||||||
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
|
|
||||||
|
|
||||||
let { data = $bindable() } = $props()
|
let { data = $bindable() } = $props()
|
||||||
|
|
||||||
@@ -133,14 +133,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<ProgressBar progress={batch.progress} />
|
<ProgressBar progress={batch.progress} />
|
||||||
{#if data.items?.value && data.items?.value.length > 0}
|
{#if data.items?.value && data.items?.value.length > 0}
|
||||||
<div
|
<CommonList items={data.items?.value}>
|
||||||
class="flex flex-col *:py-4 divide-y divide-slate-200 dark:divide-zinc-800"
|
{#snippet item(item)}
|
||||||
>
|
|
||||||
{#each data.items?.value as item}
|
|
||||||
<div
|
|
||||||
in:fly={{ y: -6, opacity: 0, duration: 500 }}
|
|
||||||
class="flex flex-col gap-3 text-sm -mx-4 sm:-mx-6 px-4 sm:px-6 items-center"
|
|
||||||
>
|
|
||||||
<Material
|
<Material
|
||||||
rounding={item.length == 1 ? 'none' : '2xl'}
|
rounding={item.length == 1 ? 'none' : '2xl'}
|
||||||
color={item.length == 1 ? 'none' : 'uniform'}
|
color={item.length == 1 ? 'none' : 'uniform'}
|
||||||
@@ -157,9 +151,8 @@
|
|||||||
class="-mt-3 rounded-b-2xl w-[95%] h-4 bg-slate-50! dark:bg-zinc-950!"
|
class="-mt-3 rounded-b-2xl w-[95%] h-4 bg-slate-50! dark:bg-zinc-950!"
|
||||||
></Material>
|
></Material>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
{/snippet}
|
||||||
{/each}
|
</CommonList>
|
||||||
</div>
|
|
||||||
<Pageination
|
<Pageination
|
||||||
page={data.page}
|
page={data.page}
|
||||||
href={current => `?page=${current}`}
|
href={current => `?page=${current}`}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
import { errorMessage } from '$lib/lemmy/error'
|
import { errorMessage } from '$lib/lemmy/error'
|
||||||
import type { ReportView } from '$lib/lemmy/report.js'
|
import type { ReportView } from '$lib/lemmy/report.js'
|
||||||
import { Badge, Button, Material, Modal, toast } from 'mono-svelte'
|
import { Badge, Button, Material, Modal, toast } from 'mono-svelte'
|
||||||
import { CheckCircle, Icon } from 'svelte-hero-icons'
|
import { CheckBadge, Icon } from 'svelte-hero-icons'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
item: ReportView[]
|
item: ReportView[]
|
||||||
@@ -170,20 +170,19 @@
|
|||||||
<div class="flex-1"></div>
|
<div class="flex-1"></div>
|
||||||
<Button
|
<Button
|
||||||
onclick={resolve}
|
onclick={resolve}
|
||||||
class="h-max self-end {item.resolved
|
class="h-max self-end"
|
||||||
? 'text-green-600! dark:text-green-400!'
|
|
||||||
: ''}"
|
|
||||||
loading={resolving}
|
loading={resolving}
|
||||||
disabled={resolving}
|
disabled={resolving}
|
||||||
rounding="pill"
|
rounding="pill"
|
||||||
color="ghost"
|
size="sm"
|
||||||
|
color={item.resolved ? 'secondary' : 'primary'}
|
||||||
>
|
>
|
||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
<Icon src={CheckCircle} micro={item.resolved} size="18" />
|
<Icon src={CheckBadge} micro size="16" />
|
||||||
{/snippet}
|
{/snippet}
|
||||||
{!item.resolved
|
{!item.resolved
|
||||||
? $t('routes.moderation.resolve')
|
? $t('routes.moderation.resolve')
|
||||||
: $t('routes.moderation.resolved')}
|
: $t('routes.moderation.unresolve')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { page } from '$app/state'
|
import { page } from '$app/state'
|
||||||
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
|
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
|
||||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
import PostItem from '$lib/components/lemmy/post/PostItem.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 Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||||
@@ -19,7 +20,6 @@
|
|||||||
Icon,
|
Icon,
|
||||||
PencilSquare,
|
PencilSquare,
|
||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import { fly } from 'svelte/transition'
|
|
||||||
|
|
||||||
let { data } = $props()
|
let { data } = $props()
|
||||||
|
|
||||||
@@ -61,27 +61,26 @@
|
|||||||
</div>
|
</div>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
</Header>
|
</Header>
|
||||||
<div
|
|
||||||
class="flex flex-col list-none my-4 divide-slate-200 dark:divide-zinc-800 divide-y"
|
<div class="h-4 sm:h-6"></div>
|
||||||
>
|
|
||||||
{#if !data.data || (data.data?.length ?? 0) == 0}
|
{#if !data.data || (data.data?.length ?? 0) == 0}
|
||||||
<Placeholder
|
<Placeholder
|
||||||
icon={Bookmark}
|
icon={Bookmark}
|
||||||
title="No saved items"
|
title="No saved items"
|
||||||
description="Save posts or comments, and they'll be here to refer to them later."
|
description="Save posts or comments, and they'll be here to refer to them later."
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
{#each data.data as item, index (item)}
|
<CommonList items={data.data}>
|
||||||
<div in:fly={{ opacity: 0, y: -4, delay: index * 50 }}>
|
{#snippet item(item)}
|
||||||
{#if isComment(item)}
|
{#if isComment(item)}
|
||||||
<CommentItem comment={item} />
|
<CommentItem comment={item} />
|
||||||
{:else}
|
{:else}
|
||||||
<Post post={item} />
|
<PostItem post={item} />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
{/snippet}
|
||||||
{/each}
|
</CommonList>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
|
||||||
<div class="sticky z-30 mx-auto max-w-full bottom-22 lg:bottom-6">
|
<div class="sticky z-30 mx-auto max-w-full bottom-22 lg:bottom-6">
|
||||||
<Tabs routes={[]} class="mx-auto">
|
<Tabs routes={[]} class="mx-auto">
|
||||||
<Pageination href={page => `?page=${page}`} page={data.page} />
|
<Pageination href={page => `?page=${page}`} page={data.page} />
|
||||||
|
|||||||
@@ -30,6 +30,8 @@
|
|||||||
import { expoOut } from 'svelte/easing'
|
import { expoOut } from 'svelte/easing'
|
||||||
import { fly, slide } from 'svelte/transition'
|
import { fly, slide } from 'svelte/transition'
|
||||||
import SearchBar from './SearchBar.svelte'
|
import SearchBar from './SearchBar.svelte'
|
||||||
|
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||||
|
import PostItem from '$lib/components/lemmy/post/PostItem.svelte'
|
||||||
|
|
||||||
let { data } = $props()
|
let { data } = $props()
|
||||||
|
|
||||||
@@ -54,7 +56,7 @@
|
|||||||
</Header>
|
</Header>
|
||||||
<form method="get" action="/search" class="contents" bind:this={form}>
|
<form method="get" action="/search" class="contents" bind:this={form}>
|
||||||
<SearchBar bind:query={data.filters.value.query} />
|
<SearchBar bind:query={data.filters.value.query} />
|
||||||
<div class="flex flex-row flex-wrap items-center gap-4 mt-4">
|
<div class="flex flex-row flex-wrap items-center gap-4 my-4 sm:my-6">
|
||||||
<Select
|
<Select
|
||||||
name="type"
|
name="type"
|
||||||
bind:value={data.filters.value.type}
|
bind:value={data.filters.value.type}
|
||||||
@@ -136,7 +138,7 @@
|
|||||||
{:else}
|
{:else}
|
||||||
{#await data.streamed.object}
|
{#await data.streamed.object}
|
||||||
<div
|
<div
|
||||||
class="flex gap-2 items-center mt-4"
|
class="flex gap-2 items-center my-4"
|
||||||
out:slide={{ axis: 'y', easing: expoOut }}
|
out:slide={{ axis: 'y', easing: expoOut }}
|
||||||
>
|
>
|
||||||
<Spinner width={24} />
|
<Spinner width={24} />
|
||||||
@@ -146,18 +148,10 @@
|
|||||||
{#if object}
|
{#if object}
|
||||||
<div
|
<div
|
||||||
transition:slide={{ axis: 'y', easing: expoOut }}
|
transition:slide={{ axis: 'y', easing: expoOut }}
|
||||||
class="divide-y divide-slate-200 dark:divide-zinc-900"
|
class="divide-y divide-slate-200 dark:divide-zinc-900 my-4"
|
||||||
>
|
>
|
||||||
{#if object.community}
|
{#if object.community}
|
||||||
<div
|
<CommunityItem community={object.community} showCounts={false} />
|
||||||
class="-mx-4 sm:-mx-6 px-6 hover:bg-slate-100 dark:hover:bg-zinc-800 transition-colors"
|
|
||||||
>
|
|
||||||
<CommunityItem
|
|
||||||
community={object.community}
|
|
||||||
showCounts={false}
|
|
||||||
class="py-3"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
{#if object.post}
|
{#if object.post}
|
||||||
<Post post={object.post} />
|
<Post post={object.post} />
|
||||||
@@ -171,31 +165,19 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{/await}
|
{/await}
|
||||||
<div
|
<CommonList items={data.results.value}>
|
||||||
class="flex flex-col mt-4 divide-slate-200 dark:divide-zinc-800 divide-y!"
|
{#snippet item(result)}
|
||||||
>
|
|
||||||
{#key data.results.value}
|
|
||||||
{#each data.results.value as result (result)}
|
|
||||||
{#if isPostView(result)}
|
{#if isPostView(result)}
|
||||||
<Post post={result} />
|
<PostItem post={result} />
|
||||||
{:else if isCommentView(result)}
|
{:else if isCommentView(result)}
|
||||||
<CommentItem comment={result} />
|
<CommentItem comment={result} />
|
||||||
{:else if isCommunityView(result)}
|
{:else if isCommunityView(result)}
|
||||||
<div
|
<CommunityItem community={result} showCounts={false} />
|
||||||
class="-mx-4 sm:-mx-6 px-6 hover:bg-slate-100 dark:hover:bg-zinc-800 transition-colors"
|
|
||||||
>
|
|
||||||
<CommunityItem community={result} showCounts={false} class="py-3" />
|
|
||||||
</div>
|
|
||||||
{:else if isUser(result)}
|
{:else if isUser(result)}
|
||||||
<div
|
<UserItem user={result} showCounts={false} />
|
||||||
class="-mx-4 sm:-mx-6 px-6 hover:bg-slate-100 dark:hover:bg-zinc-800 transition-colors"
|
|
||||||
>
|
|
||||||
<UserItem user={result} showCounts={false} class="py-3" />
|
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/snippet}
|
||||||
{/key}
|
</CommonList>
|
||||||
</div>
|
|
||||||
<div class="mt-4"></div>
|
<div class="mt-4"></div>
|
||||||
{#if data.results.value.length > 0}
|
{#if data.results.value.length > 0}
|
||||||
<Pageination
|
<Pageination
|
||||||
|
|||||||
@@ -6,10 +6,11 @@
|
|||||||
import ItemList from '$lib/components/lemmy/generic/ItemList.svelte'
|
import ItemList from '$lib/components/lemmy/generic/ItemList.svelte'
|
||||||
import { ban, isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
|
import { ban, isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
|
||||||
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
|
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
|
||||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
import PostItem from '$lib/components/lemmy/post/PostItem.svelte'
|
||||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||||
import EntityHeader from '$lib/components/ui/EntityHeader.svelte'
|
import EntityHeader from '$lib/components/ui/EntityHeader.svelte'
|
||||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
import Expandable from '$lib/components/ui/Expandable.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'
|
||||||
@@ -353,19 +354,15 @@
|
|||||||
description="This user has no submissions that match this filter."
|
description="This user has no submissions that match this filter."
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<div
|
<CommonList items={data.items.value}>
|
||||||
class="divide-y! divide-slate-200 dark:divide-zinc-800 flex flex-col"
|
{#snippet item(item)}
|
||||||
>
|
|
||||||
{#key data.items}
|
|
||||||
{#each data.items.value as item (item)}
|
|
||||||
{#if isCommentView(item)}
|
{#if isCommentView(item)}
|
||||||
<CommentItem comment={item} />
|
<CommentItem comment={item} />
|
||||||
{:else if !isCommentView(item)}
|
{:else if !isCommentView(item)}
|
||||||
<Post post={item} />
|
<PostItem post={item} />
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/snippet}
|
||||||
{/key}
|
</CommonList>
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
<Pageination
|
<Pageination
|
||||||
bind:page={data.filters.value.page}
|
bind:page={data.filters.value.page}
|
||||||
|
|||||||
Reference in new issue
Block a user