feat: enhance post creation feedback and improve table layout in Post Management

This commit is contained in:
SquidSpirit 2025-10-15 07:02:05 +08:00
parent a577f94acd
commit aed4102878

View File

@ -26,6 +26,7 @@
const state = await createPost(params); const state = await createPost(params);
if (state.isSuccess()) { if (state.isSuccess()) {
loadPosts({ showUnpublished: true });
toast.success(`Post created successfully with ID: ${state.data.id}`); toast.success(`Post created successfully with ID: ${state.data.id}`);
} else if (state.isError()) { } else if (state.isError()) {
toast.error('Failed to create post', { toast.error('Failed to create post', {
@ -56,13 +57,15 @@
{#each postsListedState.data as postInfo (postInfo.id)} {#each postsListedState.data as postInfo (postInfo.id)}
<TableRow> <TableRow>
<TableCell>{postInfo.id}</TableCell> <TableCell>{postInfo.id}</TableCell>
<TableCell>{postInfo.title}</TableCell> <TableCell><span class="text-wrap">{postInfo.title}</span></TableCell>
<TableCell class="flex flex-row flex-wrap gap-2"> <TableCell>
<div class="flex flex-row flex-wrap gap-2">
{#each postInfo.labels as label (label.id)} {#each postInfo.labels as label (label.id)}
<PostLabel {label} /> <PostLabel {label} />
{/each} {/each}
</div>
</TableCell> </TableCell>
<TableCell>{postInfo.formattedPublishedTime || '---'}</TableCell> <TableCell>{postInfo.formattedPublishedTime}</TableCell>
</TableRow> </TableRow>
{/each} {/each}
{/if} {/if}