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

View File

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

View File

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