- {(['page', 'database', 'canvas'] as Document['type'][]).map((type) => {
- const docs = groupedDocs[type] || []
- if (docs.length === 0) return null
-
- const Icon = typeIcons[type]
- const isExpanded = expandedSections[type]
-
- return (
-
- {/* Section header */}
-
-
- {/* Documents */}
- {isExpanded && (
-
- {docs.map((doc) => (
- - onSelect(doc.id)}
- draggable={doc.type !== 'canvas'}
- onDragStart={(event) => {
- if (doc.type === 'canvas') {
- return
- }
-
- event.dataTransfer.effectAllowed = 'copy'
- event.dataTransfer.setData(
- CANVAS_INTERNAL_NODE_MIME,
- serializeCanvasInternalNodeDragData({
- nodeId: doc.id,
- schemaId: schemaByType[doc.type],
- title: doc.title
- })
- )
- event.dataTransfer.setData('text/plain', doc.title)
- }}
- className={`flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer mb-0.5 group transition-colors ${
- selectedId === doc.id ? 'bg-accent' : 'hover:bg-accent/50'
- }`}
- data-sidebar-document-id={doc.id}
- data-sidebar-document-type={doc.type}
- >
-
- {doc.title}
-
-
- ))}
-
- )}
-
- )
- })}
-
- {documents.length === 0 && (
-
No documents yet
- )}
-
- {/* Plugin section groups */}
- {[...sectionGroups.entries()].map(([section, items]) => (
-
-
- {section}
-
-
- {items.map((item) => (
-
- ))}
-
-
- ))}
-
-
- {/* Bottom items (plugin + settings) */}
-
- {/* Plugin bottom items */}
- {sortedPluginItems.bottom.map((item) => (
-
- ))}
-
- {/* Settings */}
- {onSettings && (
-
- )}
-
-