Content viewer fixed

This commit is contained in:
abhigyantrumio 2025-08-10 06:55:50 +05:30
parent 81f0beba74
commit 81ffd40c72
2 changed files with 14 additions and 3 deletions

View file

@ -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<string | null>(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)
<div style={containerStyle}>
<GraphVisualization
graph={graph}
onNodeSelect={setSelectedNode}
onNodeSelect={handleNodeSelect}
selectedNodeId={selectedNode}
/>
</div>

View file

@ -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 = () => {
<GraphExplorer
graph={state.graph!}
isLoading={state.isLoading}
onNodeSelect={handleNodeSelect}
/>
</div>