Skip to content

feat(console): view-switch nav + non-collapsible admin sidebar#360

Merged
furukama merged 11 commits intomainfrom
extract-admin-sidebar-collapse
Apr 21, 2026
Merged

feat(console): view-switch nav + non-collapsible admin sidebar#360
furukama merged 11 commits intomainfrom
extract-admin-sidebar-collapse

Conversation

@maxnoller
Copy link
Copy Markdown
Member

@maxnoller maxnoller commented Apr 18, 2026

Summary

Extracts the view-switch topbar nav from #323 and simplifies the admin sidebar to always-expanded on desktop (mobile keeps the sheet). Replaces the earlier plan to auto-collapse on /admin/chat — the sidebar is no longer collapsible at all.

Behavior

  • New ViewSwitchNav component for switching between Chat / Agents / Admin / Docs in the topbar
  • Admin sidebar renders with collapsible=\"none\" on desktop (no toggle button); mobile still opens/closes via the sheet + trigger
  • Router restructured so all admin pages live under /admin/* and chat lives at /chat (outside the admin layout)

Files

  • components/app-shell.{tsx,test.tsx}
  • components/sidebar/{index.tsx, app-sidebar.tsx, navigation.ts, sidebar.test.tsx, index.module.css}
  • components/admin-nav.ts
  • components/view-switch.tsx (new)
  • routes/{dashboard.tsx, gateway.tsx}, router.tsx, styles.css

Test plan

  • `vitest run` — 204/204 console tests pass
  • `tsc --noEmit` clean
  • Admin sidebar stays fully expanded on every `/admin/*` route on desktop
  • Mobile viewport — hamburger opens the sheet, tapping a link closes it
  • View-switch nav highlights the active section on both admin and chat routes

🤖 Generated with Claude Code

Max Noller and others added 2 commits April 18, 2026 16:53
Extracted from #323. Depends on #358 for the shared Button and the
PanelLeft/SquarePen icons consumed by the sidebar header and new
view-switch control.

Behavior:
- Sidebar collapses to an icon-only rail on the chat page and restores
  to the full layout on navigation away
- Collapsed nav items show title tooltips; brand mark gets a tooltip too
- When collapsed on desktop, an expand trigger (aria-expanded="false")
  appears so keyboard users can restore the sidebar
- New view-switch component provides a dedicated toggle for chat vs
  admin surfaces, wired into the router

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- view-switch: replace window.location.pathname with useRouterState so
  the active state updates on SPA navigation; replace raw <a href> for
  internal routes with TanStack <Link> so they no longer trigger full
  page reloads. External GitHub link opens in a new tab.
- router.tsx: drop the ChatErrorBoundary + QueryErrorResetBoundary
  block — that belongs to the React 19 chat refactor (PR E), not the
  sidebar/view-switch extraction.
- sidebar: skip localStorage write when setOpen resolves to the same
  value, avoiding a spurious write on every re-click at the current
  state.
- Drop a what-comment in sidebar/index.module.css.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Base automatically changed from extract-shared-button-icons to main April 18, 2026 21:45
@maxnoller maxnoller marked this pull request as ready for review April 18, 2026 21:48
@maxnoller
Copy link
Copy Markdown
Member Author

Code review

Found 2 issues:

  1. Dead CSS class .page-content-full added with no caller. AGENTS.md §3.2 YAGNI says "Do not add config keys, interfaces, or feature flags without a concrete caller." Grepping console/ turns up zero references to this class in any TSX/TS file. This same pattern was flagged on PR feat(console): extract sidebar with collapsible desktop + mobile drawer #224.

}
.page-content-full {
height: calc(100% + 48px);
margin: -24px;
}

  1. New collapsible prop supports an 'offcanvas' mode (plus accompanying .root[data-collapsible=\"offcanvas\"] CSS rule) that has no callers — AppSidebar never passes collapsible, so the effective value is always the default 'icon'. Commit 3de467b0 previously removed the unreachable offcanvas/icon branches for the same reason; reintroducing the 'offcanvas' variant without a caller reintroduces dead code (AGENTS.md §3.2 YAGNI).

type SidebarCollapsible = 'icon' | 'offcanvas' | 'none';
type SidebarProps = {
children: ReactNode;

.root[data-collapsible="offcanvas"] {
width: 0;
padding: 0;
overflow: hidden;
border: none;
}

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

…r mode

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@maxnoller maxnoller requested a review from furukama April 19, 2026 09:54
Max Noller and others added 2 commits April 19, 2026 16:05
Admin sidebar is always expanded on desktop; mobile still uses the
sheet. Keeps the view-switch extraction and Sidebar component's
collapsible API (used in 'none' mode by both AppSidebar and ChatSidebar).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@maxnoller maxnoller changed the title feat(console): collapsible admin sidebar with view-switch feat(console): view-switch nav + non-collapsible admin sidebar Apr 19, 2026
Copy link
Copy Markdown
Contributor

@furukama furukama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The admin sidebar changes size on every click to a subcategory. Plus: smaller layouts: no menu hamburger button anymore.

Address PR #360 review. The sidebar `.root` had no explicit flex
basis, so wide `.inset` content (tables, jobs board) squeezed it
narrower on some admin routes. Pin it with `flex: 0 0 var(--sidebar-width)`.

Add a `MobileTopbarTrigger` in the app-shell topbar so mobile users
can open the sidebar sheet — previously the only trigger lived inside
the sheet header, leaving no way to reopen the sheet once closed.
@maxnoller maxnoller requested a review from furukama April 20, 2026 22:34
@furukama furukama merged commit dc2668c into main Apr 21, 2026
6 checks passed
@furukama furukama deleted the extract-admin-sidebar-collapse branch April 21, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants