Graph: highlight a selected node's links; nav: Connect only when signed out

Selecting a node highlights every edge into and out of it, with their
labels and the boxes at the far ends, and dims the rest. The Connect
menu item is shown only while signed out; when signed in, the name in
the menu links to the connection page so Disconnect stays reachable.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
mattandClaude Sonnet 5.5 committed 2026-11-09 14:09:42 +00:00
1 parent 11c9483a88
commit 44e4eb75c9
6 files changed
+133 -16

No files matched your search

+6 -2
View File
@@ -4,6 +4,10 @@ export interface GrantEdgeData {
label: string
/** Vertical nudge so labels on edges into the same node don't sit on top of each other. */
offset: number
/** Touches the selected node. */
linked?: boolean
/** Another node is selected and this edge isn't one of its links. */
dim?: boolean
onSelect: () => void
}
@@ -12,7 +16,7 @@ export interface GrantEdgeData {
* fanned out to different rows, instead of at the midpoint where edges from one policy bunch up.
*/
export function GrantEdge({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, markerEnd, selected, data }: EdgeProps) {
const { label, offset, onSelect } = data as unknown as GrantEdgeData
const { label, offset, linked, dim, onSelect } = data as unknown as GrantEdgeData
const [path] = getBezierPath({ sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition })
return (
<>
@@ -20,7 +24,7 @@ export function GrantEdge({ id, sourceX, sourceY, targetX, targetY, sourcePositi
<EdgeLabelRenderer>
<button
type="button"
className={`nodrag nopan edge-label${selected ? ' edge-label-selected' : ''}`}
className={`nodrag nopan edge-label${selected ? ' edge-label-selected' : ''}${linked ? ' edge-label-linked' : ''}${dim ? ' edge-label-dim' : ''}`}
style={{ transform: `translate(-100%, -50%) translate(${targetX - 18}px, ${targetY + offset}px)` }}
onClick={onSelect}
>