Dough Git

clove/pkviewer

web/src/routes/admin/audit/+page.svelte

back to web/src/routes/admin/audit

<!-- web/src/routes/admin/audit/+page.svelte -->
<script lang="ts">
  import PageHeader from "$lib/components/manage/PageHeader.svelte";
  import Section from "$lib/components/manage/Section.svelte";

  let { data } = $props();
</script>

<svelte:head>
  <title>History · Admin · pkviewer</title>
</svelte:head>

<div class="mg-shell">
  <PageHeader title="History" description="Recent badge, credit and admin changes." />

  <Section>
    {#if data.events === null}
      <p class="mg-note" data-tone="error">Could not load the history.</p>
    {:else if data.events.length === 0}
      <p class="muted">Nothing has happened yet.</p>
    {:else}
      <ul class="mg-list">
        {#each data.events as event, index (`${event.at}-${index}`)}
          <li class="mg-item">
            <div class="grow">
              <code>{event.action}</code>
              {#if event.target}<span class="muted"> → {event.target}</span>{/if}
              <div class="mg-item-meta muted">
                <span>{new Date(event.at).toLocaleString()}</span>
                {#if event.detail}<span>{event.detail}</span>{/if}
                <span>by {event.accountId ?? "a deleted account"}</span>
              </div>
            </div>
          </li>
        {/each}
      </ul>
    {/if}
  </Section>
</div>