The main component for rendering the knowledge graph visualization.
interface GraphViewerProps {
data: GraphData & { clusters?: ClusterResult[] };
}import { GraphViewer } from '@/components/graph/GraphViewer';
function GraphPage() {
const { data } = useQuery({ queryKey: ['/api/graph'] });
return <GraphViewer data={data} />;
}- Interactive graph visualization
- Semantic cluster coloring
- Node and edge styling
- Automatic layout
- Zoom and pan controls
Control panel for graph operations.
- Graph expansion input
- Cluster recalculation
- Node reconnection
- Real-time feedback
import { ControlPanel } from '@/components/graph/ControlPanel';
function GraphControls() {
return <ControlPanel />;
}The application uses a custom theme system built on top of Tailwind CSS:
{
"primary": "#4f46e5",
"variant": "professional",
"appearance": "system",
"radius": 0.5
}- Uses CSS-in-JS with
tailwind-merge - Responsive design patterns
- Consistent styling across components
// Graph queries
const { data: graphData } = useQuery({
queryKey: ['/api/graph'],
queryFn: getQueryFn()
});
// Mutations
const expandMutation = useMutation({
mutationFn: expandGraph,
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['/api/graph'] });
}
});- Real-time graph updates
- Cluster state synchronization
- Connection management
- Efficient rendering with React.memo
- Debounced user inputs
- Optimized graph layouts
- Lazy loading for large datasets