"use client"; import { ReactFlowProvider } from "@xyflow/react"; import { Save, Download } from "lucide-react"; import { ArchitectCanvas } from "@/app/components/ArchitectCanvas"; import { NodeSidebar } from "@/app/components/panels/NodeSidebar"; import { NodeSettingsPanel } from "@/app/components/panels/NodeSettingsPanel"; import { useCouncilStore } from "@/app/store/council-store"; import { parseGraphToBlueprint } from "@/app/utils/blueprint-parser"; import { councilApi } from "@/app/utils/api-client"; export default function RatArchitektPage() { const nodes = useCouncilStore((s) => s.nodes); const edges = useCouncilStore((s) => s.edges); const councilName = useCouncilStore((s) => s.councilName); const setCouncilName = useCouncilStore((s) => s.setCouncilName); const handleSave = async () => { const blueprint = parseGraphToBlueprint(nodes, edges, councilName); try { await councilApi.create(blueprint); alert("Rat gespeichert!"); } catch (e) { alert("Fehler beim Speichern: " + (e as Error).message); } }; const handleExport = () => { const blueprint = parseGraphToBlueprint(nodes, edges, councilName); const blob = new Blob([JSON.stringify(blueprint, null, 2)], { type: "application/json", }); const url = URL.createObjectURL(blob); const a = document.createElement("a"); a.href = url; a.download = `${councilName.replace(/\s+/g, "-")}-blueprint.json`; a.click(); URL.revokeObjectURL(url); }; return (
{/* Toolbar */}
setCouncilName(e.target.value)} className="font-semibold text-slate-800 bg-transparent border-none focus:outline-none focus:ring-2 focus:ring-indigo-300 rounded px-1" /> | {nodes.length} Agenten ยท {edges.length} Kanten
{/* Main area */}
); }