import { memo } from "react"; import { Handle, Position } from "@xyflow/react"; import type { NodeProps, Node } from "@xyflow/react"; import { getLayerColor } from "./LayerLegend"; export interface PortalNodeData extends Record { targetLayerId: string; targetLayerName: string; connectionCount: number; layerColorIndex: number; onNavigate: (layerId: string) => void; } export type PortalFlowNode = Node; function PortalNode({ data, }: NodeProps) { const color = getLayerColor(data.layerColorIndex); return (
data.onNavigate(data.targetLayerId)} >
{data.targetLayerName}
→
{data.connectionCount} connection{data.connectionCount !== 1 ? "s" : ""}
); } export default memo(PortalNode);