fix report details not showing after report is submitted
All checks were successful
delpoy / build-and-deploy (push) Successful in 36s

This commit is contained in:
bytedream 2024-12-20 19:24:59 +01:00
parent 60f031aa7b
commit 0280e2a277
3 changed files with 20 additions and 14 deletions

View File

@ -5,6 +5,10 @@
let { data } = $props();
let reason = $state(data.reason);
let body = $state(data.body);
let reporterName = $state(data.reporter.name);
let reportedName = $state(data.reported.name || null);
let completed = $state(!data.draft);
</script>
@ -18,9 +22,10 @@
{#if !completed}
<div class="col-[1] row-[1]" transition:fly={{ x: -200, duration: 300 }}>
<ReportDraft
reason={data.reason}
reporterName={data.reporter.name}
reportedName={data.reported.name ?? null}
bind:reason
bind:body
bind:reporterName
bind:reportedName
users={data.users ?? []}
onsubmit={() => (completed = true)}
/>
@ -28,11 +33,11 @@
{:else}
<div class="col-[1] row-[1]" transition:fly={{ x: 200, duration: 300 }}>
<ReportSubmitted
reporterName={data.reporter.name}
reportedName={data.reported.name ?? undefined}
{reason}
{body}
{reporterName}
{reportedName}
status={data.status}
reason={data.reason}
body={data.body}
statement={data.statement}
/>
</div>

View File

@ -8,15 +8,17 @@
import { getPopupModalShowFn } from '$lib/context';
let {
reporterName,
reportedName = null,
reason,
reporterName = $bindable(),
reportedName = $bindable(null),
reason = $bindable(),
body = $bindable(),
users,
onsubmit
}: {
reporterName: string;
reportedName: string | null;
reason: string;
body: string;
users: string[];
onsubmit: () => void;
} = $props();
@ -24,7 +26,6 @@
let showPopupModal = getPopupModalShowFn();
let reported = $state(reportedName);
let content = $state('');
async function submitReport() {
await fetch(`${env.PUBLIC_BASE_PATH}/report/${$page.params.url_hash}`, {
@ -32,7 +33,7 @@
body: JSON.stringify({
reported: reported || null,
subject: reason,
body: content
body: body
})
});
}
@ -108,7 +109,7 @@
required={true}
rows={4}
label="Details über den Report Grund"
bind:value={content}
bind:value={body}
/>
</div>
</div>

View File

@ -11,7 +11,7 @@
statement
}: {
reporterName: string;
reportedName?: string;
reportedName: string | null;
status: 'none' | 'review' | 'reviewed';
reason: string;
body: string;