setContextMenu(null)}
>
{/* ── Logo ── */}
{/* ── Nav items ── */}
{/* ── Divider ── */}
{/* ── Sheets list ── */}
Sheets
{sheets.map(sheet => {
const active = activeSheetId === sheet.id
return (
handleContextMenu(e, sheet.id)}
className="group flex items-center gap-2 px-3 py-2 rounded-lg cursor-pointer mb-0.5 transition-colors"
style={{
background: active ? 'var(--accent-dim)' : 'transparent',
borderLeft: active ? '2px solid var(--accent)' : '2px solid transparent',
}}
onClick={() => handleSelect(sheet.id)}
>
{renamingId === sheet.id ? (
setRenameValue(e.target.value)}
onBlur={() => commitRename(sheet.id)}
onKeyDown={e => {
if (e.key === 'Enter') commitRename(sheet.id)
if (e.key === 'Escape') setRenamingId(null)
}}
className="flex-1 bg-transparent text-sm outline-none border-b"
style={{ color: 'var(--text-primary)', borderColor: 'var(--accent)' }}
onClick={e => e.stopPropagation()}
/>
) : (
<>
{sheet.name}
{sheet.itemCount} items
>
)}
)
})}
{sheets.length === 0 && (
No sheets yet
Click + to create one
)}
{/* ── Admin ── */}
{user?.role === 'admin' && (
{[
{ label: 'Users', path: '/admin/users' },
{ label: 'Clients', path: '/admin/clients' },
{ label: 'Dropdowns', path: '/admin/dropdowns' },
].map(item => (
))}
)}
{/* ── Context menu ── */}
{contextMenu && (
e.stopPropagation()}
>
{[
{ label: 'Rename', action: () => { const s = sheets.find(sh => sh.id === contextMenu.id); if (s) handleRename(s.id, s.name) } },
{ label: 'Duplicate', action: async () => { await duplicateSheet(contextMenu.id); setContextMenu(null) } },
{ label: 'Delete', action: async () => { if (confirm('Delete this sheet?')) { await deleteSheet(contextMenu.id); setContextMenu(null) } }, danger: true },
].map(item => (
))}
)}
)
}