show date in admin ui report table
This commit is contained in:
@ -4,6 +4,15 @@
|
||||
import DataTable from '@components/admin/table/DataTable.svelte';
|
||||
import { type StrikeReasons, getStrikeReasons, reports } from '@app/admin/reports/reports.ts';
|
||||
|
||||
// consts
|
||||
const dateFormat = new Intl.DateTimeFormat('de-DE', {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit'
|
||||
});
|
||||
|
||||
// states
|
||||
let strikeReasons = $state<StrikeReasons>([]);
|
||||
let activeReport = $state<Report | null>(null);
|
||||
@ -14,6 +23,10 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
{#snippet date(value: string)}
|
||||
{dateFormat.format(new Date(value))}
|
||||
{/snippet}
|
||||
|
||||
<DataTable
|
||||
data={reports}
|
||||
count={true}
|
||||
@ -21,11 +34,12 @@
|
||||
{ key: 'reason', label: 'Grund' },
|
||||
{ key: 'reporter.name', label: 'Report Team' },
|
||||
{ key: 'reported?.name', label: 'Reportetes Team' },
|
||||
{ key: 'createdAt', label: 'Datum' },
|
||||
{ key: 'createdAt', label: 'Datum', transform: date },
|
||||
{ key: 'report.status?.status', label: 'Bearbeitungsstatus' }
|
||||
]}
|
||||
onClick={(report) => (activeReport = report)}
|
||||
/>
|
||||
>
|
||||
</DataTable>
|
||||
|
||||
{#key activeReport}
|
||||
<BottomBar {strikeReasons} report={activeReport} />
|
||||
|
Reference in New Issue
Block a user