diff --git a/src/App.tsx b/src/App.tsx index 8b679ce2..00927c2d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -248,7 +248,7 @@ const AppNoError = ({ { - if (!("nodeType" in node.data)) { + if (node.type == "primer-def-name") { setSelection({ def: node.data.def, }); diff --git a/src/components/TreeReactFlow/Flavor.ts b/src/components/TreeReactFlow/Flavor.ts index 8d79073b..14e5f041 100644 --- a/src/components/TreeReactFlow/Flavor.ts +++ b/src/components/TreeReactFlow/Flavor.ts @@ -13,7 +13,8 @@ export type NodeFlavor = | NodeFlavorBoxBody | NodeFlavorNoBody; -export const commonHoverClasses = "hover:ring hover:ring-4 hover:ring-offset-4"; +export const commonHoverClasses = + "hover:ring hover:ring-4 hover:ring-offset-4 cursor-pointer"; export const flavorClasses = (flavor: NodeFlavor): string => { switch (flavor) { @@ -170,7 +171,7 @@ export const flavorClasses = (flavor: NodeFlavor): string => { return "border-yellow-primary ring-yellow-primary"; case "PatternCon": - return "border-green-primary ring-green-primary bg-white-primary"; + return "border-green-primary ring-green-primary bg-white-primary cursor-default"; case "PatternBind": return classNames( "border-blue-quaternary ring-blue-quaternary bg-white-primary", @@ -178,7 +179,7 @@ export const flavorClasses = (flavor: NodeFlavor): string => { commonHoverClasses ); case "PatternApp": - return "border-blue-tertiary ring-blue-tertiary bg-blue-tertiary"; + return "border-blue-tertiary ring-blue-tertiary bg-blue-tertiary cursor-default"; } }; diff --git a/src/components/TreeReactFlow/index.tsx b/src/components/TreeReactFlow/index.tsx index 2fad41d8..0245e3f7 100644 --- a/src/components/TreeReactFlow/index.tsx +++ b/src/components/TreeReactFlow/index.tsx @@ -158,6 +158,7 @@ const nodeTypes = { className={classNames( "flex justify-center rounded-md border-4", flavorClasses(p.data.flavor), + "cursor-default", // We use a white base so that the "transparent" background will not appear as such. "bg-white-primary" )} @@ -288,10 +289,16 @@ const makePrimerNode = async ( nodeType, ...p, }; - const edgeCommon = (child: PrimerNode) => ({ + const edgeCommon = (child: PrimerNode): PrimerEdge => ({ id: JSON.stringify([id, child.id]), source: id, target: child.id, + style: { cursor: "default" }, + focusable: false, + ...(child.type != "primer-def-name" && + !flavorClasses(child.data.flavor).includes(commonHoverClasses) && { + interactionWidth: 0, + }), zIndex, }); switch (node.body.tag) { @@ -501,7 +508,8 @@ export const TreeReactFlow = (p: TreeReactFlowProps) => { target: tree.nodeId, type: "step", className: "stroke-grey-tertiary stroke-[0.25rem]", - style: { strokeDasharray: 4 }, + style: { strokeDasharray: 4, cursor: "default" }, + focusable: false, zIndex: 0, }, ], @@ -652,6 +660,10 @@ export const ReactFlowSafe = ( { + "onNodeClick" in p && + p.onNodeClick(e, p.nodes.find((n) => n.id == edge.target) as N); + }, onNodeClick: (e, n) => { "onNodeClick" in p && p.onNodeClick(