diff --git a/src/frontend/src/CustomNodes/GenericNode/index.tsx b/src/frontend/src/CustomNodes/GenericNode/index.tsx index 4e029f702..6db26e9ce 100644 --- a/src/frontend/src/CustomNodes/GenericNode/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/index.tsx @@ -107,6 +107,7 @@ export default function GenericNode({ }, [flowPool, data.id]); const showNode = data.showNode ?? true; + const pinned = data.pinned ?? true; const nameEditable = data.node?.flow || data.type === "CustomComponent"; @@ -204,7 +205,7 @@ export default function GenericNode({ ) : (
{ setInputName(true); takeSnapshot(); @@ -212,7 +213,7 @@ export default function GenericNode({ >
{data.node?.display_name}
@@ -318,7 +319,32 @@ export default function GenericNode({ )}
- + {showNode && ( +
{ + setNode(data.id, (old) => ({ + ...old, + data: { + ...old.data, + pinned: old?.data?.pinned ? false : true, + }, + })); + }} + > +
+ +
+
+ )} {showNode && (
-
+
((set, get) => ({ ? change(get().nodes.find((node) => node.id === id)!) : change; + console.log(newChange); get().setNodes((oldNodes) => oldNodes.map((node) => { if (node.id === id) { diff --git a/src/frontend/src/style/applies.css b/src/frontend/src/style/applies.css index e2bcdb7d9..908298c13 100644 --- a/src/frontend/src/style/applies.css +++ b/src/frontend/src/style/applies.css @@ -267,7 +267,7 @@ @apply relative flex flex-col justify-center bg-background; } .generic-node-div-title { - @apply flex w-full items-center gap-8 border-b bg-muted p-4; + @apply flex w-full items-center gap-4 border-b bg-muted p-4; } .generic-node-title-arrangement { @apply flex-max-width items-center truncate; diff --git a/src/frontend/src/types/flow/index.ts b/src/frontend/src/types/flow/index.ts index 783a8963d..a18461ded 100644 --- a/src/frontend/src/types/flow/index.ts +++ b/src/frontend/src/types/flow/index.ts @@ -21,6 +21,7 @@ export type NodeType = { export type NodeDataType = { showNode?: boolean; + pinned?: boolean; type: string; node?: APIClassType; id: string; diff --git a/src/frontend/src/utils/styleUtils.ts b/src/frontend/src/utils/styleUtils.ts index 5ba3ad119..2ebb06509 100644 --- a/src/frontend/src/utils/styleUtils.ts +++ b/src/frontend/src/utils/styleUtils.ts @@ -68,6 +68,7 @@ import { Network, Paperclip, Pencil, + Pin, Plus, Redo, RefreshCcw, @@ -378,6 +379,7 @@ export const nodeIconsLucide: iconsType = { Loader2, BookmarkPlus, Heart, + Pin, Link, ToyBrick, RefreshCcw,