Content viewer fixed
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user