feat(webui): port the shared primitives (Phase 2)
The Preact tree's ui/src/base/ was deleted with the dashboard. This rebuilds what depended on it, on the shadcn layer rather than as new bespoke markup. Badge and Card come from the shadcn-vue CLI, so they match the already-vendored components, and the composed pieces sit on top of them: - Badge gains the five status variants the pills used, over the palette's status tokens. The pill's dot did not come across: the Badge's own shape is the affordance, and the same variant now covers a trend indicator, where a dot reads as noise. - base/StatTile.vue uses full Card composition instead of dumping everything into one content slot, with base/Sparkline.vue and the goodDirection logic that says whether "up" is good news. - base/Gauge.vue and base/SegmentBar.vue, both of them: the original exported two components from one file and budget composition uses the second. - base/LogRow.vue over lib/log.ts, which holds the LOG_LEVELS wire contract (the server matches that CSV server-side, so it is not a display choice). - lib/status.ts, so status colour has one home: a task state, a gate result, a log level and a trend all draw from the same five kinds. Two deliberate departures: The icon module is not ported. Its name-to-glyph string lookup is the pattern shadcn-vue's rules call out as wrong, and nothing consumes the five bespoke glyphs anyway: the navigation is text with tooltips. Icons come from @lucide/vue at the call site, and the five become components if a page draws them. The gauge's aria-label announces the rounded percentage. It announced the raw one, so a screen reader read 71.38461538461539% where the screen showed 71% (bead 86au). Also lands the four modules the checklist marks copy-verbatim, which encode bugs fixed just before the delete: dashboard/activity-detail, chat/ command-scroll, workflows/workflow-rows and logs/logs-empty.
This commit is contained in:
1 parent
c578a4d6c3
commit
3d20dde9cb
23 files changed
+740
-16
No files matched your search
@@ -0,0 +1,43 @@
|
||||
// Live activity's detail column.
|
||||
//
|
||||
// The daemon puts whatever a stage produced into an event's detail, so the
|
||||
// column holds anything from "session-memory" to a few thousand characters of
|
||||
// agent transcript. Printed raw, one agent_finish row was taller than six
|
||||
// viewports and the table stopped being scannable (archie-core-qo7f).
|
||||
//
|
||||
// The rule is one line in the cell, the whole payload still available. The cut
|
||||
// happens here rather than in CSS because the row also needs to know whether
|
||||
// there is more to show.
|
||||
|
||||
// Long enough for a useful parked reason, short enough that every row is the
|
||||
// same height at the widths the table is used at.
|
||||
const CELL_LIMIT = 160;
|
||||
|
||||
/** An activity event, as far as this column reads it. */
|
||||
export interface ActivityEvent {
|
||||
detail?: unknown;
|
||||
message?: unknown;
|
||||
}
|
||||
|
||||
/** The cell's content: the rendered line, the payload, and whether they differ. */
|
||||
export interface ActivityDetail {
|
||||
text: string;
|
||||
full: string;
|
||||
truncated: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* activityDetail returns `{ text, full, truncated }` for one event:
|
||||
* `text` is the single line the cell renders, `full` the untouched payload,
|
||||
* and `truncated` whether the two differ.
|
||||
*/
|
||||
export function activityDetail(event: ActivityEvent | undefined): ActivityDetail {
|
||||
const full = String(event?.detail || event?.message || "");
|
||||
if (!full) return { text: "", full: "", truncated: false };
|
||||
|
||||
// The first line that says something: agent output often opens with blanks.
|
||||
const firstLine = full.split("\n").map((line) => line.trim()).find(Boolean) || "";
|
||||
const clipped = firstLine.length > CELL_LIMIT ? `${firstLine.slice(0, CELL_LIMIT).trimEnd()}…` : firstLine;
|
||||
|
||||
return { text: clipped, full, truncated: clipped !== full };
|
||||
}
|
||||
Reference in new issue
Block a user