feat(webui): compact quality gates card, drop the setup celebration, hover nav

Three dashboard refinements from operator feedback:

The setup panel's completed state was celebration prose -- a full card
saying setup was done, occupying a grid cell until dismissed. A
configured daemon is the absence of a problem: the state machine now
only distinguishes incomplete from omit, the checklist returns on its
own if setup regresses, and the dismissal machinery is deleted with it.

'Gate pulse' led with a donut whose entire payload was one number, and
the name was decoration too. The card is 'Quality gates' now: the pass
rate as the number itself beside its run count, per-workflow rows as
tight hairline rows instead of muted pills, and the parked line is gone
-- Throughput's Needs-you tile already speaks for parked tasks, from the
statuses themselves. base/Gauge.vue had no other consumer and is deleted.

Topbar nav groups open on hover and close on leave, with a short grace
period bridging the trigger-to-content gap; click and keyboard
activation keep working through the same controlled open state.

The live activity feed scrolls within its card (previous commit); the
health row's cards are now compact enough to match it.
This commit is contained in:
sam committed 2026-09-23 14:53:40 +10:00
1 parent ec7e306232
commit 4f90b97a86
9 files changed
+132 -168

No files matched your search

-75
View File
@@ -1,75 +0,0 @@
<script setup lang="ts">
import { computed } from "vue";
/**
* Arc gauge for a single headline percentage.
*
* A percentage that decides whether you need to act deserves more than a line
* of text: the arc is readable at a glance from across a room, which a number
* is not. Colour follows the value, so "is this bad" is answered before the
* digits are read.
*/
const props = withDefaults(defineProps<{ value: number | string; label: string; size?: number }>(), {
size: 168,
});
const pct = computed(() => Math.max(0, Math.min(100, Number(props.value) || 0)));
const rounded = computed(() => Math.round(pct.value));
const stroke = computed(() => (pct.value >= 90 ? "var(--ok)" : pct.value >= 70 ? "var(--warn)" : "var(--danger)"));
// 240-degree arc, opening downward, so the value reads left-to-right.
const R = 62;
const SWEEP = 240;
const START = 150;
const circumference = 2 * Math.PI * R * (SWEEP / 360);
function arc(from: number, deg: number): string {
const cx = props.size / 2;
const cy = props.size / 2;
const a0 = (from * Math.PI) / 180;
const a1 = ((from + deg) * Math.PI) / 180;
const large = deg > 180 ? 1 : 0;
return [
`M ${cx + R * Math.cos(a0)} ${cy + R * Math.sin(a0)}`,
`A ${R} ${R} 0 ${large} 1 ${cx + R * Math.cos(a1)} ${cy + R * Math.sin(a1)}`,
].join(" ");
}
</script>
<template>
<div class="relative grid place-items-center">
<!--
The label announces the rounded value. It used to announce the raw one, so
a screen reader read "71.38461538461539%" before the same figure was
shown rounded.
-->
<svg
class="block w-full max-w-[200px]"
:viewBox="`0 0 ${props.size} ${props.size * 0.78}`"
role="img"
:aria-label="`${props.label}: ${rounded}%`"
>
<path
:d="arc(START, SWEEP)"
fill="none"
stroke="var(--border)"
stroke-width="12"
stroke-linecap="round"
/>
<path
:d="arc(START, SWEEP)"
fill="none"
:stroke="stroke"
stroke-width="12"
stroke-linecap="round"
:stroke-dasharray="circumference"
:stroke-dashoffset="circumference * (1 - pct / 100)"
class="transition-[stroke-dashoffset] duration-[600ms] ease-[cubic-bezier(0.4,0,0.2,1)]"
/>
</svg>
<div class="absolute top-[52%] -translate-y-1/2 text-center">
<div class="text-2xl font-semibold tracking-[-0.03em]">{{ rounded }}%</div>
<div class="text-xs text-fg-muted">{{ props.label }}</div>
</div>
</div>
</template>
+42 -9
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { ref } from "vue";
import { ChevronDown } from "@lucide/vue";
import {
@@ -15,17 +16,49 @@ import NavTrigger from "./NavTrigger.vue";
const props = defineProps<{ label: string; items: NavEntry[]; activePath: string }>();
const holds = (path: string) => props.activePath === path;
/**
* Hover-open, click-toggling menu.
*
* Pointing at the group opens it; leaving it closes it after a short grace
* period, so the move from trigger to content cannot close what you are
* moving towards (the content carries its own enter/leave handlers, and the
* delay covers the gap between two teleported elements). The trigger keeps
* its click and keyboard semantics: reka still emits update:open on
* activation, this only controls how long the menu stays open.
*/
const open = ref(false);
let closeTimer: ReturnType<typeof setTimeout> | undefined;
function openMenu() {
clearTimeout(closeTimer);
open.value = true;
}
function closeMenuSoon() {
clearTimeout(closeTimer);
closeTimer = setTimeout(() => {
open.value = false;
}, 140);
}
</script>
<template>
<DropdownMenu>
<DropdownMenuTrigger as-child>
<NavTrigger :current="items.some((item) => holds(item.path))">
{{ label }}
<ChevronDown :size="14" class="opacity-60" />
</NavTrigger>
</DropdownMenuTrigger>
<DropdownMenuContent align="start" class="w-52">
<DropdownMenu :open="open" @update:open="open = $event">
<div class="flex" @pointerenter="openMenu" @pointerleave="closeMenuSoon">
<DropdownMenuTrigger as-child>
<NavTrigger :current="items.some((item) => holds(item.path))">
{{ props.label }}
<ChevronDown :size="14" class="opacity-60" />
</NavTrigger>
</DropdownMenuTrigger>
</div>
<DropdownMenuContent
align="start"
class="w-52"
@pointerenter="openMenu"
@pointerleave="closeMenuSoon"
>
<template v-for="item in items" :key="item.path">
<DropdownMenuSeparator v-if="item.dividerBefore" />
<DropdownMenuLabel v-if="item.dividerBefore">{{ item.dividerBefore }}</DropdownMenuLabel>
@@ -33,4 +66,4 @@ const holds = (path: string) => props.activePath === path;
</template>
</DropdownMenuContent>
</DropdownMenu>
</template>
</template>
+5 -10
View File
@@ -17,26 +17,21 @@ import TokenOutlookCard from "./TokenOutlookCard.vue";
*/
useDashboard();
const omitSetup = computed(() => {
const kind = setupPanelState(setup.value).kind;
return kind === "omit" || kind === "dismissed";
});
const setupIncomplete = computed(() => setupPanelState(setup.value).kind === "incomplete");
</script>
<template>
<DashboardHero />
<!--
Each health card takes its own content height rather than the row's.
Matching them was right while both held a checklist, but once setup is done
that card is a title and a line while Gate pulse carries a gauge and four
rows, so equalising them left a mostly-empty box taking a quarter of the
first screen. No setup panel to show: the pulse spans the row instead.
The Health row holds the pulse alone once setup is done: the checklist
only renders while there is setup work left, so the grid collapses to a
single column instead of pairing a checklist with an empty neighbour.
-->
<DashboardSection title="Health">
<div
class="grid items-start gap-4"
:class="omitSetup ? 'grid-cols-1' : 'grid-cols-1 min-[1080px]:grid-cols-[minmax(0,1.6fr)_minmax(0,1fr)]'"
:class="setupIncomplete ? 'grid-cols-1 min-[1080px]:grid-cols-[minmax(0,1.6fr)_minmax(0,1fr)]' : 'grid-cols-1'"
>
<SetupPanel />
<GatePulseCard />
+23 -17
View File
@@ -1,11 +1,10 @@
<script setup lang="ts">
import { computed } from "vue";
import Gauge from "@/base/Gauge.vue";
import { Badge } from "@/components/ui/badge";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
import { summary, workflows } from "./state";
import { workflows } from "./state";
/** Sharer of runs: how much of the work that finished passed its gates. */
const stats = computed(() => workflows.value?.workflows ?? []);
@@ -13,15 +12,19 @@ const stats = computed(() => workflows.value?.workflows ?? []);
const totals = computed(() => ({
runs: stats.value.reduce((a, w) => a + (w.runs || 0), 0),
merged: stats.value.reduce((a, w) => a + (w.merged || 0) + (w.pr_open || 0), 0),
parked: stats.value.reduce((a, w) => a + (w.parked || 0), 0),
}));
const pct = computed(() => {
if (!totals.value.runs) return 0;
return Math.round((totals.value.merged / totals.value.runs) * 100);
});
</script>
<template>
<Card v-if="summary">
<Card v-if="workflows">
<CardHeader>
<CardTitle>Gate pulse</CardTitle>
<CardDescription v-if="totals.runs">Work that passed its quality gates</CardDescription>
<CardTitle>Quality gates</CardTitle>
<CardDescription>Work that passed its quality gates</CardDescription>
</CardHeader>
<CardContent>
<Empty v-if="!totals.runs">
@@ -30,27 +33,30 @@ const totals = computed(() => ({
</EmptyHeader>
</Empty>
<template v-else>
<Gauge :value="(totals.merged / totals.runs) * 100" label="pass rate" />
<ul class="mt-4 flex flex-col gap-2">
<!--
The rate is a number, not a gauge: one value carrying one meaning
reads at a glance, and the rows under it are the actual signal.
Per-workflow counts are the card's body; parked tasks are not
listed here -- Throughput's "Needs you" tile already speaks for
them, from the statuses themselves.
-->
<div class="flex items-baseline gap-2">
<span class="text-3xl font-semibold">{{ pct }}%</span>
<span class="text-xs text-fg-muted">pass rate · {{ totals.runs }} runs</span>
</div>
<ul class="mt-3 flex flex-col">
<li
v-for="(w, i) in stats.slice(0, 3)"
:key="i"
class="flex items-center justify-between gap-3 rounded-sm bg-muted px-3 py-2 text-sm"
class="flex items-center justify-between gap-3 border-b border-hairline py-1.5 text-sm last:border-b-0"
>
<span class="truncate text-fg-muted">{{ w.workflow || "workflow" }}</span>
<Badge :variant="(w.merged || 0) === (w.runs || 0) ? 'ok' : (w.parked || 0) > 0 ? 'warn' : 'info'">
{{ w.merged || 0 }}/{{ w.runs || 0 }}
</Badge>
</li>
<li
v-if="totals.parked > 0"
class="flex items-center justify-between gap-3 rounded-sm bg-muted px-3 py-2 text-sm"
>
<span class="truncate text-fg-muted">Parked, awaiting you</span>
<Badge variant="warn">{{ totals.parked }}</Badge>
</li>
</ul>
</template>
</CardContent>
</Card>
</template>
</template>
+9 -27
View File
@@ -1,19 +1,19 @@
<script setup lang="ts">
import { Check, X } from "@lucide/vue";
import { Check } from "@lucide/vue";
import { computed, ref, watch } from "vue";
import { Button } from "@/components/ui/button";
import { Card, CardAction, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import { Progress } from "@/components/ui/progress";
import { dismissSetupComplete, setupPanelState, type SetupPanelState } from "./setup-preference";
import { setupPanelState, type SetupPanelState } from "./setup-preference";
import { setup } from "./state";
/**
* The setup checklist, or its completion note.
* The setup checklist, rendered only while there is setup work left.
*
* Which of the two this shows comes from the state machine rather than from
* "is setup present at all": guarding on presence showed a 100% checklist with
* every step struck through where the complete state belongs.
* A fully configured daemon renders nothing: the old completion card ("Setup
* complete", with a check and a dismiss button) celebrated the absence of a
* problem and occupied a grid cell until dismissed. Setup regressing to
* incomplete brings the checklist back on its own.
*/
const panel = ref<SetupPanelState>(setupPanelState(setup.value));
@@ -27,11 +27,6 @@ const pct = computed(() => {
if (!total) return 0;
return Math.round(((total - panel.value.remaining.length) / total) * 100);
});
function dismiss() {
dismissSetupComplete();
panel.value = setupPanelState(setup.value);
}
</script>
<template>
@@ -61,17 +56,4 @@ function dismiss() {
</ul>
</CardContent>
</Card>
<Card v-else-if="panel.kind === 'complete'">
<CardHeader>
<CardTitle>Setup complete</CardTitle>
<CardDescription>Archie is configured and ready to work.</CardDescription>
<CardAction class="flex items-center gap-2">
<Check class="size-4 text-ok" />
<Button variant="ghost" size="icon-sm" aria-label="Dismiss setup complete" @click="dismiss">
<X />
</Button>
</CardAction>
</CardHeader>
</Card>
</template>
</template>
+11 -27
View File
@@ -1,5 +1,3 @@
export const SETUP_DISMISSAL_KEY = "archie.setup-complete.dismissed.v1";
/** One setup step as the daemon reports it. */
export interface SetupStep {
title: string;
@@ -12,33 +10,19 @@ export interface Setup {
operator?: string;
}
/** The storage surface this needs, so it is testable without a browser. */
export type SetupStorage = Pick<Storage, "getItem" | "removeItem" | "setItem">;
export interface SetupPanelState {
kind: "omit" | "incomplete" | "complete" | "dismissed";
/** omit: nothing to show — no setup data, or setup fully done. */
kind: "omit" | "incomplete";
remaining: SetupStep[];
}
// setupPanelState reconciles persisted presentation state with current setup
// truth. If setup later becomes incomplete, an old dismissal is cleared so the
// operator cannot miss the new work.
export function setupPanelState(
setup: Setup | null | undefined,
storage: SetupStorage | undefined = globalThis.localStorage,
): SetupPanelState {
if (!setup?.steps?.length) return { kind: "omit", remaining: [] };
const remaining = setup.steps.filter((step) => !step.done);
if (remaining.length) {
storage?.removeItem?.(SETUP_DISMISSAL_KEY);
return { kind: "incomplete", remaining };
// setupPanelState distinguishes the only two states worth rendering: there is
// setup work left (the checklist), or there is not (nothing — a configured
// daemon is the absence of a problem, not a card announcing it).
export function setupPanelState(setup: Setup | null | undefined): SetupPanelState {
const remaining = (setup?.steps ?? []).filter((step) => !step.done);
if (!setup?.steps?.length || !remaining.length) {
return { kind: "omit", remaining: [] };
}
if (storage?.getItem?.(SETUP_DISMISSAL_KEY) === "1") {
return { kind: "dismissed", remaining: [] };
}
return { kind: "complete", remaining: [] };
}
export function dismissSetupComplete(storage: SetupStorage | undefined = globalThis.localStorage): void {
storage?.setItem?.(SETUP_DISMISSAL_KEY, "1");
}
return { kind: "incomplete", remaining };
}