feat: switch to table
This commit is contained in:
1 parent
281ef04c43
commit
114856a052
6 files changed
+72
-26
No files matched your search
@@ -72,9 +72,7 @@
|
|||||||
<MenuButton
|
<MenuButton
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
navigator.clipboard.writeText(
|
navigator.clipboard.writeText(
|
||||||
`${$page.url.origin}/post/${getInstance()}/${
|
`/comment/${getInstance()}/${comment.comment.id}`
|
||||||
comment.post.id
|
|
||||||
}?thread=${comment.comment.path}#${comment.comment.id}`
|
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import { getInstance } from '$lib/lemmy.js'
|
||||||
|
import { redirect } from '@sveltejs/kit'
|
||||||
|
|
||||||
|
export function load({ params }) {
|
||||||
|
throw redirect(300, `/comment/${getInstance()}/${params.instance}`)
|
||||||
|
}
|
||||||
File renamed without changes.
@@ -7,10 +7,44 @@
|
|||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<h1 class="font-bold text-2xl">Modlog</h1>
|
<h1 class="font-bold text-2xl">Modlog</h1>
|
||||||
{#if data.modlog}
|
{#if data.modlog}
|
||||||
<ul class="flex flex-col gap-4">
|
<table class="table border-collapse">
|
||||||
|
<colgroup>
|
||||||
|
<col />
|
||||||
|
<col />
|
||||||
|
<col />
|
||||||
|
<col />
|
||||||
|
<col />
|
||||||
|
</colgroup>
|
||||||
|
<thead class="text-left">
|
||||||
|
<tr>
|
||||||
|
<th>Action</th>
|
||||||
|
<th>Moderator</th>
|
||||||
|
<th>Moderatee</th>
|
||||||
|
<th>Community</th>
|
||||||
|
<th>Link</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
{#each data.modlog as modlog}
|
{#each data.modlog as modlog}
|
||||||
<ModlogItem item={modlog} />
|
<ModlogItem item={modlog} />
|
||||||
{/each}
|
{/each}
|
||||||
</ul>
|
</table>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<style lang="postcss">
|
||||||
|
:global(.table thead tr th) {
|
||||||
|
@apply border border-slate-200 dark:border-zinc-800 px-4 py-2;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.table tr td) {
|
||||||
|
@apply border border-slate-200 px-4 py-2 overflow-auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.dark .table tr td) {
|
||||||
|
@apply border-zinc-800;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.dark thead tr th) {
|
||||||
|
@apply border-zinc-800;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -57,6 +57,7 @@ export const _toModLog = (item: ModAction): ModLog => {
|
|||||||
timestamp: Date.parse(`${item.mod_remove_post.when_}Z`),
|
timestamp: Date.parse(`${item.mod_remove_post.when_}Z`),
|
||||||
moderator: item.moderator,
|
moderator: item.moderator,
|
||||||
reason: item.mod_remove_post.reason,
|
reason: item.mod_remove_post.reason,
|
||||||
|
link: `/post/${item.post.id}`,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +91,9 @@ export async function load({ url }) {
|
|||||||
...results.removed_posts,
|
...results.removed_posts,
|
||||||
]
|
]
|
||||||
|
|
||||||
const moderationActions = moderation.map(_toModLog)
|
const moderationActions = moderation
|
||||||
|
.map(_toModLog)
|
||||||
|
.sort((b, a) => b.timestamp - a.timestamp)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
modlog: moderationActions,
|
modlog: moderationActions,
|
||||||
|
|||||||
@@ -9,23 +9,28 @@
|
|||||||
export let item: ModLog
|
export let item: ModLog
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Card elevation={0} class="p-5 flex flex-col gap-1 text-sm">
|
<tr class="text-sm">
|
||||||
<SectionTitle>Action</SectionTitle>
|
<td>
|
||||||
<span class="font-bold text-base">{item.actionName}</span>
|
<span class="font-bold">{item.actionName}</span>
|
||||||
{#if item.moderator}
|
</td>
|
||||||
<SectionTitle class="mt-3">Moderator</SectionTitle>
|
<td>
|
||||||
<UserLink avatar user={item.moderator} />
|
{#if item.moderator}
|
||||||
{/if}
|
<UserLink showInstance={false} avatar user={item.moderator} />
|
||||||
{#if item.moderatee}
|
{/if}
|
||||||
<SectionTitle class="mt-3">Moderatee</SectionTitle>
|
</td>
|
||||||
<UserLink avatar user={item.moderatee} />
|
<td>
|
||||||
{/if}
|
{#if item.moderatee}
|
||||||
{#if item.community}
|
<UserLink showInstance={false} avatar user={item.moderatee} />
|
||||||
<SectionTitle class="mt-3">Community</SectionTitle>
|
{/if}
|
||||||
<CommunityLink avatar community={item.community} />
|
</td>
|
||||||
{/if}
|
<td>
|
||||||
{#if item.link}
|
{#if item.community}
|
||||||
<SectionTitle class="mt-3">Link</SectionTitle>
|
<CommunityLink showInstance={false} avatar community={item.community} />
|
||||||
<Link highlight href={item.link} />
|
{/if}
|
||||||
{/if}
|
</td>
|
||||||
</Card>
|
<td>
|
||||||
|
{#if item.link}
|
||||||
|
<Link highlight href={item.link} />
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
Reference in new issue
Block a user