import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { ClipboardList, Download, Trash2, Layers, Home, ChevronRight } from 'lucide-react'; import { AtomizerCanvas } from '../components/canvas/AtomizerCanvas'; import { TemplateSelector } from '../components/canvas/panels/TemplateSelector'; import { ConfigImporter } from '../components/canvas/panels/ConfigImporter'; import { useCanvasStore } from '../hooks/useCanvasStore'; import { useStudy } from '../context/StudyContext'; import { CanvasTemplate } from '../lib/canvas/templates'; export function CanvasView() { const [showTemplates, setShowTemplates] = useState(false); const [showImporter, setShowImporter] = useState(false); const [notification, setNotification] = useState(null); const navigate = useNavigate(); const { nodes, edges, clear } = useCanvasStore(); const { selectedStudy } = useStudy(); const handleTemplateSelect = (template: CanvasTemplate) => { showNotification(`Loaded template: ${template.name}`); }; const handleImport = (source: string) => { showNotification(`Imported from ${source}`); }; const handleClear = () => { if (nodes.length === 0 || window.confirm('Clear all nodes from the canvas?')) { clear(); showNotification('Canvas cleared'); } }; const showNotification = (message: string) => { setNotification(message); setTimeout(() => setNotification(null), 3000); }; return (
{/* Minimal Header */}
{/* Home button */} {/* Breadcrumb */}
Canvas Builder {selectedStudy && ( <> {selectedStudy.name || selectedStudy.id} )}
{/* Stats */} {nodes.length} node{nodes.length !== 1 ? 's' : ''} • {edges.length} edge{edges.length !== 1 ? 's' : ''}
{/* Action Buttons */}
{/* Main Canvas */}
{/* Template Selector Modal */} setShowTemplates(false)} onSelect={handleTemplateSelect} /> {/* Config Importer Modal */} setShowImporter(false)} onImport={handleImport} /> {/* Notification Toast */} {notification && (
{notification}
)}
); } export default CanvasView;