Feat v0.4.1 folders navigation tree (#23)

Add folders as a first-class concept in the Notes surface with full
CRUD, nested tree navigation, and folder-based note filtering.

Backend (script.star):
- Folder CRUD handlers: list, create, update, delete
- Move-note endpoint to reassign folder_id
- Delete cascades: orphan notes to unfiled, reparent child folders
- Stats now include unfiled and folder counts

Frontend (js/main.js):
- FolderTree component with flat-to-tree builder via useMemo
- FolderNode recursive component with expand/collapse, inline rename
- Folder state: activeFolderId, showUnfiled for sidebar filtering
- Editor folder select dropdown for moving notes between folders
- New notes inherit active folder on creation

Schema (manifest.json):
- New ext_notes_folders table (name, parent_id, creator_id, sort_order)
- 5 new API routes: GET/POST /folders, PUT/DELETE /folders/*, POST /notes/move
- Version bumped to 0.2.0

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-29 11:38:54 +00:00
parent 2c8dc59284
commit 70404ff070
4 changed files with 441 additions and 16 deletions

View File

@@ -39,6 +39,75 @@
gap: 4px;
}
/* ── Folder Tree ────────────────────────── */
.folder-tree {
padding: 4px 0;
border-bottom: 1px solid var(--border);
flex-shrink: 0;
max-height: 40%;
overflow-y: auto;
}
.folder-tree__item {
display: flex;
align-items: center;
gap: 4px;
padding: 5px 12px;
font-size: 13px;
color: var(--text-2);
cursor: pointer;
border-radius: var(--radius);
margin: 1px 6px;
transition: var(--transition);
user-select: none;
}
.folder-tree__item:hover {
background: var(--bg-hover);
color: var(--text);
}
.folder-tree__item--active {
background: var(--bg-active);
color: var(--text);
font-weight: 500;
}
.folder-tree__toggle {
width: 14px;
font-size: 9px;
text-align: center;
flex-shrink: 0;
color: var(--text-3);
}
.folder-tree__icon {
font-size: 13px;
flex-shrink: 0;
}
.folder-tree__name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
flex: 1;
}
.folder-tree__edit {
flex: 1;
font-size: 13px;
padding: 1px 4px;
border: 1px solid var(--accent);
border-radius: 3px;
background: var(--bg-surface);
color: var(--text);
font-family: var(--font);
outline: none;
}
.folder-tree__add {
padding: 6px 12px;
font-size: 12px;
color: var(--text-3);
cursor: pointer;
transition: var(--transition);
}
.folder-tree__add:hover {
color: var(--accent);
}
/* ── Search ──────────────────────────────── */
.notes-search {
padding: 8px 14px;
@@ -171,6 +240,23 @@
align-items: center;
}
/* ── Folder select in editor ────────────── */
.notes-editor__folder-select {
font-size: 12px;
padding: 3px 6px;
border: 1px solid var(--border);
border-radius: var(--radius);
background: var(--bg-raised);
color: var(--text-2);
font-family: var(--font);
cursor: pointer;
max-width: 140px;
}
.notes-editor__folder-select:focus {
outline: none;
border-color: var(--accent);
}
/* ── Editor Body ─────────────────────────── */
.notes-editor__body {
flex: 1;
@@ -291,4 +377,5 @@
@media (max-width: 700px) {
.notes-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); max-height: 40vh; }
.notes-app { flex-direction: column; }
.folder-tree { max-height: 30vh; }
}