From 7ba68778c10a966c69594b63a714ad7c3a7e204e Mon Sep 17 00:00:00 2001 From: sagitchu Date: Tue, 3 Mar 2026 16:17:36 +0800 Subject: [PATCH] refactor: simplify forward import tunnel selection - Remove separate entry node selection for ny format - Unify tunnel selection for both flvx and ny formats - Remove unused tunnel select modal component - Simplify import button validation logic --- vite-frontend/src/pages/forward.tsx | 193 ++++------------------------ 1 file changed, 27 insertions(+), 166 deletions(-) diff --git a/vite-frontend/src/pages/forward.tsx b/vite-frontend/src/pages/forward.tsx index e7d73ae..37002c0 100644 --- a/vite-frontend/src/pages/forward.tsx +++ b/vite-frontend/src/pages/forward.tsx @@ -563,11 +563,6 @@ export default function ForwardPage() { const [importData, setImportData] = useState(""); const [importLoading, setImportLoading] = useState(false); const [importFormat, setImportFormat] = useState("flvx"); - const [selectedEntryNode, setSelectedEntryNode] = useState( - null, - ); - const [matchedTunnels, setMatchedTunnels] = useState([]); - const [tunnelSelectModalOpen, setTunnelSelectModalOpen] = useState(false); const [selectedTunnelForImport, setSelectedTunnelForImport] = useState< number | null >(null); @@ -4648,8 +4643,6 @@ export default function ForwardPage() { if (selectedKey) { setImportFormat(selectedKey); setSelectedTunnelForImport(null); - setSelectedEntryNode(null); - setMatchedTunnels([]); setImportData(""); setImportResults([]); } @@ -4663,114 +4656,34 @@ export default function ForwardPage() { - {/* flvx格式:隧道选择 */} - {importFormat === "flvx" && ( - { + const selectedKey = Array.from(keys)[0] as string; - setSelectedTunnelForImport( - selectedKey ? parseInt(selectedKey) : null, - ); - }} - > - {tunnels.map((tunnel) => ( - - {tunnel.name} - - ))} - - )} - - {/* ny格式:入口节点选择 */} - {importFormat === "ny" && ( - - )} - - {/* ny格式:显示匹配的隧道 */} - {importFormat === "ny" && matchedTunnels.length > 0 && ( -
- {matchedTunnels.length === 1 ? ( - - 已匹配隧道:{matchedTunnels[0].name} - - ) : ( - - 找到 {matchedTunnels.length}{" "} - 个匹配隧道,请点击下方按钮选择 - - )} -
- )} - - {/* ny格式:多隧道选择按钮 */} - {importFormat === "ny" && - matchedTunnels.length > 1 && - !selectedTunnelForImport && ( - - )} + {tunnel.name} + + ))} + {/* 输入区域 */}