Redesign status badge with icons

This commit is contained in:
iamdoubz committed 2026-11-05 17:41:32 -06:00
1 parent 90c93a9891
commit e8d4270c89
1 file changed
+15 -7
+15 -7
View File
@@ -1,14 +1,22 @@
<script lang="ts">
import Ban from '@lucide/svelte/icons/ban';
import CircleAlert from '@lucide/svelte/icons/circle-alert';
import CircleCheck from '@lucide/svelte/icons/circle-check';
import ListChecks from '@lucide/svelte/icons/list-checks';
import LoaderCircle from '@lucide/svelte/icons/loader-circle';
import type { Scan } from '../lib/api';
let { status }: { status: Scan['status'] } = $props();
// Every status has an icon and a word, so it never depends on color alone.
const look = {
queued: ['info', 'Reading…'],
parsed: ['warn', 'Ready to review'],
reviewed: ['warn', 'In review'],
published: ['ok', 'Published'],
failed: ['danger', 'Failed'],
abandoned: ['', 'Discarded'],
queued: { tone: 'info', text: 'Reading…', icon: LoaderCircle, spin: true },
parsed: { tone: 'warn', text: 'Ready to review', icon: ListChecks, spin: false },
reviewed: { tone: 'warn', text: 'In review', icon: ListChecks, spin: false },
published: { tone: 'ok', text: 'Published', icon: CircleCheck, spin: false },
failed: { tone: 'danger', text: 'Failed', icon: CircleAlert, spin: false },
abandoned: { tone: '', text: 'Discarded', icon: Ban, spin: false },
} as const;
const l = $derived(look[status]);
</script>
<span class="badge {look[status][0]}">{look[status][1]}</span>
<span class="badge {l.tone}"><l.icon size={13} class={l.spin ? 'spin' : ''} aria-hidden="true" />{l.text}</span>