Skip to content

Commit 8db9672

Browse files
committed
fix(docs): suppress AppSidebar on /docs so the docs nav is the only sidebar
Two-sidebar stack (AppSidebar at left edge of viewport + the in-page DocsSidebar right next to it) read as cluttered even after the prior collision fix. ``/docs`` ships with its own dense docs nav that wants to be the primary sidebar while reading; the global app nav is visual noise in that mode. Wrapped the AppSidebar render, its mobile hamburger toggle, and the mobile drawer backdrop in a ``hideAppSidebar = location.pathname. startsWith("/docs")`` guard inside ``Layout.jsx``. When signed-in users land on /docs, they now see only the docs sidebar inside ``.main``; the page header (logo + OrgSwitcher + plan badge + NotificationBell + UserButton) stays as the global affordance for leaving docs. Other ``SmartLayout``-routed pages (/pricing, /sentinel) still render the AppSidebar — the pattern is per-route, not for everything that happens to share PublicLayout-able URLs. If we add another page in the future that owns its own primary nav, just extend the same ``startsWith`` check. Verification: ``npm run build`` clean (485ms), ``npm run test`` 55/55 green.
1 parent 34d1110 commit 8db9672

1 file changed

Lines changed: 30 additions & 16 deletions

File tree

frontend/src/components/Layout.jsx

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ function Layout() {
1616
const isProPlus = planName === "pro_plus"
1717
const isPro = planName === "pro" || isProPlus
1818

19+
// Routes that own their own primary sidebar — when we're on one of
20+
// them, suppress the global AppSidebar (and its mobile hamburger)
21+
// so we don't end up with two sidebars stacked at left:0. /docs
22+
// ships with the dense in-page docs nav (DocsSidebar) which is the
23+
// right primary nav while reading; signed-in users can still jump
24+
// back via the logo or browser back.
25+
const hideAppSidebar = location.pathname.startsWith("/docs")
26+
1927
useEffect(() => {
2028
setSidebarOpen(false)
2129
}, [location.pathname])
@@ -38,15 +46,17 @@ function Layout() {
3846
<div className="header-content">
3947
<div className="header-left">
4048
<SignedIn>
41-
<button
42-
type="button"
43-
className="app-sidebar-toggle"
44-
aria-label={sidebarOpen ? "Close navigation" : "Open navigation"}
45-
aria-expanded={sidebarOpen}
46-
onClick={() => setSidebarOpen((o) => !o)}
47-
>
48-
<span aria-hidden="true"></span>
49-
</button>
49+
{!hideAppSidebar && (
50+
<button
51+
type="button"
52+
className="app-sidebar-toggle"
53+
aria-label={sidebarOpen ? "Close navigation" : "Open navigation"}
54+
aria-expanded={sidebarOpen}
55+
onClick={() => setSidebarOpen((o) => !o)}
56+
>
57+
<span aria-hidden="true"></span>
58+
</button>
59+
)}
5060
</SignedIn>
5161

5262
<Link to="/" className="logo">
@@ -92,20 +102,24 @@ function Layout() {
92102

93103
<div className="layout-body">
94104
<SignedIn>
95-
<AppSidebar open={sidebarOpen} onClose={() => setSidebarOpen(false)} />
105+
{!hideAppSidebar && (
106+
<AppSidebar open={sidebarOpen} onClose={() => setSidebarOpen(false)} />
107+
)}
96108
</SignedIn>
97109
<main className="main">
98110
<Outlet />
99111
</main>
100112
</div>
101113

102114
<SignedIn>
103-
<div
104-
className="app-sidebar-backdrop"
105-
data-open={sidebarOpen ? "true" : "false"}
106-
onClick={() => setSidebarOpen(false)}
107-
aria-hidden="true"
108-
/>
115+
{!hideAppSidebar && (
116+
<div
117+
className="app-sidebar-backdrop"
118+
data-open={sidebarOpen ? "true" : "false"}
119+
onClick={() => setSidebarOpen(false)}
120+
aria-hidden="true"
121+
/>
122+
)}
109123
</SignedIn>
110124

111125
<ToastContainer />

0 commit comments

Comments
 (0)