'use client' import { useEffect, useState, useMemo, useCallback, useRef } from 'react' import dynamic from 'next/dynamic' import { useRouter } from 'next/navigation' import { Loader2, Network, Filter, X, ExternalLink, Maximize2, Calendar, Clock, Link2, FileText, Check, Tag, Sparkles, ChevronRight, BookOpen } from 'lucide-react' import DOMPurify from 'isomorphic-dompurify' import { markdownToHtml } from '@/lib/markdown-to-html' import { useLanguage } from '@/lib/i18n' import { LabelBadge } from './label-badge' import { NoteChecklist } from './note-checklist' const ForceGraph2D = dynamic(() => import('react-force-graph-2d'), { ssr: false }) const MarkdownContent = dynamic(() => import('./markdown-content').then(m => ({ default: m.MarkdownContent })), { ssr: false, loading: () =>
}) interface GraphNode { id: string; title: string; notebookId: string | null; createdAt: string; degree: number } interface GraphEdge { source: string; target: string; weight: number; type: string } interface Cluster { id: string; name: string } interface RawData { nodes: GraphNode[]; edges: GraphEdge[]; clusters: Cluster[] } interface NotePreview { id: string title: string | null content: string createdAt: string | Date updatedAt?: string | Date labels?: string[] | null type?: 'text' | 'markdown' | 'richtext' | 'checklist' checkItems?: { id: string; text: string; checked: boolean }[] | null isMarkdown?: boolean } const PALETTE = ['#6366f1', '#10b981', '#f59e0b', '#ec4899', '#14b8a6', '#8b5cf6', '#ef4444', '#3b82f6', '#84cc16', '#A47148'] export function NoteGraphView() { const router = useRouter() const containerRef = useRef{error}
{t('graphView.noNotesFound')}
{t('graphView.preview.emptyNote')}