feat(app): dashboard section navigation aids (TOC, view options, deep links)#2330
feat(app): dashboard section navigation aids (TOC, view options, deep links)#2330teeohhem wants to merge 4 commits into
Conversation
🦋 Changeset detectedLatest commit: 2b6e5ee The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Review process: Full human review — logic, architecture, edge cases. Stats
|
E2E Test Results✅ All tests passed • 177 passed • 3 skipped • 1279s
Tests ran across 4 shards in parallel. |
Deep Review✅ No critical issues found. The diff adds three opt-in navigation aids behind feature flags / per-user preferences ( 🔵 P3 nitpicks (5)
Reviewers (8): correctness, testing, maintainability, project-standards, kieran-typescript, julik-frontend-races, adversarial, agent-native. Testing gaps:
|
Adds three opt-in helpers for navigating dashboards with many sections, all off by default so existing dashboards look unchanged. - Hash anchors per section: each DashboardContainer renders with id="container-<id>". Hovering a section header reveals a "copy link" icon that copies the current URL plus a #container-<id> fragment (using the shared @/utils/clipboard helper). Loading the page with such a hash auto-scrolls to that section, auto-expanding it first. - View-options menu in the dashboard toolbar: "Collapse all sections" / "Expand all sections" / "Show table of contents" toggle. Batch collapse/expand reuse the existing URL-synced collapse state so the resulting view is shareable. - Sticky in-flow TOC rail: when enabled via the view-options toggle, a 180px column renders beside the dashboard content (Flex sibling, not an overlay) with one entry per section. useScrollSpy highlights the active section as the user scrolls; click jumps. Hidden below the md breakpoint. The "tocVisible" preference is per-user in localStorage. Core hook lives in src/hooks/useDashboardSectionNav.ts and exposes scrollToContainer, copySectionLink, collapseAll, and expandAll.
The menu's items (collapse-all / expand-all / show TOC) are all section-scoped and behave as no-ops on dashboards with zero containers. Hide the toolbar entry-point in that case so it does not surface unhelpful UI on sectionless dashboards. The TOC itself already short-circuits when containers is empty.
DBDashboardPage owned a subscription on the 'collapsed' and 'expanded' URL params via useQueryState; useDashboardSectionNav independently subscribed to the same two keys. The hook now receives setters from the caller instead so DBDashboardPage is the sole subscriber per key. Eliminates a potential interaction between concurrent nuqs subscribers during initial hydration on the saved dashboard route, where the expected post-hydration re-render to populate router.query.dashboardId could otherwise be delayed. Behaviour of collapseAll / expandAll / scrollToContainer is unchanged; tests updated to inject the setters.
89682c4 to
2b6e5ee
Compare
Summary
Adds three opt-in dashboard navigation aids for dashboards that have grown past comfortable scroll length. All three are off by default — existing dashboards look unchanged for users who never open the new menu.
DashboardContainerrenders withid="container-<id>", and hovering a section header reveals a "copy link" icon that writes<current-url>#container-<id>to the clipboard (via the shared@/utils/clipboardhelper). Loading the page with such a hash auto-scrolls to that section, auto-expanding it first.?collapsed=…&expanded=…), so a compact view is shareable like any other dashboard state.mdbreakpoint. Visibility is a per-user preference inuseUserPreferences.Core logic lives in
src/hooks/useDashboardSectionNav.ts(scrollToContainer,copySectionLink,collapseAll,expandAll). New components areDashboardTOCandDashboardViewOptions.DashboardContainergained an optionalonCopyLinkprop and a stableidattribute on its root.Screenshots or video
Before

After
dashboardtoc.mp4
How to test on Vercel preview
Preview routes: `/dashboards/[id]` (any existing dashboard with 4+ sections)
Steps:
References
Reviewer notes (pre-push fanout findings)
Ran `ce-correctness`, `ce-maintainability`, `ce-adversarial`, `ce-kieran-typescript`, and `ce-testing` reviewers in parallel before pushing. Triaged each finding as introduced/amplified/pre-existing.
Fixed before push (P1 / P2):
Known follow-ups (P2, not fixed in this PR):