feat: switch to table

This commit is contained in:
Xyphyn committed 2023-08-22 18:22:47 -07:00
1 parent 281ef04c43
commit 114856a052
6 files changed
+72 -26

No files matched your search

@@ -72,9 +72,7 @@
<MenuButton
on:click={() => {
navigator.clipboard.writeText(
`${$page.url.origin}/post/${getInstance()}/${
comment.post.id
}?thread=${comment.comment.path}#${comment.comment.id}`
`/comment/${getInstance()}/${comment.comment.id}`
)
}}
>
+6
View File
@@ -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.
+36 -2
View File
@@ -7,10 +7,44 @@
<div class="flex flex-col gap-4">
<h1 class="font-bold text-2xl">Modlog</h1>
{#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}
<ModlogItem item={modlog} />
{/each}
</ul>
</table>
{/if}
</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>
+4 -1
View File
@@ -57,6 +57,7 @@ export const _toModLog = (item: ModAction): ModLog => {
timestamp: Date.parse(`${item.mod_remove_post.when_}Z`),
moderator: item.moderator,
reason: item.mod_remove_post.reason,
link: `/post/${item.post.id}`,
}
}
@@ -90,7 +91,9 @@ export async function load({ url }) {
...results.removed_posts,
]
const moderationActions = moderation.map(_toModLog)
const moderationActions = moderation
.map(_toModLog)
.sort((b, a) => b.timestamp - a.timestamp)
return {
modlog: moderationActions,
+25 -20
View File
@@ -9,23 +9,28 @@
export let item: ModLog
</script>
<Card elevation={0} class="p-5 flex flex-col gap-1 text-sm">
<SectionTitle>Action</SectionTitle>
<span class="font-bold text-base">{item.actionName}</span>
{#if item.moderator}
<SectionTitle class="mt-3">Moderator</SectionTitle>
<UserLink avatar user={item.moderator} />
{/if}
{#if item.moderatee}
<SectionTitle class="mt-3">Moderatee</SectionTitle>
<UserLink avatar user={item.moderatee} />
{/if}
{#if item.community}
<SectionTitle class="mt-3">Community</SectionTitle>
<CommunityLink avatar community={item.community} />
{/if}
{#if item.link}
<SectionTitle class="mt-3">Link</SectionTitle>
<Link highlight href={item.link} />
{/if}
</Card>
<tr class="text-sm">
<td>
<span class="font-bold">{item.actionName}</span>
</td>
<td>
{#if item.moderator}
<UserLink showInstance={false} avatar user={item.moderator} />
{/if}
</td>
<td>
{#if item.moderatee}
<UserLink showInstance={false} avatar user={item.moderatee} />
{/if}
</td>
<td>
{#if item.community}
<CommunityLink showInstance={false} avatar community={item.community} />
{/if}
</td>
<td>
{#if item.link}
<Link highlight href={item.link} />
{/if}
</td>
</tr>