add guild info in post, report and edit button

This commit is contained in:
Yusur 2025-10-11 20:14:07 +02:00
parent cd92a4b12e
commit c33ab48225
4 changed files with 27 additions and 7 deletions

View file

@ -1,7 +1,7 @@
<script lang="ts">
import { DateTime } from "luxon";
import { RiHistoryLine, RiHome2Line, RiUserLine } from "svelte-remixicon";
import { RiEditLine, RiFlagLine, RiHistoryLine, RiHome2Line, RiUserLine } from "svelte-remixicon";
import type { PostEntry } from "./backend";
import SLayout from "./SLayout.svelte";
import GuildAbout from "./GuildAbout.svelte";
@ -11,10 +11,13 @@
import GuildMenu from "./GuildMenu.svelte";
import { SvelteShowdown } from "svelte-showdown";
import VoteButton from "./VoteButton.svelte";
import { getMe } from "./globals.svelte";
let { post }: { post: PostEntry } = $props();
let me = getMe();
let { title, created_at, id, content = '', to } = post;
</script>
@ -36,6 +39,12 @@ let { title, created_at, id, content = '', to } = post;
<VoteButton />
</div>
<ul class="message-options row">
{#if me && me.id !== post.author?.id}
<li><a href="/report/post/{id}"><RiFlagLine/> Report</a></li>
{/if}
{#if me && me.id === post.author?.id }
<li><a href="/edit/post/{id}"><RiEditLine/> Edit</a></li>
{/if}
</ul>
</div>
</article>

View file

@ -1,5 +1,5 @@
<script lang="ts">
import { RiHashtag, RiHistoryLine, RiUserLine } from "svelte-remixicon";
import { RiHistoryLine, RiShieldCrossLine, RiUserLine } from "svelte-remixicon";
import type { PostEntry } from "./backend";
import { DateTime } from "luxon";
@ -10,7 +10,7 @@ let { post } : {post: PostEntry }= $props();
{#if post.author}<a href="/@{post.author.username}">@{post.author.username}</a>
{:else}<i>Someone</i>{/if}</li>
{#if post.to.type == 'guild'}
<li><RiHashtag /> <a href="/+{post.to.name}">+{post.to.name}</a></li>
<li><RiShieldCrossLine /> <a href="/+{post.to.name}">+{post.to.name}</a></li>
{/if}
<li><RiHistoryLine /> <time datetime={post.created_at}>{ DateTime.fromISO(post.created_at).toFormat('d LLL yyyy') }</time></li>
</ul>