Sidebar: folder view, label view, view toggle and pond default #108

Closed
opened 2026-07-14 09:32:43 +02:00 by fable-5 · 1 comment
Collaborator

Context

The sidebar gains two page-list presentations: a collapsible folder view (the page tree from parentId) and a label view (pages grouped under the existing hierarchical label tree). The pond owner sets a pond-level default; every user can override it locally. New pages created while a page is open become children of that page.

Scope

  • packages/shared/src/ponds.ts: new pondSettingsSchema key sidebarView: z.enum(['folders', 'labels']).default('folders') (+ updatePondInputSchema); owner control next to the existing sort selector (or in pond settings). Remember the PondsService.update settings-merge (the #92 trap: new keys must be merged explicitly).
  • Per-user override via usePersistentState('ui.sidebar.view.<pondId>', …) (apps/web/src/lib/use-persistent-state.ts), like ui.sidebar.width.
  • Folder view in apps/web/src/layout/Sidebar.tsx: tree built client-side with the shared buildPageTree; collapsible nodes with persisted collapse state; aria-expanded + keyboard support; sibling order follows the pond's existing sort mode (alpha/created/manual); manual ↑/↓ buttons operate within the sibling group (compute afterId/beforeId among siblings).
  • Label view: pages grouped under the label tree (reuse usePondLabels + buildLabelTree); pages with several labels appear under each; unlabeled pages in a trailing “unlabeled” group. Read-only presentation (no DnD).
  • The existing label filter applies to folder view only; while a filter is active, fall back to today's flat filtered list (avoids partial-tree ambiguity). DnD stays gated: owner + manual sort + no filter + folder view.
  • apps/web/src/layout/NewPageForm.tsx: when a page is currently open, send its id as parentId (create the page as a child); on pond home, create at root. Unreadable-parent fallback: pages whose parentId was nulled by the server render at root.
  • i18n de+en for the toggle, group headings, and tooltips.

Acceptance criteria

  • Toggle switches between folder and label view; pond default applies to users without a local override; the override survives reload.
  • New page created while viewing a page appears as its child; created from pond home it appears at root.
  • Collapse state survives reload; keyboard and screen reader can operate the tree.
  • Alpha/created/manual ordering is correct within each sibling group; manual reorder still works among siblings.
  • Label view shows multi-label pages under each label and an unlabeled group.

Technical notes

  • The pages query (['pages', pondId, sidebarSort]) keeps returning a flat list; all grouping is client-side.
  • Owner-only visibility of the pond-default control mirrors the current sort selector.

Dependencies

Requires #106.

Size

~2 days.

## Context The sidebar gains two page-list presentations: a collapsible **folder view** (the page tree from `parentId`) and a **label view** (pages grouped under the existing hierarchical label tree). The pond owner sets a pond-level default; every user can override it locally. New pages created while a page is open become children of that page. ## Scope - `packages/shared/src/ponds.ts`: new `pondSettingsSchema` key `sidebarView: z.enum(['folders', 'labels']).default('folders')` (+ `updatePondInputSchema`); owner control next to the existing sort selector (or in pond settings). Remember the `PondsService.update` settings-merge (the #92 trap: new keys must be merged explicitly). - Per-user override via `usePersistentState('ui.sidebar.view.<pondId>', …)` (`apps/web/src/lib/use-persistent-state.ts`), like `ui.sidebar.width`. - Folder view in `apps/web/src/layout/Sidebar.tsx`: tree built client-side with the shared `buildPageTree`; collapsible nodes with persisted collapse state; `aria-expanded` + keyboard support; sibling order follows the pond's existing sort mode (alpha/created/manual); manual ↑/↓ buttons operate within the sibling group (compute `afterId`/`beforeId` among siblings). - Label view: pages grouped under the label tree (reuse `usePondLabels` + `buildLabelTree`); pages with several labels appear under each; unlabeled pages in a trailing “unlabeled” group. Read-only presentation (no DnD). - The existing label **filter** applies to folder view only; while a filter is active, fall back to today's flat filtered list (avoids partial-tree ambiguity). DnD stays gated: owner + manual sort + no filter + folder view. - `apps/web/src/layout/NewPageForm.tsx`: when a page is currently open, send its id as `parentId` (create the page as a child); on pond home, create at root. Unreadable-parent fallback: pages whose `parentId` was nulled by the server render at root. - i18n de+en for the toggle, group headings, and tooltips. ## Acceptance criteria - [ ] Toggle switches between folder and label view; pond default applies to users without a local override; the override survives reload. - [ ] New page created while viewing a page appears as its child; created from pond home it appears at root. - [ ] Collapse state survives reload; keyboard and screen reader can operate the tree. - [ ] Alpha/created/manual ordering is correct within each sibling group; manual reorder still works among siblings. - [ ] Label view shows multi-label pages under each label and an unlabeled group. ## Technical notes - The pages query (`['pages', pondId, sidebarSort]`) keeps returning a flat list; all grouping is client-side. - Owner-only visibility of the pond-default control mirrors the current sort selector. ## Dependencies Requires #106. ## Size ~2 days.
fable-5 added this to the M12 — Page hierarchy & knowledge graph milestone 2026-07-14 09:32:43 +02:00
fable-5 added the
frontend
label 2026-07-14 09:32:43 +02:00
Author
Collaborator

Implemented in 1518487. Sidebar renders the page tree (collapsible, collapse state persisted per pond) or pages grouped under the label tree; the toggle sits above the list. New pond setting sidebarView (owner default, merged in PondsService like the other keys) + per-user localStorage override ui.sidebar.view.<pondId> — SidebarContent is keyed by pond id so the persistent hooks mount with the right key. "New page" nests under the open page (with a hint in the form); the label filter stays a folder-view feature with the flat fallback while active; reordering operates within one sibling group. Verified live plus reorder/labels/content packs green.

Implemented in 1518487. Sidebar renders the page tree (collapsible, collapse state persisted per pond) or pages grouped under the label tree; the toggle sits above the list. New pond setting `sidebarView` (owner default, merged in PondsService like the other keys) + per-user localStorage override `ui.sidebar.view.<pondId>` — SidebarContent is keyed by pond id so the persistent hooks mount with the right key. "New page" nests under the open page (with a hint in the form); the label filter stays a folder-view feature with the flat fallback while active; reordering operates within one sibling group. Verified live plus reorder/labels/content packs green.
Sign in to join this conversation.
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: stwaidele/dorfteich#108
No description provided.