fix(web): let the view decide the blink, not the CSS colour class
A dot's animation was keyed on its colour class plus a component wrapper: `html[data-pi-blink-fast="dim"] .tree-row .dot--ok` made green blink only inside the session tree, `.dot--busy`/`.dot--err` blazed everywhere they appeared, and `dot--steady` existed only to subtract what that selector had just added. Two consequences the matrix in docs/session-dot.md already forbids: a failed task's red blinked forever with no gesture to acknowledge it, and the same session could blink in the list and sit solid in the stream head. `DotView` now carries the rate (`blink: "fast" | "slow"`, omitted = solid) next to the colour, and `<StatusDot>` renders it as `dot--blink-fast` / `dot--blink-slow`. `dot--steady` is gone — to make a dot solid you omit `blink`. app.css keeps exactly two dim rules, with no colour or component scoping and no knowledge of *whether* anything blinks, only of when the shared clock dims it. Filling in the matrix this exposed: parent `err`/`ok`/`busy` blink fast and `compacting` slow; a viewed child or subagent failure is solid while an unviewed one blinks; `interrupted` is the same solid dead red as `exited` (the plugin has no interrupted, and in the plugin `exited` outranks its own unread flags — `sessionDot(active)` is now rendered `viewed: true` for the stream head, so one session can never show two different rates); task dots follow `:PiTasks` (`taskDotView`, shared by the tray and the output modal) where only `running` blinks, `completed` is solid green and `stopped` is amber attention. The `/status` task card renders the same colours, solid, since nothing there acknowledges anything.
This commit is contained in:
1 parent
604fec5ea0
commit
e7ce064817
16 files changed
+658
-139
No files matched your search
@@ -66,17 +66,35 @@ describe("StatusDot", () => {
|
||||
expect(container.firstElementChild).toHaveClass("dot", expected);
|
||||
});
|
||||
|
||||
it("applies dot--steady modifier when steady is true", () => {
|
||||
const { container } = render(<StatusDot status="err" steady={true} />);
|
||||
expect(container.firstElementChild).toHaveClass("dot", "dot--err", "dot--steady");
|
||||
it("applies the fast blink class only when blink='fast'", () => {
|
||||
const { container } = render(<StatusDot status="err" blink="fast" />);
|
||||
expect(container.firstElementChild).toHaveClass("dot", "dot--err", "dot--blink-fast");
|
||||
expect(container.firstElementChild).not.toHaveClass("dot--blink-slow");
|
||||
});
|
||||
|
||||
it("does not apply dot--steady when steady is false or omitted", () => {
|
||||
const { container: c1 } = render(<StatusDot status="err" steady={false} />);
|
||||
expect(c1.firstElementChild).not.toHaveClass("dot--steady");
|
||||
it("applies the slow blink class only when blink='slow'", () => {
|
||||
const { container } = render(<StatusDot status="compacting" blink="slow" />);
|
||||
expect(container.firstElementChild).toHaveClass("dot", "dot--compacting", "dot--blink-slow");
|
||||
expect(container.firstElementChild).not.toHaveClass("dot--blink-fast");
|
||||
});
|
||||
|
||||
const { container: c2 } = render(<StatusDot status="err" />);
|
||||
expect(c2.firstElementChild).not.toHaveClass("dot--steady");
|
||||
it("carries neither blink class when blink is omitted or null", () => {
|
||||
const { container: c1 } = render(<StatusDot status="err" />);
|
||||
expect(c1.firstElementChild).not.toHaveClass("dot--blink-fast");
|
||||
expect(c1.firstElementChild).not.toHaveClass("dot--blink-slow");
|
||||
|
||||
const { container: c2 } = render(<StatusDot status="err" blink={null} />);
|
||||
expect(c2.firstElementChild).not.toHaveClass("dot--blink-fast");
|
||||
expect(c2.firstElementChild).not.toHaveClass("dot--blink-slow");
|
||||
});
|
||||
|
||||
it("never encodes the blink in the colour class (a solid err dot is still dot--err)", () => {
|
||||
// The old bug: the animation was keyed on the colour class + the wrapper.
|
||||
const solid = render(<StatusDot status="err" />);
|
||||
const blinking = render(<StatusDot status="err" blink="fast" />);
|
||||
expect(solid.container.firstElementChild).toHaveClass("dot--err");
|
||||
expect(blinking.container.firstElementChild).toHaveClass("dot--err");
|
||||
expect(solid.container.firstElementChild).not.toHaveClass("dot--blink-fast");
|
||||
});
|
||||
|
||||
it("applies dot--current modifier when current is true", () => {
|
||||
@@ -92,14 +110,25 @@ describe("StatusDot", () => {
|
||||
expect(c2.firstElementChild).not.toHaveClass("dot--current");
|
||||
});
|
||||
|
||||
it("supports steady and current modifiers together", () => {
|
||||
const { container } = render(<StatusDot status="busy" steady current />);
|
||||
expect(container.firstElementChild).toHaveClass("dot", "dot--busy", "dot--steady", "dot--current");
|
||||
it("composes blink, current and a custom className", () => {
|
||||
const { container } = render(<StatusDot status="busy" blink="fast" current className="custom-dot" />);
|
||||
expect(container.firstElementChild).toHaveClass(
|
||||
"dot",
|
||||
"dot--busy",
|
||||
"dot--blink-fast",
|
||||
"dot--current",
|
||||
"custom-dot",
|
||||
);
|
||||
});
|
||||
|
||||
it("preserves custom className alongside modifiers", () => {
|
||||
const { container } = render(<StatusDot status="idle" steady current className="custom-dot" />);
|
||||
expect(container.firstElementChild).toHaveClass("dot", "dot--idle", "dot--steady", "dot--current", "custom-dot");
|
||||
it("composes a slow blink with the current marker", () => {
|
||||
const { container } = render(<StatusDot status="compacting" blink="slow" current />);
|
||||
expect(container.firstElementChild).toHaveClass(
|
||||
"dot",
|
||||
"dot--compacting",
|
||||
"dot--blink-slow",
|
||||
"dot--current",
|
||||
);
|
||||
});
|
||||
|
||||
it("exposes the state label when a title is provided", () => {
|
||||
|
||||
Reference in new issue
Block a user