import { useEditorStore } from '@/stores/editor-store'; import { useCommandStore } from '@/stores/command-store'; import { extractHeadings } from '@/lib/headings'; export function Outline() { const activeId = useEditorStore((s) => s.activeId); const buffers = useEditorStore((s) => s.buffers); const dispatch = useCommandStore((s) => s.dispatch); if (!activeId) { return (
No file open
); } const buffer = buffers.get(activeId); if (!buffer) { return (
No file open
); } const headings = extractHeadings(buffer.content); if (headings.length === 0) { return (
No headings
); } return (
{headings.map((h, i) => ( ))}
); }