refactor(ui): build settings, org, task, workflow and dashboard pages from the shared components

This commit is contained in:
sam committed 2026-10-24 12:34:29 +11:00
1 parent 5fdd968fca
commit 0a8465e687
77 files changed
+505 -744

No files matched your search

+2 -4
View File
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { computed } from "vue";
import { ago } from "@/lib/format";
import { Timestamp } from "@/components/ui/timestamp";
import ChangeFileTable from "./ChangeFileTable.vue";
import { captureLinks, totalsLabel } from "./changed-files";
@@ -27,9 +27,7 @@ const prNumber = computed(() => props.capture.pr_number);
: "Captured"
}}<span v-if="capture.stage"> in stage {{ capture.stage }}</span>
</span>
<span class="text-xs text-fg-muted">{{
capture.captured_at ? ago(capture.captured_at) : ""
}}</span>
<span v-if="capture.captured_at" class="text-xs text-fg-muted"><Timestamp :at="capture.captured_at" /></span>
</div>
<div
class="mt-2 mb-3 flex flex-wrap items-center gap-3 text-xs text-fg-muted"
+7 -11
View File
@@ -21,6 +21,7 @@ import { statusKind, statusLabel } from "@/lib/task-meta";
import { cn } from "@/lib/utils";
import DispatchLinks from "@/bindings/DispatchLinks.vue";
import { MetadataList } from "@/components/ui/metadata-list";
import { Section } from "@/components/ui/section";
import StartNewRun from "./StartNewRun.vue";
import TaskRowActions from "./TaskRowActions.vue";
import { shownActionIds } from "./task-actions";
@@ -145,25 +146,20 @@ const headerActions = computed(() =>
</div>
</div>
<div v-if="description" class="mt-4">
<h2 class="text-sm font-medium">Description</h2>
<p class="mt-1 whitespace-pre-wrap break-words text-sm text-fg-muted">{{ description }}</p>
</div>
<Section v-if="description" title="Description" class="mt-4 mb-0">
<p class="whitespace-pre-wrap break-words text-sm text-fg-muted">{{ description }}</p>
</Section>
<div
v-if="sections.length || run.attempts?.called_by"
class="mt-3 flex w-fit max-w-full flex-wrap gap-x-10 gap-y-4 rounded-xl bg-card p-4 ring-1 ring-foreground/10"
>
<div v-if="sections.length || run.attempts?.called_by" class="mt-3 flex flex-wrap items-start gap-3">
<p v-if="run.attempts?.called_by" class="text-xs text-fg-subtle">
Called by
<RouterLink :to="`/tasks/${run.attempts.called_by}`" class="font-mono text-fg-muted hover:text-foreground hover:underline"
>task #{{ run.attempts.called_by }}</RouterLink
>
</p>
<section v-for="section in sections" :key="section.title" :aria-label="section.title" class="min-w-0">
<h2 class="mb-2 text-caption font-medium tracking-[0.06em] text-fg-subtle uppercase">{{ section.title }}</h2>
<Section v-for="section in sections" :key="section.title" :title="section.title" class="mb-0 min-w-0">
<MetadataList :rows="section.rows" class="text-fg-muted" />
</section>
</Section>
</div>
<Alert
+13 -16
View File
@@ -2,12 +2,14 @@
import { computed } from "vue";
import { ArrowUpRight } from "@lucide/vue";
import { ago, compact } from "@/lib/format";
import { compact } from "@/lib/format";
import { cn } from "@/lib/utils";
import { stageStatusMeta } from "./stage-rail";
import { MetadataList } from "@/components/ui/metadata-list";
import { Section } from "@/components/ui/section";
import { StatusDot } from "@/components/ui/status-dot";
import { Timestamp } from "@/components/ui/timestamp";
import StageRail from "./StageRail.vue";
import { STATUS_FILL } from "@/lib/status";
import { useTaskRun } from "./use-task-run";
import { duration } from "./timeline-event";
@@ -16,7 +18,7 @@ import { duration } from "./timeline-event";
const run = useTaskRun();
const attempts = computed(() => [...(run.attempts?.attempts ?? [])].reverse());
const dot = (status?: string) => STATUS_FILL[stageStatusMeta(status).kind];
const tone = (status?: string) => stageStatusMeta(status).kind;
const details = computed(() => {
const task = run.task;
if (!task) return [];
@@ -28,14 +30,11 @@ const details = computed(() => {
if (task.tokens_used) rows.push({ label: "Tokens", value: compact(task.tokens_used), mono: true });
return rows;
});
const panel = "rounded-xl bg-card p-4 ring-1 ring-foreground/10";
const heading = "mb-2 text-caption font-medium tracking-[0.06em] text-fg-subtle uppercase";
</script>
<template>
<aside class="grid gap-4" aria-label="Task details">
<section v-if="attempts.length" :class="panel" aria-labelledby="rail-attempts">
<h2 id="rail-attempts" :class="heading">Attempts</h2>
<Section v-if="attempts.length" title="Attempts" class="mb-0">
<ul class="flex flex-col gap-0.5">
<li v-for="a in attempts" :key="a.attempt">
<button
@@ -49,24 +48,22 @@ const heading = "mb-2 text-caption font-medium tracking-[0.06em] text-fg-subtle
"
@click="run.selectAttempt(Number(a.attempt))"
>
<span class="size-2 shrink-0 rounded-full" :class="dot(a.status)" aria-hidden="true" />
<StatusDot :tone="tone(a.status)" />
<span class="flex-1">Attempt {{ a.attempt }}</span>
<span class="text-xs text-fg-subtle">{{ a.status ? stageStatusMeta(a.status).label : "" }}</span>
</button>
<p v-if="a.started_at" class="px-3 pb-1 pl-7 text-xs text-fg-subtle">
{{ ago(a.started_at) }}<template v-if="a.duration_ms"> · {{ duration(a.duration_ms) }}</template>
<Timestamp :at="a.started_at" /><template v-if="a.duration_ms"> · {{ duration(a.duration_ms) }}</template>
</p>
</li>
</ul>
</section>
</Section>
<section :class="panel" aria-labelledby="rail-stages">
<h2 id="rail-stages" :class="heading">Stages</h2>
<Section title="Stages" class="mb-0">
<StageRail :state="run.attempts" />
</section>
</Section>
<section v-if="run.task" :class="panel" aria-labelledby="rail-details">
<h2 id="rail-details" :class="heading">Details</h2>
<Section v-if="run.task" title="Details" class="mb-0">
<MetadataList :rows="details">
<template #value="{ row }">
<a v-if="row.href" :href="row.href" target="_blank" rel="noreferrer" class="inline-flex items-center gap-0.5 hover:underline"
@@ -75,6 +72,6 @@ const heading = "mb-2 text-caption font-medium tracking-[0.06em] text-fg-subtle
<template v-else>{{ row.value }}</template>
</template>
</MetadataList>
</section>
</Section>
</aside>
</template>
+2 -1
View File
@@ -46,6 +46,7 @@ import { RouterLink, useRouter } from "vue-router";
import { Badge } from "@/components/ui/badge";
import { TableCell, TableRow } from "@/components/ui/table";
import { Timestamp } from "@/components/ui/timestamp";
import { ago } from "@/lib/format";
import { statusKind, statusLabel } from "@/lib/task-meta";
import TaskRowActions from "./TaskRowActions.vue";
@@ -191,7 +192,7 @@ function open() {
props.task.created_at ? `Created ${ago(props.task.created_at)}` : ''
"
>
{{ ago(props.task.updated_at) }}
<Timestamp :at="props.task.updated_at" />
</TableCell>
<TableCell>
<TaskRowActions :task="props.task" @done="emit('done', $event)" />
+5 -32
View File
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { Ellipsis } from "@lucide/vue";
import { computed, ref } from "vue";
import { useRouter } from "vue-router";
import { RadioGroupItem, RadioGroupRoot } from "reka-ui";
@@ -24,12 +23,8 @@ import {
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { DropdownMenuItem } from "@/components/ui/dropdown-menu";
import { MoreMenu } from "@/components/ui/more-menu";
import { Label } from "@/components/ui/label";
import { Textarea } from "@/components/ui/textarea";
import { api, classifyActionError, type ActionErrorKind } from "@/lib/api";
@@ -133,7 +128,6 @@ const linkControls = computed<Control[]>(() =>
controls.value.filter((c) => c.kind === "link"),
);
const menuOpen = ref(false);
const confirmingMeta = computed(() =>
confirmingId.value ? actionFor(confirmingId.value) : null,
@@ -271,14 +265,6 @@ function submitRetry(currentDefinition = false) {
function onConfirmationOpen(open: boolean) {
if (!open) confirming.value = null;
}
// A menu item must close its menu before the dialog can take focus, so both
// surfaces funnel through the same request() once the menu is down; the
// inFlight disabling and the error handling stay identical either way.
function requestFromMenu(id: string) {
menuOpen.value = false;
request(id);
}
</script>
<template>
@@ -333,30 +319,17 @@ function requestFromMenu(id: string) {
</Button>
</template>
<DropdownMenu v-if="overflowControls.length" v-model:open="menuOpen">
<DropdownMenuTrigger as-child>
<Button
variant="ghost"
size="icon-sm"
aria-label="More actions"
:disabled="inFlight"
@click.stop
>
<Ellipsis :size="14" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<span v-if="overflowControls.length" class="contents" @click.stop><MoreMenu label="More actions">
<DropdownMenuItem
v-for="control in overflowControls"
:key="control.id"
:variant="control.kind === 'danger' ? 'destructive' : 'default'"
:disabled="inFlight || (control.id === 'approve' && approveDisabled)"
@click.stop="requestFromMenu(control.id)"
@click.stop="request(control.id)"
>
{{ control.label }}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</MoreMenu></span>
</div>
<Dialog :open="rereviewOpen" @update:open="onRereviewOpen">
+4 -7
View File
@@ -1,7 +1,8 @@
<script setup lang="ts">
import { computed } from "vue";
import { ago } from "@/lib/format";
import { StatusDot } from "@/components/ui/status-dot";
import { Timestamp } from "@/components/ui/timestamp";
import { describeTimelineEvent } from "./timeline-event";
import type { TaskEvent } from "./task-run";
@@ -21,11 +22,7 @@ const line = computed(() => describeTimelineEvent(props.event));
<template>
<li class="flex items-start gap-3">
<span
class="mt-[5px] size-2 shrink-0 rounded-full"
:class="line.tone === 'warn' ? 'bg-warn' : 'bg-primary'"
aria-hidden="true"
/>
<StatusDot :tone="line.tone === 'warn' ? 'warn' : 'info'" class="mt-2" />
<div>
<div class="text-sm font-medium">{{ line.title }}</div>
<div v-if="line.detail" class="mt-0.5 text-xs text-fg-muted">
@@ -40,7 +37,7 @@ const line = computed(() => describeTimelineEvent(props.event));
>{{ link.label }}</RouterLink
>
</div>
<div class="mt-0.5 text-xs text-fg-subtle">{{ ago(event.at) }}</div>
<div class="mt-0.5 text-xs text-fg-subtle"><Timestamp :at="event.at" /></div>
</div>
</li>
</template>