From 3b66e82b67d3c3a3e3ee10f3bc5653da56adaff2 Mon Sep 17 00:00:00 2001 From: hypercross Date: Sat, 8 Aug 2026 12:27:23 +0800 Subject: [PATCH] feat(web): make object tree collapsible and collapsed by default --- apps/web/src/components/ObjectTree.tsx | 42 ++++++++++++++++++++------ 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/apps/web/src/components/ObjectTree.tsx b/apps/web/src/components/ObjectTree.tsx index 9a66bc3..05e1c51 100644 --- a/apps/web/src/components/ObjectTree.tsx +++ b/apps/web/src/components/ObjectTree.tsx @@ -1,3 +1,4 @@ +import { useState } from 'react'; import type { ObjectTreeNode } from '@tts/extract'; interface Props { @@ -38,23 +39,44 @@ function TreeNode({ onSelect: (guid: string) => void; }) { const selected = node.object.GUID === selectedGuid; + const hasChildren = node.children.length > 0; + const [expanded, setExpanded] = useState(false); return (
  • - - {node.children.length > 0 && ( + {hasChildren ? ( + + ) : ( + + )} + + + {hasChildren && expanded && (
      {node.children.map((child, index) => (