From a469133446ee93053ba0f312c16811c09f529507 Mon Sep 17 00:00:00 2001 From: limil Date: Sat, 7 Feb 2026 12:34:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E8=8A=82=E7=82=B9=E7=9A=84?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E7=AA=97=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 2 +- src/TODO.md | 9 +++++++++ src/components/NodeEditor.tsx | 30 +++++++++++++++++++----------- 3 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 src/TODO.md diff --git a/src/App.tsx b/src/App.tsx index bb9c9dd..66f8ab1 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -111,7 +111,7 @@ function FlowContent(): ReactNode { const handleUpdateNode = (updatedData: NodeData): void => { setNodes((prev) => prev.map((node) => { - if (node.data.label === editingNode?.label) { + if (node.data.id === editingNode?.id) { return { ...node, data: updatedData }; } return node; diff --git a/src/TODO.md b/src/TODO.md new file mode 100644 index 0000000..ba3b95b --- /dev/null +++ b/src/TODO.md @@ -0,0 +1,9 @@ +## 产品基本功能实现待办事项 + +- [x] 完成节点的编辑窗口 +- [ ] 完成边的编辑窗口 +- [ ] 完成全局设置编辑窗口以及相关联动 +- [ ] 实现配置生成逻辑,并验证有效 +- [ ] 实现配置保存和加载功能 +- [ ] 实现加密功能(完全加密和只加密私钥) +- [ ] 完成!奖励自己 diff --git a/src/components/NodeEditor.tsx b/src/components/NodeEditor.tsx index 0c4abc3..ef75323 100644 --- a/src/components/NodeEditor.tsx +++ b/src/components/NodeEditor.tsx @@ -3,7 +3,17 @@ import { NodeData, Settings } from '../types/graph'; import { generateWireGuardPrivateKey } from '../utils/wireguardConfig' import './NodeEditor.css'; import Folder from './Folder' -import { randomBytes } from 'tweetnacl'; + + +interface Validation { + isValid: boolean, + errors: string[] +} + +function validateNodeConfig(formData : NodeData) : Validation { + // todo + return {isValid : true, errors: []} +} interface NodeEditorProps { node: NodeData; @@ -30,16 +40,14 @@ export default function NodeEditor({ }; const handleSave = (): void => { - setErrors(["123"]) - // const validation = validateNodeConfig(formData); - // if (!validation.isValid) { - // setErrors(validation.errors); - // return; - // } - - // setErrors([]); - // onUpdate(formData); - // onClose(); + const validation = validateNodeConfig(formData); + if (!validation.isValid) { + setErrors(validation.errors); + return; + } + setErrors([]); + onUpdate(formData); + onClose(); }; const handleGenerateKey = (): void => {