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