MCPcopy Create free account
hub / github.com/Zleap-AI/SAG / createGraphNode

Function createGraphNode

web/src/components/ProjectGraphFlow.tsx:401–435  ·  view source on GitHub ↗
(input: {
  id: string;
  label: string;
  kind: GraphNodeData["kind"];
  expanded: boolean;
  x: number;
  y: number;
  root?: boolean;
})

Source from the content-addressed store, hash-verified

399}
400
401function createGraphNode(input: {
402 id: string;
403 label: string;
404 kind: GraphNodeData["kind"];
405 expanded: boolean;
406 x: number;
407 y: number;
408 root?: boolean;
409}): GraphNode {
410 return {
411 id: input.id,
412 type: "default",
413 position: { x: input.x, y: input.y },
414 data: {
415 label: input.label,
416 kind: input.kind,
417 expanded: input.expanded
418 },
419 style: {
420 width: input.root ? ENTITY_NODE_WIDTH + 20 : input.kind === "entity" ? ENTITY_NODE_WIDTH : EVENT_NODE_WIDTH,
421 borderRadius: 6,
422 border: input.expanded ? "1.5px solid #111827" : "1px solid #d4d4d8",
423 background: input.kind === "entity" ? "#ffffff" : "#f8fafc",
424 color: "#111827",
425 fontSize: 12,
426 fontWeight: input.kind === "entity" ? 650 : 520,
427 padding: "8px 10px",
428 boxShadow: input.root ? "0 8px 24px rgba(15, 23, 42, 0.12)" : "0 2px 8px rgba(15, 23, 42, 0.06)",
429 overflow: "hidden",
430 textOverflow: "ellipsis",
431 whiteSpace: "nowrap"
432 },
433 className: cn(input.expanded && "ring-2 ring-ring/25")
434 };
435}
436
437function applySelectionStyles(input: {
438 nodes: GraphNode[];

Callers 1

buildVisibleGraphFunction · 0.85

Calls 1

cnFunction · 0.90

Tested by

no test coverage detected