The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 24, 10:15 UTC
fix(web): smooth settings sidebar transitions (#9811)
Julius Marminge committed
Sep 4, 2026 at 17:06 UTC
2e61301b1325e30cb9464e193299a7e469f7ec08
1 file changed
+39
-16
apps/web/src/components/settings/SettingsSidebarNav.tsx
+39
-16
@@ -8,6 +8,7 @@ import {
8
useState,
9
type ComponentType,
10
type KeyboardEvent,
11
+ type ReactNode,
12
} from "react";
13
import {
14
ArchiveIcon,
@@ -24,6 +25,7 @@ import {
25
import { useLocation, useNavigate } from "@tanstack/react-router";
26
27
import { Button } from "../ui/button";
28
+import { Collapsible, CollapsiblePanel } from "../ui/collapsible";
29
import { Input } from "../ui/input";
30
import { Kbd } from "../ui/kbd";
31
import {
@@ -114,6 +116,22 @@ function SettingsSectionIcon({ to }: { to: SettingsPath }) {
116
return <Icon className="mt-0.5 size-3.5 shrink-0 text-sidebar-muted-foreground/60" />;
117
}
118
119
+function SettingsSubmenuCollapse({
120
+ open,
121
+ children,
122
+}: {
123
+ readonly open: boolean;
124
+ readonly children: ReactNode;
125
+}) {
126
+ return (
127
+ <Collapsible open={open}>
128
+ <CollapsiblePanel className="duration-150 ease-out motion-reduce:transition-none">
129
+ {children}
130
+ </CollapsiblePanel>
131
+ </Collapsible>
132
+ );
133
+}
134
+
135
export function SettingsSidebarNav({ pathname }: { pathname: string }) {
136
const navigate = useNavigate();
137
const currentHash = useLocation({ select: (location) => location.hash });
@@ -125,6 +143,9 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
143
const results = useMemo(() => searchSettings(query, searchableItems), [query, searchableItems]);
144
const isSearching = query.trim().length > 0;
145
const hasResults = results.length > 0;
146
+ const activeSettingsPath = SETTINGS_NAV_ITEMS.find(
147
+ (item) => pathname === item.to || pathname.startsWith(`${item.to}/`),
148
+ )?.to;
149
150
useEffect(() => {
151
setActiveResultIndex((index) => Math.min(index, Math.max(results.length - 1, 0)));
@@ -347,8 +368,8 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
368
<SidebarMenu className="ps-px">
369
{SETTINGS_NAV_ITEMS.map((item) => {
370
const Icon = item.icon;
350
- const isActive = pathname === item.to || pathname.startsWith(`${item.to}/`);
371
const pageSections = SETTINGS_PAGE_SECTIONS[item.to];
372
+ const isActive = activeSettingsPath === item.to;
373
return (
374
<SidebarMenuItem key={item.to}>
375
<SidebarMenuButton
@@ -358,21 +379,23 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
379
<Icon />
380
<span className="truncate">{item.label}</span>
381
</SidebarMenuButton>
361
- {isActive && pageSections ? (
362
- <SidebarMenuSub className="border-l-0">
363
- {pageSections.map((section) => (
364
- <SidebarMenuSubItem key={section.targetId}>
365
- <SidebarMenuSubButton
366
- render={<button type="button" />}
367
- size="sm"
368
- className="w-full text-sidebar-muted-foreground/65"
369
- onClick={() => handlePageSectionClick(item.to, section.targetId)}
370
- >
371
- <span className="ms-0.5">{section.label}</span>
372
- </SidebarMenuSubButton>
373
- </SidebarMenuSubItem>
374
- ))}
375
- </SidebarMenuSub>
382
+ {pageSections ? (
383
+ <SettingsSubmenuCollapse open={isActive}>
384
+ <SidebarMenuSub className="border-l-0">
385
+ {pageSections.map((section) => (
386
+ <SidebarMenuSubItem key={section.targetId}>
387
+ <SidebarMenuSubButton
388
+ render={<button type="button" />}
389
+ size="sm"
390
+ className="w-full text-sidebar-muted-foreground/65"
391
+ onClick={() => handlePageSectionClick(item.to, section.targetId)}
392
+ >
393
+ <span className="ms-0.5">{section.label}</span>
394
+ </SidebarMenuSubButton>
395
+ </SidebarMenuSubItem>
396
+ ))}
397
+ </SidebarMenuSub>
398
+ </SettingsSubmenuCollapse>
399
) : null}
400
</SidebarMenuItem>
401
);