design: make modlog not look like buns in table view
This commit is contained in:
12 files changed
+193
-159
No files matched your search
+23
-23
@@ -3,23 +3,23 @@
|
|||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@dicebear/core": "^8.0.1",
|
"@dicebear/core": "^8.0.2",
|
||||||
"@dicebear/initials": "^8.0.1",
|
"@dicebear/initials": "^8.0.2",
|
||||||
"@eslint/compat": "^1.2.9",
|
"@eslint/compat": "^1.3.2",
|
||||||
"@eslint/js": "^9.28.0",
|
"@eslint/js": "^9.36.0",
|
||||||
"@svelte-put/qr": "^2.0.0",
|
"@svelte-put/qr": "^2.1.0",
|
||||||
"@sveltejs/adapter-auto": "^3.3.1",
|
"@sveltejs/adapter-auto": "^3.3.1",
|
||||||
"@sveltejs/adapter-node": "^5.2.9",
|
"@sveltejs/adapter-node": "^5.3.2",
|
||||||
"@sveltejs/adapter-static": "^3.0.8",
|
"@sveltejs/adapter-static": "^3.0.9",
|
||||||
"@sveltejs/kit": "^2.17.1",
|
"@sveltejs/kit": "^2.42.2",
|
||||||
"@sveltejs/vite-plugin-svelte": "^4.0.4",
|
"@sveltejs/vite-plugin-svelte": "^4.0.4",
|
||||||
"@tailwindcss/container-queries": "^0.1.1",
|
"@tailwindcss/container-queries": "^0.1.1",
|
||||||
"@tailwindcss/postcss": "^4.1.8",
|
"@tailwindcss/postcss": "^4.1.13",
|
||||||
"@types/nprogress": "^0.2.0",
|
"@types/nprogress": "^0.2.3",
|
||||||
"@types/ua-parser-js": "^0.7.39",
|
"@types/ua-parser-js": "^0.7.39",
|
||||||
"@xylightdev/svelte-hero-icons": "^2.2.7",
|
"@xylightdev/svelte-hero-icons": "^2.2.7",
|
||||||
"eslint": "^9.28.0",
|
"eslint": "^9.36.0",
|
||||||
"eslint-plugin-svelte": "^3.11.0",
|
"eslint-plugin-svelte": "^3.12.3",
|
||||||
"jsdom": "^22.1.0",
|
"jsdom": "^22.1.0",
|
||||||
"lemmy-js-client": "0.19.11-donation-dialog.1",
|
"lemmy-js-client": "0.19.11-donation-dialog.1",
|
||||||
"linkify-it": "^5.0.0",
|
"linkify-it": "^5.0.0",
|
||||||
@@ -27,23 +27,23 @@
|
|||||||
"marked-linkify-it": "^3.1.13",
|
"marked-linkify-it": "^3.1.13",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"openapi-fetch": "^0.14.0",
|
"openapi-fetch": "^0.14.0",
|
||||||
"postcss": "^8.4.30",
|
"postcss": "^8.5.6",
|
||||||
"prettier": "^3.3.3",
|
"prettier": "^3.6.2",
|
||||||
"prettier-plugin-svelte": "^3.4.0",
|
"prettier-plugin-svelte": "^3.4.0",
|
||||||
"svelte": "^5.37.3",
|
"svelte": "^5.39.2",
|
||||||
"svelte-adapter-bun-next": "^1.0.3",
|
"svelte-adapter-bun-next": "^1.0.3",
|
||||||
"svelte-check": "^4.0.0",
|
"svelte-check": "^4.3.1",
|
||||||
"svelte-floating-ui": "^1.5.9",
|
"svelte-floating-ui": "^1.6.2",
|
||||||
"svelte-focus-trap": "^1.2.0",
|
"svelte-focus-trap": "^1.2.0",
|
||||||
"svelte-infinite-scroll": "^2.0.1",
|
"svelte-infinite-scroll": "^2.0.1",
|
||||||
"svelte-markdown": "^0.4.1",
|
"svelte-markdown": "^0.4.1",
|
||||||
"sveltekit-i18n": "^2.4.2",
|
"sveltekit-i18n": "^2.4.2",
|
||||||
"tailwindcss": "^4.1.8",
|
"tailwindcss": "^4.1.13",
|
||||||
"tslib": "^2.4.1",
|
"tslib": "^2.8.1",
|
||||||
"typescript": "^5.5.0",
|
"typescript": "^5.9.2",
|
||||||
"typescript-eslint": "^8.33.1",
|
"typescript-eslint": "^8.44.0",
|
||||||
"ua-parser-js": "^1.0.38",
|
"ua-parser-js": "^1.0.41",
|
||||||
"vite": "^5.4.14"
|
"vite": "^5.4.20"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"svelte": "^5.37.3"
|
"svelte": "^5.37.3"
|
||||||
|
|||||||
@@ -131,13 +131,22 @@
|
|||||||
<div
|
<div
|
||||||
class={[
|
class={[
|
||||||
'absolute -inset-0.5 right-1 group-hover:right-0 group-hover:-inset-1.5 opacity-0 group-hover:opacity-100 transition-all',
|
'absolute -inset-0.5 right-1 group-hover:right-0 group-hover:-inset-1.5 opacity-0 group-hover:opacity-100 transition-all',
|
||||||
'bg-slate-100 dark:bg-zinc-900 -z-10 rounded-full',
|
'bg-slate-100 dark:bg-zinc-900 -z-10 rounded-full inline-flex items-center justify-end',
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
|
{#if node.comment_view.counts.child_count > 0}
|
||||||
|
{@const children = node.comment_view.counts.child_count}
|
||||||
|
<div
|
||||||
|
aria-label={$t('aria.comments.children', { childCount: children })}
|
||||||
|
class="font-medium"
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
<div
|
<div
|
||||||
class={[
|
class={[
|
||||||
!open && 'rotate-90',
|
!open && 'rotate-90',
|
||||||
'transition-all duration-500 ease-out ml-auto my-auto h-full w-8 grid place-items-center',
|
'transition-all duration-500 ease-out my-auto h-full w-8 grid place-items-center',
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Icon src={open ? Minus : Plus} size="16" micro />
|
<Icon src={open ? Minus : Plus} size="16" micro />
|
||||||
|
|||||||
@@ -943,6 +943,9 @@
|
|||||||
"openImage": "Open image: {{default}}",
|
"openImage": "Open image: {{default}}",
|
||||||
"openLink": "Open link: {{default}}",
|
"openLink": "Open link: {{default}}",
|
||||||
"openPost": "Open post: {{default}}"
|
"openPost": "Open post: {{default}}"
|
||||||
|
},
|
||||||
|
"comments": {
|
||||||
|
"children": "{{childCount}} children"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"stats": {
|
"stats": {
|
||||||
|
|||||||
@@ -79,6 +79,11 @@ export interface FeedTypes {
|
|||||||
posts: GetPost
|
posts: GetPost
|
||||||
comments: GetComments
|
comments: GetComments
|
||||||
preload?: PostView
|
preload?: PostView
|
||||||
|
thread: {
|
||||||
|
showContext?: boolean
|
||||||
|
singleThread?: boolean
|
||||||
|
focus?: string
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
post: PostView
|
post: PostView
|
||||||
@@ -88,12 +93,15 @@ export interface FeedTypes {
|
|||||||
cross_posts: PostView[]
|
cross_posts: PostView[]
|
||||||
post_view: PostView
|
post_view: PostView
|
||||||
}>
|
}>
|
||||||
thread: {
|
params: {
|
||||||
showContext?: boolean
|
posts: GetPost
|
||||||
singleThread?: boolean
|
comments: GetComments
|
||||||
focus?: string
|
thread: {
|
||||||
|
showContext?: boolean
|
||||||
|
singleThread?: boolean
|
||||||
|
focus?: string
|
||||||
|
}
|
||||||
}
|
}
|
||||||
params: { posts: GetPost; comments: GetComments }
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
'/f/[id]': [
|
'/f/[id]': [
|
||||||
|
|||||||
@@ -95,7 +95,7 @@
|
|||||||
submit = false,
|
submit = false,
|
||||||
color = 'secondary',
|
color = 'secondary',
|
||||||
size = 'md',
|
size = 'md',
|
||||||
rounding = size == 'lg' ? 'xl' : 'lg',
|
rounding = 'xl',
|
||||||
alignment = 'center',
|
alignment = 'center',
|
||||||
shadow = color != 'tertiary' ? 'none' : 'none',
|
shadow = color != 'tertiary' ? 'none' : 'none',
|
||||||
disabled,
|
disabled,
|
||||||
|
|||||||
@@ -1,18 +1,23 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { run } from 'svelte/legacy'
|
|
||||||
|
|
||||||
import { browser } from '$app/environment'
|
import { browser } from '$app/environment'
|
||||||
import { page } from '$app/state'
|
import { page } from '$app/state'
|
||||||
import { profile } from '$lib/auth.svelte.js'
|
import { profile } from '$lib/auth.svelte.js'
|
||||||
|
import { client } from '$lib/client/lemmy.svelte'
|
||||||
|
import { CommunityLink } from '$lib/components/lemmy/community'
|
||||||
import { isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
|
import { isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
|
||||||
import ObjectAutocomplete from '$lib/components/lemmy/ObjectAutocomplete.svelte'
|
import ObjectAutocomplete from '$lib/components/lemmy/ObjectAutocomplete.svelte'
|
||||||
|
import { postLink } from '$lib/components/lemmy/post'
|
||||||
import UserAutocomplete from '$lib/components/lemmy/user/UserAutocomplete.svelte'
|
import UserAutocomplete from '$lib/components/lemmy/user/UserAutocomplete.svelte'
|
||||||
|
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||||
|
import { Header } from '$lib/components/ui/layout'
|
||||||
import Pageination from '$lib/components/ui/layout/Pageination.svelte'
|
import Pageination from '$lib/components/ui/layout/Pageination.svelte'
|
||||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||||
|
import { t } from '$lib/i18n/translations'
|
||||||
import { settings } from '$lib/settings.svelte.js'
|
import { settings } from '$lib/settings.svelte.js'
|
||||||
import { searchParam } from '$lib/util.svelte.js'
|
import { searchParam } from '$lib/util.svelte.js'
|
||||||
import { Button, Select } from 'mono-svelte'
|
import { Button, Select } from 'mono-svelte'
|
||||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||||
|
import Spinner from 'mono-svelte/loader/Spinner.svelte'
|
||||||
import {
|
import {
|
||||||
Bars3BottomRight,
|
Bars3BottomRight,
|
||||||
Icon,
|
Icon,
|
||||||
@@ -22,13 +27,6 @@
|
|||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import ModlogItemCard from './item/ModlogItemCard.svelte'
|
import ModlogItemCard from './item/ModlogItemCard.svelte'
|
||||||
import ModlogItemTable from './item/ModlogItemTable.svelte'
|
import ModlogItemTable from './item/ModlogItemTable.svelte'
|
||||||
import { Header } from '$lib/components/ui/layout'
|
|
||||||
import { t } from '$lib/i18n/translations'
|
|
||||||
import { client } from '$lib/client/lemmy.svelte'
|
|
||||||
import Spinner from 'mono-svelte/loader/Spinner.svelte'
|
|
||||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
|
||||||
import { CommunityLink } from '$lib/components/lemmy/community'
|
|
||||||
import { postLink } from '$lib/components/lemmy/post'
|
|
||||||
|
|
||||||
let { data = $bindable() } = $props()
|
let { data = $bindable() } = $props()
|
||||||
|
|
||||||
@@ -40,7 +38,7 @@
|
|||||||
}`,
|
}`,
|
||||||
)
|
)
|
||||||
|
|
||||||
run(() => {
|
$effect(() => {
|
||||||
settings.modlogCardView =
|
settings.modlogCardView =
|
||||||
view == 'true' ? true : view == 'false' ? false : undefined
|
view == 'true' ? true : view == 'false' ? false : undefined
|
||||||
})
|
})
|
||||||
@@ -58,9 +56,9 @@
|
|||||||
<ul class="font-normal flex flex-col gap-2 mt-2">
|
<ul class="font-normal flex flex-col gap-2 mt-2">
|
||||||
{#if data.params.community}
|
{#if data.params.community}
|
||||||
<li>
|
<li>
|
||||||
<span class="text-sm text-slate-600 dark:text-zinc-400">
|
<div class="text-sm text-slate-600 dark:text-zinc-400">
|
||||||
{$t('form.post.community')}
|
{$t('form.post.community')}
|
||||||
</span>
|
</div>
|
||||||
{#await client().getCommunity({ id: data.params.community })}
|
{#await client().getCommunity({ id: data.params.community })}
|
||||||
<Spinner width={24} />
|
<Spinner width={24} />
|
||||||
{:then community}
|
{:then community}
|
||||||
@@ -70,9 +68,9 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{#if data.params.user}
|
{#if data.params.user}
|
||||||
<li>
|
<li>
|
||||||
<span class="text-sm text-slate-600 dark:text-zinc-400">
|
<div class="text-sm text-slate-600 dark:text-zinc-400">
|
||||||
{$t('routes.admin.applications.user')}
|
{$t('routes.admin.applications.user')}
|
||||||
</span>
|
</div>
|
||||||
{#await client().getPersonDetails( { person_id: data.params.user, limit: 1 }, )}
|
{#await client().getPersonDetails( { person_id: data.params.user, limit: 1 }, )}
|
||||||
<Spinner width={24} />
|
<Spinner width={24} />
|
||||||
{:then person}
|
{:then person}
|
||||||
@@ -82,10 +80,10 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{#if data.params.moderator}
|
{#if data.params.moderator}
|
||||||
<li>
|
<li>
|
||||||
<span class="text-sm text-slate-600 dark:text-zinc-400">
|
<div class="text-sm text-slate-600 dark:text-zinc-400">
|
||||||
<!--TODO add translation key-->
|
<!--TODO add translation key-->
|
||||||
Moderator
|
Moderator
|
||||||
</span>
|
</div>
|
||||||
{#await client().getPersonDetails( { person_id: data.params.moderator, limit: 1 }, )}
|
{#await client().getPersonDetails( { person_id: data.params.moderator, limit: 1 }, )}
|
||||||
<Spinner width={24} />
|
<Spinner width={24} />
|
||||||
{:then person}
|
{:then person}
|
||||||
@@ -95,10 +93,9 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{#if data.params.post}
|
{#if data.params.post}
|
||||||
<li>
|
<li>
|
||||||
<span class="text-sm text-slate-600 dark:text-zinc-400">
|
<div class="text-sm text-slate-600 dark:text-zinc-400">
|
||||||
<!--TODO add translation key-->
|
|
||||||
{$t('nav.create.post')}
|
{$t('nav.create.post')}
|
||||||
</span>
|
</div>
|
||||||
{#await client().getPost({ id: data.params.post })}
|
{#await client().getPost({ id: data.params.post })}
|
||||||
<Spinner width={24} />
|
<Spinner width={24} />
|
||||||
{:then post}
|
{:then post}
|
||||||
@@ -113,10 +110,9 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{#if data.params.comment}
|
{#if data.params.comment}
|
||||||
<li>
|
<li>
|
||||||
<span class="text-sm text-slate-600 dark:text-zinc-400">
|
<div class="text-sm text-slate-600 dark:text-zinc-400">
|
||||||
<!--TODO add translation key-->
|
|
||||||
{$t('moderation.removeSubmission.comment')}
|
{$t('moderation.removeSubmission.comment')}
|
||||||
</span>
|
</div>
|
||||||
{#await client().getComment({ id: data.params.comment })}
|
{#await client().getComment({ id: data.params.comment })}
|
||||||
<Spinner width={24} />
|
<Spinner width={24} />
|
||||||
{:then comment}
|
{:then comment}
|
||||||
@@ -145,21 +141,21 @@
|
|||||||
</span>
|
</span>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<Option value="All">All</Option>
|
<Option value="All">All</Option>
|
||||||
<Option value="ModRemovePost">Remove Post</Option>
|
<Option value="ModRemovePost">Remove post</Option>
|
||||||
<Option value="ModLockPost">Lock Post</Option>
|
<Option value="ModLockPost">Lock post</Option>
|
||||||
<Option value="ModFeaturePost">Feature Post</Option>
|
<Option value="ModFeaturePost">Feature post</Option>
|
||||||
<Option value="ModRemoveComment">Remove Comment</Option>
|
<Option value="ModRemoveComment">Remove comment</Option>
|
||||||
<Option value="ModRemoveCommunity">Remove Community</Option>
|
<Option value="ModRemoveCommunity">Remove community</Option>
|
||||||
<Option value="ModBanFromCommunity">Ban From Community</Option>
|
<Option value="ModBanFromCommunity">Ban from community</Option>
|
||||||
<Option value="ModAddCommunity">Add Moderator</Option>
|
<Option value="ModAddCommunity">Add moderator</Option>
|
||||||
<Option value="ModTransferCommunity">Transfer Community</Option>
|
<Option value="ModTransferCommunity">Transfer community</Option>
|
||||||
<Option value="ModAdd">Add Admin</Option>
|
<Option value="ModAdd">Add admin</Option>
|
||||||
<Option value="ModBan">Ban Admin</Option>
|
<Option value="ModBan">Ban admin</Option>
|
||||||
<Option value="ModHideCommunity">Hide Community</Option>
|
<Option value="ModHideCommunity">Hide community</Option>
|
||||||
<Option value="AdminPurgePerson">Purge User</Option>
|
<Option value="AdminPurgePerson">Purge user</Option>
|
||||||
<Option value="AdminPurgeCommunity">Purge Community</Option>
|
<Option value="AdminPurgeCommunity">Purge community</Option>
|
||||||
<Option value="AdminPurgePost">Purge Post</Option>
|
<Option value="AdminPurgePost">Purge post</Option>
|
||||||
<Option value="AdminPurgeComment">Purge Comment</Option>
|
<Option value="AdminPurgeComment">Purge comment</Option>
|
||||||
</Select>
|
</Select>
|
||||||
|
|
||||||
<Select bind:value={view} class="w-36">
|
<Select bind:value={view} class="w-36">
|
||||||
@@ -175,41 +171,25 @@
|
|||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col md:flex-row md:items-center gap-2 w-full">
|
<div class="flex flex-col md:flex-row md:items-center gap-2 w-full">
|
||||||
<ObjectAutocomplete
|
|
||||||
type="instance"
|
|
||||||
placeholder="Filter by instance"
|
|
||||||
showWhenEmpty={true}
|
|
||||||
label="Instance"
|
|
||||||
class="flex-1"
|
|
||||||
q={page.url.searchParams.get('instance') || ''}
|
|
||||||
onselect={(e) =>
|
|
||||||
searchParam(
|
|
||||||
page.url,
|
|
||||||
'instance',
|
|
||||||
e?.domain.toString() ?? '',
|
|
||||||
'page',
|
|
||||||
'community',
|
|
||||||
'user',
|
|
||||||
'mod_id',
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<ObjectAutocomplete
|
<ObjectAutocomplete
|
||||||
placeholder="Filter by community"
|
placeholder="Filter by community"
|
||||||
listing_type="All"
|
listing_type="All"
|
||||||
showWhenEmpty={true}
|
showWhenEmpty={true}
|
||||||
label="Community"
|
label="Community"
|
||||||
class="flex-1"
|
|
||||||
q={page.url.searchParams.get('community') ? 'Selected' : ''}
|
q={page.url.searchParams.get('community') ? 'Selected' : ''}
|
||||||
onselect={(e) =>
|
onselect={(e) =>
|
||||||
searchParam(page.url, 'community', e?.id.toString() ?? '', 'page')}
|
searchParam(
|
||||||
|
page.url,
|
||||||
|
'community',
|
||||||
|
e?.community.id.toString() ?? '',
|
||||||
|
'page',
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
<UserAutocomplete
|
<UserAutocomplete
|
||||||
instance={page.url.searchParams.get('instance') || undefined}
|
instance={page.url.searchParams.get('instance') || undefined}
|
||||||
placeholder="Filter by user"
|
placeholder="Filter by user"
|
||||||
jwt={profile.current?.jwt}
|
|
||||||
listing_type="All"
|
listing_type="All"
|
||||||
showWhenEmpty={true}
|
showWhenEmpty={true}
|
||||||
class="flex-1"
|
|
||||||
label="User"
|
label="User"
|
||||||
q={page.url.searchParams.get('user')
|
q={page.url.searchParams.get('user')
|
||||||
? (data.filters.user ?? 'Selected')
|
? (data.filters.user ?? 'Selected')
|
||||||
@@ -220,10 +200,8 @@
|
|||||||
{#if profile.current?.user && isAdmin(profile.current?.user)}
|
{#if profile.current?.user && isAdmin(profile.current?.user)}
|
||||||
<UserAutocomplete
|
<UserAutocomplete
|
||||||
placeholder="Filter by moderator"
|
placeholder="Filter by moderator"
|
||||||
jwt={profile.current?.jwt}
|
|
||||||
listing_type="All"
|
listing_type="All"
|
||||||
showWhenEmpty={true}
|
showWhenEmpty={true}
|
||||||
class="flex-1"
|
|
||||||
label="Moderator"
|
label="Moderator"
|
||||||
q={page.url.searchParams.get('mod_id')
|
q={page.url.searchParams.get('mod_id')
|
||||||
? (data.filters.moderator ?? 'Selected')
|
? (data.filters.moderator ?? 'Selected')
|
||||||
@@ -244,8 +222,8 @@
|
|||||||
'instance',
|
'instance',
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
size="square-lg"
|
size="custom"
|
||||||
class="self-end shrink-0"
|
class="self-end shrink-0 h-8.5 aspect-square"
|
||||||
title="Clear filters"
|
title="Clear filters"
|
||||||
>
|
>
|
||||||
<Icon src={XMark} size="16" mini />
|
<Icon src={XMark} size="16" mini />
|
||||||
@@ -259,34 +237,29 @@
|
|||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div style="width:100%; overflow-x: auto;">
|
<div style="width:100%; overflow-x: auto;" class="table-container">
|
||||||
<table
|
<table
|
||||||
class="table overflow-x-auto table-fixed relative"
|
class="table overflow-x-auto table-fixed relative w-full min-w-2xl"
|
||||||
style="min-width: 800px;"
|
|
||||||
>
|
>
|
||||||
<colgroup class="table-fixed">
|
<colgroup>
|
||||||
<col />
|
<col style="width: 10.6%;" />
|
||||||
<col />
|
<col style="width: 16.6%;" />
|
||||||
<col class="overflow-x-auto" />
|
<col style="width: 16.6%;" />
|
||||||
<col />
|
<col style="width: 16.6%;" />
|
||||||
<col />
|
<col style="width: 16.6%;" />
|
||||||
<col />
|
<col style="width: 16.6%;" />
|
||||||
<col />
|
|
||||||
<col />
|
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<thead class="text-left sticky top-0">
|
<thead class="text-left">
|
||||||
<tr class="rounded-t-lg overflow-hidden">
|
<tr class="rounded-t-lg overflow-hidden">
|
||||||
<th>Time</th>
|
<th>Time</th>
|
||||||
<th>Moderator</th>
|
<th>Moderator</th>
|
||||||
<th>Action</th>
|
|
||||||
<th>User</th>
|
|
||||||
<th>Community</th>
|
<th>Community</th>
|
||||||
<th>Content</th>
|
<th>Action</th>
|
||||||
<th>Reason</th>
|
<th>Reason</th>
|
||||||
<th>Link</th>
|
<th align="right">Content</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="text-sm">
|
<tbody class="text-sm divide-y divide-slate-200 dark:divide-zinc-800">
|
||||||
{#each data.modlog as modlog (modlog)}
|
{#each data.modlog as modlog (modlog)}
|
||||||
<ModlogItemTable item={modlog} />
|
<ModlogItemTable item={modlog} />
|
||||||
{/each}
|
{/each}
|
||||||
@@ -294,7 +267,11 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<Pageination page={data.page} href={(page) => `?page=${page}`} />
|
<Pageination
|
||||||
|
page={data.page}
|
||||||
|
hasMore={data.params.hasMore}
|
||||||
|
href={(page) => `?page=${page}`}
|
||||||
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<Placeholder
|
<Placeholder
|
||||||
title="No results"
|
title="No results"
|
||||||
@@ -305,21 +282,44 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@reference '../../style/app.css'
|
.table-container {
|
||||||
|
border: 1px solid var(--color-slate-200);
|
||||||
:global(.table thead tr th) {
|
background-color: white;
|
||||||
@apply border border-slate-200 dark:border-zinc-800 px-4 py-2 bg-slate-100;
|
border-radius: var(--radius-2xl);
|
||||||
}
|
}
|
||||||
|
|
||||||
:global(.table tr td) {
|
.table {
|
||||||
@apply border border-slate-200 px-4 py-2 overflow-auto;
|
table-layout: fixed !important;
|
||||||
|
|
||||||
|
thead {
|
||||||
|
tr {
|
||||||
|
th {
|
||||||
|
padding: calc(var(--spacing) * 3);
|
||||||
|
border-bottom: 1px solid var(--color-slate-200);
|
||||||
|
font-weight: var(--font-weight-medium);
|
||||||
|
font-size: var(--text-sm);
|
||||||
|
background-color: var(--color-slate-25);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:global(.dark .table tr td) {
|
.table tbody {
|
||||||
@apply border-zinc-800;
|
font-size: var(--text-xs);
|
||||||
|
:global(tr td) {
|
||||||
|
padding: calc(var(--spacing) * 1) calc(var(--spacing) * 3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:global(.dark thead tr th) {
|
:global(.dark) {
|
||||||
@apply border-zinc-800 bg-zinc-900;
|
.table-container {
|
||||||
|
background-color: var(--color-zinc-950);
|
||||||
|
border: 1px solid var(--color-zinc-800);
|
||||||
|
}
|
||||||
|
|
||||||
|
thead tr th {
|
||||||
|
background-color: var(--color-zinc-900);
|
||||||
|
border-bottom: 1px solid var(--color-zinc-800);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
import { publishedToDate } from '$lib/components/util/date.js'
|
import { client } from '$lib/client/lemmy.svelte'
|
||||||
import { getClient } from '$lib/client/lemmy.svelte'
|
|
||||||
import type {
|
import type {
|
||||||
AdminPurgeCommentView,
|
AdminPurgeCommentView,
|
||||||
AdminPurgeCommunityView,
|
AdminPurgeCommunityView,
|
||||||
@@ -19,6 +18,7 @@ import type {
|
|||||||
ModlogActionType,
|
ModlogActionType,
|
||||||
Person,
|
Person,
|
||||||
} from '$lib/client/types'
|
} from '$lib/client/types'
|
||||||
|
import { publishedToDate } from '$lib/components/util/date.js'
|
||||||
|
|
||||||
export type ActionName =
|
export type ActionName =
|
||||||
| 'ban'
|
| 'ban'
|
||||||
@@ -188,7 +188,10 @@ export const _toModLog = (item: ModAction): ModLog => {
|
|||||||
timestamp: timestamp(item.mod_ban.when_),
|
timestamp: timestamp(item.mod_ban.when_),
|
||||||
moderator: item.moderator,
|
moderator: item.moderator,
|
||||||
moderatee: item.banned_person,
|
moderatee: item.banned_person,
|
||||||
reason: `${item.mod_ban.reason ?? ''} (banned ${expires})`,
|
reason:
|
||||||
|
item.mod_ban.reason +
|
||||||
|
' ' +
|
||||||
|
(item.mod_ban.banned === true ? `(banned ${expires})` : ''),
|
||||||
link: `/u/${fullUserName(item.banned_person)}`,
|
link: `/u/${fullUserName(item.banned_person)}`,
|
||||||
}
|
}
|
||||||
} else if ('mod_add' in item) {
|
} else if ('mod_add' in item) {
|
||||||
@@ -206,9 +209,7 @@ export const _toModLog = (item: ModAction): ModLog => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function load({ url }) {
|
export async function load({ url, fetch }) {
|
||||||
const instance = url.searchParams.get('instance') || undefined
|
|
||||||
|
|
||||||
const community = Number(url.searchParams.get('community')) || undefined
|
const community = Number(url.searchParams.get('community')) || undefined
|
||||||
const user = Number(url.searchParams.get('user')) || undefined
|
const user = Number(url.searchParams.get('user')) || undefined
|
||||||
const modId = Number(url.searchParams.get('mod_id')) || undefined
|
const modId = Number(url.searchParams.get('mod_id')) || undefined
|
||||||
@@ -219,7 +220,9 @@ export async function load({ url }) {
|
|||||||
const type: ModlogActionType =
|
const type: ModlogActionType =
|
||||||
(url.searchParams.get('type') as ModlogActionType) || 'All'
|
(url.searchParams.get('type') as ModlogActionType) || 'All'
|
||||||
|
|
||||||
const results = await getClient(instance).getModlog({
|
const results = await client({
|
||||||
|
func: fetch,
|
||||||
|
}).getModlog({
|
||||||
community_id: community,
|
community_id: community,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
type_: type,
|
type_: type,
|
||||||
@@ -270,6 +273,7 @@ export async function load({ url }) {
|
|||||||
moderator: modId,
|
moderator: modId,
|
||||||
post: postId,
|
post: postId,
|
||||||
comment: commentId,
|
comment: commentId,
|
||||||
|
hasMore: moderationActions.length >= 20,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Link from '$lib/components/input/Link.svelte'
|
|
||||||
import { CommunityLink } from '$lib/components/lemmy/community'
|
import { CommunityLink } from '$lib/components/lemmy/community'
|
||||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||||
|
import { t } from '$lib/i18n/translations.js'
|
||||||
|
import { Button, modal } from 'mono-svelte'
|
||||||
import type { ModLog } from '../+page.js'
|
import type { ModLog } from '../+page.js'
|
||||||
import ModlogAction from '../ModlogAction.svelte'
|
import ModlogAction from '../ModlogAction.svelte'
|
||||||
|
|
||||||
@@ -13,6 +14,18 @@
|
|||||||
let { item }: Props = $props()
|
let { item }: Props = $props()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{#snippet itemInfo()}
|
||||||
|
<Button color="primary" rounding="pill" class="w-max" href={item.link}>
|
||||||
|
{$t('common.jump')}
|
||||||
|
</Button>
|
||||||
|
{#if item.moderatee}
|
||||||
|
<UserLink avatar user={item.moderatee} />
|
||||||
|
{/if}
|
||||||
|
<div>
|
||||||
|
{item.content}
|
||||||
|
</div>
|
||||||
|
{/snippet}
|
||||||
|
|
||||||
<tr class="">
|
<tr class="">
|
||||||
<td style="width: 10%;">
|
<td style="width: 10%;">
|
||||||
<span>
|
<span>
|
||||||
@@ -28,18 +41,10 @@
|
|||||||
user={item.moderator}
|
user={item.moderator}
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<p class="text-slate-500 dark:text-zinc-500">Hidden</p>
|
<p class="text-slate-500 dark:text-zinc-500">Unknown</p>
|
||||||
<p></p>
|
<p></p>
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
|
||||||
<ModlogAction action={item.actionName} />
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{#if item.moderatee}
|
|
||||||
<UserLink showInstance={false} user={item.moderatee} />
|
|
||||||
{/if}
|
|
||||||
</td>
|
|
||||||
<td>
|
<td>
|
||||||
{#if item.community}
|
{#if item.community}
|
||||||
<CommunityLink
|
<CommunityLink
|
||||||
@@ -51,18 +56,21 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{#if item.content}
|
<ModlogAction action={item.actionName} />
|
||||||
<p>{item.content}</p>
|
|
||||||
{/if}
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{#if item.reason}
|
{#if item.reason}
|
||||||
<p>{item.reason}</p>
|
<p>{item.reason}</p>
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td align="right">
|
||||||
{#if item.link}
|
{#if item.content}
|
||||||
<Link highlight href={item.link} />
|
<Button
|
||||||
|
size="sm"
|
||||||
|
onclick={() => modal({ title: $t('common.info'), snippet: itemInfo })}
|
||||||
|
>
|
||||||
|
{$t('common.info')}
|
||||||
|
</Button>
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
})
|
})
|
||||||
.then((i) => i.comments)
|
.then((i) => i.comments)
|
||||||
loading = false
|
loading = false
|
||||||
data.data.value.thread.singleThread = false
|
data.data.value.params.thread.singleThread = false
|
||||||
}
|
}
|
||||||
|
|
||||||
let tags = $derived.by<{ title?: string; tags: Tag[] }>(() => {
|
let tags = $derived.by<{ title?: string; tags: Tag[] }>(() => {
|
||||||
@@ -217,28 +217,28 @@
|
|||||||
{/await}
|
{/await}
|
||||||
</article>
|
</article>
|
||||||
{#await data.data.value.comments then comments}
|
{#await data.data.value.comments then comments}
|
||||||
{#if data.data.value.thread.showContext || data.data.value.thread.singleThread}
|
{#if data.data.value.params.thread.showContext || data.data.value.params.thread.singleThread}
|
||||||
<div
|
<div
|
||||||
class="sticky mx-auto z-50 max-w-md min-w-0 flex flex-col items-center overflow-auto gap-1
|
class="sticky mx-auto z-50 max-w-md min-w-0 flex flex-col items-center overflow-auto gap-1
|
||||||
bg-slate-50/50 dark:bg-zinc-900/50 backdrop-blur-xl border border-slate-200/50 dark:border-zinc-800/50
|
bg-slate-50/50 dark:bg-zinc-900/50 backdrop-blur-xl border border-slate-200/50 dark:border-zinc-800/50
|
||||||
p-1 rounded-full justify-between top-6 lg:top-22"
|
p-1 rounded-full justify-between top-6 lg:top-22 my-4"
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
color="none"
|
color="none"
|
||||||
rounding="pill"
|
rounding="pill"
|
||||||
{loading}
|
{loading}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
href={data.data.value.thread.showContext
|
href={data.data.value.params.thread.showContext
|
||||||
? `/comment/${
|
? `/comment/${
|
||||||
// split first comment path to get 5 before
|
// split first comment path to get 5 before
|
||||||
comments[0].comment.path.split('.').slice(-5)[1]
|
comments[0].comment.path.split('.').slice(-5)[1]
|
||||||
}`
|
}`
|
||||||
: data.data.value.thread.singleThread
|
: data.data.value.params.thread.singleThread
|
||||||
? postLink(data.data.value.post.post)
|
? postLink(data.data.value.post.post)
|
||||||
: undefined}
|
: undefined}
|
||||||
class="hover:bg-white/50 dark:hover:bg-zinc-800/30"
|
class="hover:bg-white/50 dark:hover:bg-zinc-800/30"
|
||||||
>
|
>
|
||||||
{data.data.value.thread.showContext
|
{data.data.value.params.thread.showContext
|
||||||
? $t('routes.post.thread.context')
|
? $t('routes.post.thread.context')
|
||||||
: $t('routes.post.thread.allComments')}
|
: $t('routes.post.thread.allComments')}
|
||||||
{#snippet suffix()}
|
{#snippet suffix()}
|
||||||
@@ -290,7 +290,7 @@
|
|||||||
<CommentProvider
|
<CommentProvider
|
||||||
{comments}
|
{comments}
|
||||||
post={data.data.value.post}
|
post={data.data.value.post}
|
||||||
focus={data.data.value.thread.focus}
|
focus={data.data.value.params.thread.focus}
|
||||||
onupdate={reloadComments}
|
onupdate={reloadComments}
|
||||||
bind:sort={data.data.value.params.comments.sort}
|
bind:sort={data.data.value.params.comments.sort}
|
||||||
virtualize={!page.url.searchParams.get('noVirtualize')}
|
virtualize={!page.url.searchParams.get('noVirtualize')}
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ export async function load({ params, url, route }) {
|
|||||||
focus,
|
focus,
|
||||||
max_depth: passedMaxDepth,
|
max_depth: passedMaxDepth,
|
||||||
} = buildContext(url.searchParams.get('thread') || undefined)
|
} = buildContext(url.searchParams.get('thread') || undefined)
|
||||||
|
|
||||||
const max_depth = passedMaxDepth
|
const max_depth = passedMaxDepth
|
||||||
|
|
||||||
const feedData = feed(route.id, async (p) => {
|
const feedData = feed(route.id, async (p) => {
|
||||||
@@ -84,11 +85,7 @@ export async function load({ params, url, route }) {
|
|||||||
cross_posts: i.cross_posts,
|
cross_posts: i.cross_posts,
|
||||||
post_view: i.post_view,
|
post_view: i.post_view,
|
||||||
})),
|
})),
|
||||||
thread: {
|
thread: p.thread,
|
||||||
showContext,
|
|
||||||
focus,
|
|
||||||
singleThread: parentId != null,
|
|
||||||
},
|
|
||||||
params: p,
|
params: p,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -105,6 +102,11 @@ export async function load({ params, url, route }) {
|
|||||||
},
|
},
|
||||||
posts: { id: Number(params.id) },
|
posts: { id: Number(params.id) },
|
||||||
preload: cachedPost,
|
preload: cachedPost,
|
||||||
|
thread: {
|
||||||
|
showContext: showContext,
|
||||||
|
focus: focus,
|
||||||
|
singleThread: parentId != null,
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
if (browser && !isNaN(Number(page.url.hash)))
|
if (browser && !isNaN(Number(page.url.hash.slice(1)) || NaN))
|
||||||
// hack because virtual list needs to calc heights
|
// hack because virtual list needs to calc heights
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
document
|
document
|
||||||
|
|||||||
Reference in new issue
Block a user