polish-3 share cross-rig dash constant

This commit is contained in:
mvschwarz committed 2026-05-07 00:25:26 -07:00
1 parent 8cc36e9ee4
commit 06cb6b21c6
2 files changed
+9 -4

No files matched your search

+3 -3
View File
@@ -1,5 +1,6 @@
import type { Edge, Node } from "@xyflow/react";
import type { AgentActivitySummary, CurrentQitemSummary } from "../hooks/useNodeInventory.js";
import { HYBRID_CROSS_RIG_STROKE_DASH } from "./hybrid-layout.js";
const SESSION_PAIR_DELIMITER = "\u0000";
@@ -10,7 +11,6 @@ export const HOT_POTATO_CROSS_RIG_DURATION_MS = 1_600;
export const HOT_POTATO_TRAIL_TTL_MS = 3_000;
export const HOT_POTATO_SOURCE_FLASH_MS = 650;
export const HOT_POTATO_TARGET_FLASH_MS = 900;
export const HOT_POTATO_CROSS_RIG_STROKE_DASH = "6 7";
export type ActivityRingState = "active" | "needs_input" | "blocked" | "idle";
export type ActivityFlash = "source" | "target" | null;
@@ -375,7 +375,7 @@ export function applyHotPotatoEdges(
}
function decorateHotPotatoEdge(edge: Edge, packet: HotPotatoPacket | null, reducedMotion: boolean): Edge {
const crossRig = packet?.crossRig || (edge.style as { strokeDasharray?: string } | undefined)?.strokeDasharray === HOT_POTATO_CROSS_RIG_STROKE_DASH;
const crossRig = packet?.crossRig || (edge.style as { strokeDasharray?: string } | undefined)?.strokeDasharray === HYBRID_CROSS_RIG_STROKE_DASH;
const data = {
...(edge.data ?? {}),
hotPotatoPacket: packet,
@@ -399,7 +399,7 @@ function hotPotatoEdgeStyle(crossRig: boolean): Edge["style"] {
return {
stroke: crossRig ? "#a8a29e" : "#047857",
strokeWidth: crossRig ? 1.25 : 2.25,
strokeDasharray: crossRig ? HOT_POTATO_CROSS_RIG_STROKE_DASH : undefined,
strokeDasharray: crossRig ? HYBRID_CROSS_RIG_STROKE_DASH : undefined,
};
}
@@ -104,6 +104,7 @@ describe("P5.3 ActivityRing and HotPotatoEdge", () => {
const ring = readFileSync(path.join(srcRoot, "components/topology/ActivityRing.tsx"), "utf8");
const edge = readFileSync(path.join(srcRoot, "components/topology/HotPotatoEdge.tsx"), "utf8");
const activity = readFileSync(path.join(srcRoot, "lib/topology-activity.ts"), "utf8");
const hybridLayout = readFileSync(path.join(srcRoot, "lib/hybrid-layout.ts"), "utf8");
const css = readFileSync(path.join(srcRoot, "globals.css"), "utf8");
expect(host).toMatch(/useTopologyActivity/);
@@ -118,7 +119,11 @@ describe("P5.3 ActivityRing and HotPotatoEdge", () => {
expect(ring).not.toMatch(/StatusPip/);
expect(edge).toMatch(/animateMotion/);
expect(activity).toMatch(/TOPOLOGY_NODE_ACTIVITY_TTL_MS/);
expect(activity).toMatch(/HOT_POTATO_CROSS_RIG_STROKE_DASH/);
expect(activity).toMatch(/HYBRID_CROSS_RIG_STROKE_DASH/);
expect(activity).not.toMatch(/HOT_POTATO_CROSS_RIG_STROKE_DASH/);
expect(hybridLayout).toContain('export const HYBRID_CROSS_RIG_STROKE_DASH = "6 7"');
const sourceFiles = [activity, hybridLayout];
expect(sourceFiles.join("\n").match(/"6 7"/g) ?? []).toHaveLength(1);
expect(css).toMatch(/@media \(prefers-reduced-motion: reduce\)/);
expect(css).toMatch(/activity-ring-active/);
expect(css).toMatch(/rig-activity-frame-pulse/);