Sidebar reorganization + page tags, kanban explicit-only, bookmark group-by, calendar views

Sidebar (web/components/sidebar.tsx) reorganized to the requested structure:
Quick find at the top; a Pages group (All Pages tree with the existing
rename/reorder/pin/subpage/delete interactions, Pinned Pages, Untagged
Pages); a Bookmarks group (All Bookmarks, Calendar, and expandable carets
for Tags / Kanban / Collections / Contacts listing their entities with
deep-links /tags?tag=, /kanban?column=, /collections?id=, /contacts?open=);
Trash at the bottom. Collapsed desktop rail is a flat icon list; the mobile
drawer shows the full grouped nav.

Page tagging (new): PageTag join (migration 023 + schema.sql, db-converge
proven), POST/DELETE /api/pages/{id}/tags with owner-or-TagShare validation
(same rule as bookmark tags), tags exposed in the page list/detail
projections so the sidebar can compute the untagged subset. Tagging is
metadata (no content-version bump) and cascades on page/tag delete.
Dragging a page from Untagged Pages onto a tag assigns it (custom drag MIME
keeps it distinct from page reorder).

Kanban: only explicitly-placed cards render (no auto-populate of unassigned
bookmarks); the sidebar caret lists the existing columns and ?column=
scrolls/rings the target. e2e updated to assert no-auto-populate then place
the card explicitly.

All Bookmarks: a Group by selector (None/Calendar/Tags/Kanban/Collections/
Contacts) rendering grouped sections via shared row/card renderers; the
default None path is byte-identical to before (205-row table, same keys).
Collections grouping fetches membership once, sequence-guarded.

Calendar: Day/Week/Month/Year/List views (Month default), adaptive
prev/next + Today, date-sorted list; SSR-safe (date-fns only, post-mount
today), internal overflow containers so no page-level horizontal scroll.

Deep-link page wrappers for kanban/collections/contacts pass searchParams
into the clients' initial selection.

Test gate: the -race internal/http suite now exceeds the default 10m go
test timeout (~14m cold-cache), so the tests service and Makefile test
target use -timeout 30m; the suite passes in full.

Verified: regressions 20/20, real-stack e2e all pass, lint/SSR-lint/build
0 errors, db-converge green, full Go integration suite green; browser
checks of the grouped sidebar, drag-to-tag, bookmark group-by and every
calendar view show correct rendering with no horizontal overflow.
This commit is contained in:
Andrew S Erwin
2026-11-18 14:23:26 -06:00
parent e3d765e97b
commit da70346e45
18 changed files with 1140 additions and 315 deletions
+8 -3
View File
@@ -217,7 +217,7 @@ function ValueEditor({ prop, value, onSave, readOnly = false }: { prop: Collecti
}
}
export function CollectionsClient() {
export function CollectionsClient({ initialId = null }: { initialId?: string | null }) {
const [collections, setCollections] = useState<CollectionSummary[]>([])
const [activeId, setActiveId] = useState<string | null>(null)
const isMobile = useIsMobile()
@@ -294,10 +294,15 @@ export function CollectionsClient() {
useEffect(() => { const t = setTimeout(loadCollections, 0); return () => clearTimeout(t) }, [loadCollections])
useEffect(() => {
const t = setTimeout(() => {
if (!activeId && collections.length && !isMobile) setActiveId(collections[0].id)
if (!activeId && collections.length) {
// A sidebar deep-link (?id=) wins; otherwise desktop auto-selects the
// first collection while mobile starts on the list.
const target = initialId && collections.some((c) => c.id === initialId) ? initialId : (isMobile ? null : collections[0].id)
if (target) setActiveId(target)
}
}, 0)
return () => clearTimeout(t)
}, [collections, activeId, isMobile])
}, [collections, activeId, isMobile, initialId])
useEffect(() => {
const t = setTimeout(() => {
if (!activeId) { detailSeq.current++; setDetail(null); return }