refactor(ui): extract Pill to ui/src/base/, closing archie-core-mlro
Pill was independently duplicated byte-for-byte across 11 files
(tasks, logs, mapping-editor, capture-row, settings, update-status,
skills, dashboard, memory, channels, curators) plus the bindings page
built earlier this session -- a violation of organisation.md's
"extract on the second distinct consumer" rule, predating this
session entirely. Found while building the bindings UI.
Mechanical extraction only, no behavior change: ui/src/base/pill.jsx
is now the single definition; every call site imports from there.
skills.jsx's copy used `class=` instead of `className=` (functionally
identical in Preact) -- normalized to the shared version's className.
captures.jsx's import of Pill (previously re-exported through
capture-row.jsx) now points at the shared module directly.
Verified via task test:ui (120/120 unchanged) and, since this touches
the exact rendering path that had a real app-wide regression earlier
tonight (commit 4fa478a), re-verified in a real browser across all 12
pages: zero "[object Object]" occurrences, and every page's .pill
elements render with real content (settings: 9, bindings: 2, etc.),
not just "the build succeeded."
This commit is contained in:
1 parent
e8f1c09a5b
commit
cc95f854de
15 files changed
+33
-54
No files matched your search
@@ -0,0 +1,13 @@
|
||||
import { h } from "preact";
|
||||
|
||||
/**
|
||||
* Status pill: a small labeled badge whose color follows a semantic kind
|
||||
* (ok/warn/danger/info/idle -- see css/pill.css). Extracted from 11
|
||||
* independent, byte-identical local copies (tasks, logs, mappings,
|
||||
* captures, settings, update-status, skills, dashboard, memory, channels,
|
||||
* curators) per organisation.md's "extract on the second distinct
|
||||
* consumer" rule -- archie-core-mlro.
|
||||
*/
|
||||
export function Pill({ text, kind = "idle" }) {
|
||||
return <span className={`pill pill-${kind}`}>{text}</span>;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { h } from "preact";
|
||||
import { Pill } from "../base/pill.jsx";
|
||||
|
||||
/**
|
||||
* Pure rendering logic for the bindings editor, split out from
|
||||
@@ -6,10 +7,6 @@ import { h } from "preact";
|
||||
* mirroring mappings/mapping-editor.jsx.
|
||||
*/
|
||||
|
||||
function Pill({ text, kind = "idle" }) {
|
||||
return <span className={`pill pill-${kind}`}>{text}</span>;
|
||||
}
|
||||
|
||||
const STATUS_LABELS = {
|
||||
draft: "draft",
|
||||
pending_approval: "pending approval",
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { h, Fragment } from "preact";
|
||||
import { ago } from "../base/dom.jsx";
|
||||
|
||||
export function Pill({ text, kind = "idle" }) {
|
||||
return <span className={`pill pill-${kind}`}>{text}</span>;
|
||||
}
|
||||
import { Pill } from "../base/pill.jsx";
|
||||
|
||||
/**
|
||||
* One captured event's summary row, plus its expandable detail row when
|
||||
|
||||
@@ -2,7 +2,8 @@ import { h, Fragment } from "preact";
|
||||
import { useState, useEffect } from "preact/hooks";
|
||||
import "./captures.css";
|
||||
import { api, subscribeEvents } from "../base/api.jsx";
|
||||
import { CaptureRow, Pill } from "./capture-row.jsx";
|
||||
import { CaptureRow } from "./capture-row.jsx";
|
||||
import { Pill } from "../base/pill.jsx";
|
||||
|
||||
export function Empty({ title, detail }) {
|
||||
return (
|
||||
|
||||
@@ -2,10 +2,7 @@ import { h } from "preact";
|
||||
import { useState, useEffect } from "preact/hooks";
|
||||
import "./channels.css";
|
||||
import { api } from "../base/api.jsx";
|
||||
|
||||
export function Pill({ text, kind = "idle" }) {
|
||||
return <span className={`pill pill-${kind}`}>{text}</span>;
|
||||
}
|
||||
import { Pill } from "../base/pill.jsx";
|
||||
|
||||
export function Empty({ title, detail }) {
|
||||
return (
|
||||
|
||||
@@ -3,10 +3,7 @@ import { useState, useEffect } from "preact/hooks";
|
||||
import "./curators.css";
|
||||
import { api } from "../base/api.jsx";
|
||||
import { ago } from "../base/dom.jsx";
|
||||
|
||||
function Pill({ text, kind = "idle" }) {
|
||||
return <span className={`pill pill-${kind}`}>{text}</span>;
|
||||
}
|
||||
import { Pill } from "../base/pill.jsx";
|
||||
|
||||
function Empty({ title, detail }) {
|
||||
return (
|
||||
|
||||
@@ -6,6 +6,7 @@ import { ago, compact, statusKind } from "../base/dom.jsx";
|
||||
import { statTile } from "../base/statTile.jsx";
|
||||
import { gauge, segmentBar } from "../base/gauge.jsx";
|
||||
import { icon } from "../base/icons.jsx";
|
||||
import { Pill } from "../base/pill.jsx";
|
||||
import { dismissSetupComplete, setupPanelState } from "./setup-preference.jsx";
|
||||
import { dashboardTaskTargets } from "./task-targets.jsx";
|
||||
|
||||
@@ -45,10 +46,6 @@ function Empty({ title, detail }) {
|
||||
);
|
||||
}
|
||||
|
||||
function Pill({ text, kind = "idle" }) {
|
||||
return <span className={`pill pill-${kind}`}>{text}</span>;
|
||||
}
|
||||
|
||||
function taskIDForEvent(event, taskIDsBySource) {
|
||||
if (Number(event.task_id) > 0) return Number(event.task_id);
|
||||
if (!event.repo || !event.issue) return 0;
|
||||
|
||||
@@ -2,10 +2,7 @@ import { h } from "preact";
|
||||
import { useState, useEffect, useRef, useMemo } from "preact/hooks";
|
||||
import "./logs.css";
|
||||
import { api, subscribeLogs } from "../base/api.jsx";
|
||||
|
||||
function Pill({ text, kind = "idle" }) {
|
||||
return <span className={`pill pill-${kind}`}>{text}</span>;
|
||||
}
|
||||
import { Pill } from "../base/pill.jsx";
|
||||
|
||||
function Empty({ title, detail }) {
|
||||
return (
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import { h, Fragment } from "preact";
|
||||
|
||||
export function Pill({ text, kind = "idle" }) {
|
||||
return <span className={`pill pill-${kind}`}>{text}</span>;
|
||||
}
|
||||
import { Pill } from "../base/pill.jsx";
|
||||
|
||||
/**
|
||||
* Pure rendering + path/type logic for the mapping editor, split out from
|
||||
|
||||
@@ -2,10 +2,7 @@ import { h } from "preact";
|
||||
import { useState, useEffect } from "preact/hooks";
|
||||
import "./memory.css";
|
||||
import { api } from "../base/api.jsx";
|
||||
|
||||
function Pill({ text, kind = "idle" }) {
|
||||
return <span className={`pill pill-${kind}`}>{text}</span>;
|
||||
}
|
||||
import { Pill } from "../base/pill.jsx";
|
||||
|
||||
function Empty({ title, detail }) {
|
||||
return (
|
||||
|
||||
@@ -3,13 +3,10 @@ import { useState, useEffect } from "preact/hooks";
|
||||
import "./settings.css";
|
||||
import { api } from "../base/api.jsx";
|
||||
import { statusKind, statusLabel } from "../base/task-meta.jsx";
|
||||
import { Pill } from "../base/pill.jsx";
|
||||
import { Row } from "./config-row.jsx";
|
||||
import { UpdateStatusCard } from "./update-status.jsx";
|
||||
|
||||
function Pill({ text, kind = "idle" }) {
|
||||
return <span className={`pill pill-${kind}`}>{text}</span>;
|
||||
}
|
||||
|
||||
function Empty({ title, detail }) {
|
||||
return (
|
||||
<div className="empty">
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import { h } from "preact";
|
||||
|
||||
function Pill({ text, kind = "idle" }) {
|
||||
return <span className={`pill pill-${kind}`}>{text}</span>;
|
||||
}
|
||||
import { Pill } from "../base/pill.jsx";
|
||||
|
||||
function Empty({ title, detail }) {
|
||||
return (
|
||||
|
||||
@@ -2,6 +2,7 @@ import { h, Fragment } from "preact";
|
||||
import { useState, useEffect, useMemo } from "preact/hooks";
|
||||
import "./skills.css";
|
||||
import { api } from "../base/api.jsx";
|
||||
import { Pill } from "../base/pill.jsx";
|
||||
|
||||
function Empty({ title, detail }) {
|
||||
return (
|
||||
@@ -12,10 +13,6 @@ function Empty({ title, detail }) {
|
||||
);
|
||||
}
|
||||
|
||||
function Pill({ text, kind = "idle" }) {
|
||||
return <span class={`pill pill-${kind}`}>{text}</span>;
|
||||
}
|
||||
|
||||
export function skillsPage(query) {
|
||||
return <SkillsApp query={query} />;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useState, useEffect, useRef } from "preact/hooks";
|
||||
import "./tasks.css";
|
||||
import { api } from "../base/api.jsx";
|
||||
import { ago } from "../base/dom.jsx";
|
||||
import { Pill } from "../base/pill.jsx";
|
||||
import { statTile as renderStatTile } from "../base/statTile.jsx";
|
||||
import { taskRowA11y } from "./task-row.jsx";
|
||||
import { initialTaskFilter, taskMatchesStatus } from "./task-filters.jsx";
|
||||
@@ -18,9 +19,6 @@ function StatTileNode(props) {
|
||||
return <div ref={ref} style={{ display: 'contents' }} />;
|
||||
}
|
||||
|
||||
function Pill({ text, kind = "idle" }) {
|
||||
return <span className={`pill pill-${kind}`}>{text}</span>;
|
||||
}
|
||||
|
||||
function Empty({ title, detail }) {
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user