mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-06 02:49:56 +00:00
Content viewer fixed
This commit is contained in:
parent
81f0beba74
commit
81ffd40c72
2 changed files with 14 additions and 3 deletions
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue