Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | <template>
<UDashboardPanel id="changesets">
<template #header>
<UDashboardNavbar title="Changesets" icon="i-lucide-layers" />
</template>
<template #body>
<UAlert
v-if="error"
color="error"
variant="subtle"
icon="i-lucide-triangle-alert"
title="The store can't be read"
:description="errorMessage"
/>
<UEmpty
v-else-if="Ichangesets.length === 0"
icon="i-lucide-layers"
title="No changesets yet"
description='Claude opens one with `pnpm editor new "<title>"`; it shows up here to review.'
/>
<div v-else class="grid gap-4 lg:grid-cols-2">
<NuxtLink
v-for="changeset in changesets"
:key="changeset.id"
:to="`/changesets/${changeset.id}`"
>
<UCard class="h-full transition-colors hover:bg-elevated/50">
<div class="flex items-start justify-between gap-3">
<div class="min-w-0">
<p class="truncate font-semibold">{{ changeset.title }}</p>
<p class="text-xs text-muted">
{{ changeset.id }} ยท {{ formatDate(changeset.createdAt) }}
</p>
</div>
<UBadge
:color="STATUS_COLOR[changeset.status]"
variant="subtle"
:label="changeset.status"
/>
</div>
<p
v-if="Ichangeset.instructions"
class="mt-3 line-clamp-2 text-sm text-muted"
>
{{ changeset.instructions }}
</p>
<UProgress
v-if="Ichangeset.counts.proposals > 0"
class="mt-4"
:model-value="changeset.counts.proposals - changeset.counts.pending"
:max="changeset.counts.proposals"
size="sm"
/>
<dl class="mt-3 grid grid-cols-3 gap-2 text-sm sm:grid-cols-6">
<div v-for="(value, label) in changeset.counts" :key="label">
<dt class="text-xs text-dimmed capitalize">{{ label }}</dt>
<dd class="font-medium tabular-nums">{{ value }}</dd>
</div>
</dl>
</UCard>
</NuxtLink>
</div>
</template>
</UDashboardPanel>
</template>
<script setup lang="ts">
import type { BadgeProps } from "@nuxt/ui";
import type { Changeset } from "#shared/types/Changeset.ts";
interface Row extends Changeset {
counts: Record<
"articles" | "scanned" | "proposals" | "pending" | "applied" | "rejected",
number
>;
}
const { data: changesets, error } = await useFetch<Row[]>("/api/changesets", { default: () => [] });
const errorMessage = computed(() => (error.value ? messageOf(error.value) : ""));
const STATUS_COLOR = {
open: "primary",
closed: "success",
abandoned: "neutral",
} as const satisfies Record<Changeset["status"], BadgeProps["color"]>;
</script>
|