From 81ffd40c7284474cdffa04c2f5808e0abc254b68 Mon Sep 17 00:00:00 2001 From: abhigyantrumio Date: Sun, 10 Aug 2025 06:55:50 +0530 Subject: [PATCH] Content viewer fixed --- src/ui/components/graph/GraphExplorer.tsx | 12 +++++++++--- src/ui/pages/HomePage.tsx | 5 +++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/ui/components/graph/GraphExplorer.tsx b/src/ui/components/graph/GraphExplorer.tsx index c2b38a60d..bfd63b225 100644 --- a/src/ui/components/graph/GraphExplorer.tsx +++ b/src/ui/components/graph/GraphExplorer.tsx @@ -3,13 +3,19 @@ import GraphVisualization from './Visualization.tsx'; import type { KnowledgeGraph } from '../../../core/graph/types.ts'; interface GraphExplorerProps { - graph: KnowledgeGraph | null; + graph: KnowledgeGraph; isLoading: boolean; + onNodeSelect?: (nodeId: string | null) => void; } -export default function GraphExplorer({ graph, isLoading }: GraphExplorerProps) { +export default function GraphExplorer({ graph, isLoading, onNodeSelect }: GraphExplorerProps) { const [selectedNode, setSelectedNode] = useState(null); + const handleNodeSelect = (nodeId: string | null) => { + setSelectedNode(nodeId); + onNodeSelect?.(nodeId); // Notify parent component + }; + const containerStyle: React.CSSProperties = { width: '100%', height: '100%', @@ -39,7 +45,7 @@ export default function GraphExplorer({ graph, isLoading }: GraphExplorerProps)
diff --git a/src/ui/pages/HomePage.tsx b/src/ui/pages/HomePage.tsx index 32161ac7f..409872d2f 100644 --- a/src/ui/pages/HomePage.tsx +++ b/src/ui/pages/HomePage.tsx @@ -74,6 +74,10 @@ const HomePage: React.FC = () => { setState(prev => ({ ...prev, ...updates })); }, []); + const handleNodeSelect = (nodeId: string | null) => { + updateState({ selectedNodeId: nodeId }); + }; + // Save LLM settings to localStorage useEffect(() => { if (state.llmApiKey) { @@ -819,6 +823,7 @@ const HomePage: React.FC = () => {