From 92ed60a071cc5457d942a914ef2a78e2ce150e3b Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 18 May 2026 04:24:52 +0100 Subject: [PATCH] Allow EpiphanyGraph viewer labels --- .../src/lib/EpiphanyGraphViewer.tsx | 52 ++++++++++++++----- web/epiphany-graph-viewer/src/lib/types.ts | 5 ++ 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/web/epiphany-graph-viewer/src/lib/EpiphanyGraphViewer.tsx b/web/epiphany-graph-viewer/src/lib/EpiphanyGraphViewer.tsx index 99007dc..85210b9 100644 --- a/web/epiphany-graph-viewer/src/lib/EpiphanyGraphViewer.tsx +++ b/web/epiphany-graph-viewer/src/lib/EpiphanyGraphViewer.tsx @@ -39,6 +39,8 @@ export function EpiphanyGraphViewer({ style, className, title = "Epiphany Graph Viewer", + graphLabels, + graphDescriptions, onSelectionChange, onCodeRefSelect, }: EpiphanyGraphViewerProps) { @@ -179,6 +181,18 @@ export function EpiphanyGraphViewer({ selection?.kind === "edge" && selection.graphKey === activeGraphKey && activeLayout ? activeLayout.edges.find((edge) => edge.resolvedId === selection.edgeId) ?? null : null; + const labels = { + architecture: graphLabels?.architecture ?? "Architecture", + dataflow: graphLabels?.dataflow ?? "Dataflow", + }; + const descriptions = { + architecture: + graphDescriptions?.architecture ?? + "Architecture nodes describe durable system parts: stores, renderers, promoters, bridges, and shells.", + dataflow: + graphDescriptions?.dataflow ?? + "Dataflow nodes describe the movement of evidence and structure through the pipeline: observations, proposals, validation, fragments, turns.", + }; const neighboringIds = new Set(); if (selectedNode && activeLayout) { @@ -249,7 +263,7 @@ export function EpiphanyGraphViewer({
startTransition(() => { @@ -262,7 +276,7 @@ export function EpiphanyGraphViewer({ /> startTransition(() => { @@ -336,7 +350,7 @@ export function EpiphanyGraphViewer({ }} >
- {activeGraphKey === "architecture" ? "Architecture graph" : "Dataflow graph"} + {labels[activeGraphKey]} graph
Wheel to zoom. Drag the void to pan. Click something interesting and the side panel stops being decorative.
@@ -642,7 +656,7 @@ export function EpiphanyGraphViewer({ Live graph
- {activeGraphKey === "architecture" ? "Architecture" : "Dataflow"} + {labels[activeGraphKey]}
{ @@ -734,10 +749,14 @@ export function EpiphanyGraphViewer({ ) : selectedEdge ? ( onCodeRefSelect?.(codeRef, { graphKey: activeGraphKey, selection })} /> ) : ( - + )} @@ -866,6 +885,7 @@ function StageMessage({ function NodeDetails({ node, graphKey, + graphLabels, linkedNodes, links, onJump, @@ -873,6 +893,7 @@ function NodeDetails({ }: { node: PositionedNode; graphKey: GraphKey; + graphLabels: Record; linkedNodes: Array<{ graphKey: GraphKey; nodeId: string; @@ -903,7 +924,7 @@ function NodeDetails({

{node.title}

- + {node.status?.trim() && } @@ -950,7 +971,7 @@ function NodeDetails({ {linked.title} - {linked.graphKey} • {linked.nodeId} + {graphLabels[linked.graphKey]} • {linked.nodeId} {linked.relationship ? ` • ${linked.relationship}` : ""} @@ -965,9 +986,11 @@ function NodeDetails({ function EdgeDetails({ edge, + graphLabels, onCodeRefSelect, }: { edge: PositionedEdge; + graphLabels: Record; onCodeRefSelect: (codeRef: EpiphanyCodeRef) => void; }) { return ( @@ -987,7 +1010,8 @@ function EdgeDetails({ {edge.label?.trim() || edge.kind}
- + + {edge.id?.trim() && }
@@ -1000,7 +1024,13 @@ function EdgeDetails({ ); } -function EmptyDetails({ activeGraphKey }: { activeGraphKey: GraphKey }) { +function EmptyDetails({ + activeGraphKey, + graphDescriptions, +}: { + activeGraphKey: GraphKey; + graphDescriptions: Record; +}) { return ( <>
@@ -1019,9 +1049,7 @@ function EmptyDetails({ activeGraphKey }: { activeGraphKey: GraphKey }) {
- {activeGraphKey === "architecture" - ? "Architecture nodes describe durable system parts: stores, renderers, promoters, bridges, and shells." - : "Dataflow nodes describe the movement of evidence and structure through the pipeline: observations, proposals, validation, fragments, turns."} + {graphDescriptions[activeGraphKey]} Titles appear first. Then purpose. Then mechanism and metaphor. The graph gets to be a map before it has to be a filing cabinet. diff --git a/web/epiphany-graph-viewer/src/lib/types.ts b/web/epiphany-graph-viewer/src/lib/types.ts index ee3cb64..83349ae 100644 --- a/web/epiphany-graph-viewer/src/lib/types.ts +++ b/web/epiphany-graph-viewer/src/lib/types.ts @@ -48,6 +48,9 @@ export interface EpiphanyGraphsState { links: EpiphanyGraphLink[]; } +export type EpiphanyGraphLabels = Partial>; +export type EpiphanyGraphDescriptions = Partial>; + export interface EpiphanyValidationIssue { scope: string; message: string; @@ -72,6 +75,8 @@ export interface EpiphanyGraphViewerProps { style?: CSSProperties; className?: string; title?: string; + graphLabels?: EpiphanyGraphLabels; + graphDescriptions?: EpiphanyGraphDescriptions; onSelectionChange?: (selection: ViewerSelection | null) => void; onCodeRefSelect?: ( codeRef: EpiphanyCodeRef,