This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import BottomBar from '@app/admin/reports/BottomBar.svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import { onMount, untrack } from 'svelte';
|
||||
import DataTable from '@components/admin/table/DataTable.svelte';
|
||||
import { type StrikeReasons, getStrikeReasons, reports } from '@app/admin/reports/reports.ts';
|
||||
|
||||
@@ -21,6 +21,18 @@
|
||||
onMount(() => {
|
||||
getStrikeReasons().then((data) => (strikeReasons = data ?? []));
|
||||
});
|
||||
|
||||
let initialSort = false;
|
||||
$effect(() => {
|
||||
if ($reports.length == 0 || initialSort) return;
|
||||
initialSort = true;
|
||||
|
||||
$reports = $reports.toSorted(
|
||||
(a, b) =>
|
||||
['open', 'closed', null].indexOf(a.status?.status ?? null) -
|
||||
['open', 'closed', null].indexOf(b.status?.status ?? null)
|
||||
);
|
||||
});
|
||||
</script>
|
||||
|
||||
{#snippet date(value: string)}
|
||||
|
||||
Reference in New Issue
Block a user