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 25, 05:00 UTC
fix(web): make thread archive button always visible on mobile (#2423)
Co-authored-by: Claude Sonnet 4.7 <noreply@anthropic.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Jan Jaap committed
Apr 30, 2026 at 20:46 UTC
532a1d891db03276764d2528b30a0e6f6c396b6a
3 files changed
+65
-19
apps/web/src/components/Sidebar.tsx
+19
-11
@@ -373,7 +373,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
373
const threadMetaClassName = isConfirmingArchive
374
? "pointer-events-none opacity-0"
375
: !isThreadRunning
376
- ? "pointer-events-none transition-opacity duration-150 group-hover/menu-sub-item:opacity-0 group-focus-within/menu-sub-item:opacity-0"
376
+ ? "pointer-events-none transition-opacity duration-150 max-sm:pr-6 group-hover/menu-sub-item:opacity-0 group-focus-within/menu-sub-item:opacity-0"
377
: "pointer-events-none";
378
const clearConfirmingArchive = useCallback(() => {
379
setConfirmingArchiveThreadKey((current) => (current === threadKey ? null : current));
@@ -605,7 +605,11 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
605
<TerminalIcon className={`size-3 ${terminalStatus.pulse ? "animate-pulse" : ""}`} />
606
</span>
607
)}
608
- <div className="flex min-w-12 justify-end">
608
+ <div
609
+ className={`flex min-w-12 justify-end ${
610
+ isRemoteThread ? "max-sm:min-w-24" : "max-sm:min-w-20"
611
+ }`}
612
+ >
613
{isConfirmingArchive ? (
614
<button
615
ref={handleConfirmArchiveRef}
@@ -621,13 +625,13 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
625
</button>
626
) : !isThreadRunning ? (
627
appSettingsConfirmThreadArchive ? (
624
- <div className="pointer-events-none absolute top-1/2 right-1 -translate-y-1/2 opacity-0 transition-opacity duration-150 group-hover/menu-sub-item:pointer-events-auto group-hover/menu-sub-item:opacity-100 group-focus-within/menu-sub-item:pointer-events-auto group-focus-within/menu-sub-item:opacity-100">
628
+ <div className="pointer-events-none absolute top-1/2 right-1 -translate-y-1/2 opacity-0 transition-opacity duration-150 max-sm:pointer-events-auto max-sm:opacity-100 group-hover/menu-sub-item:pointer-events-auto group-hover/menu-sub-item:opacity-100 group-focus-within/menu-sub-item:pointer-events-auto group-focus-within/menu-sub-item:opacity-100">
629
<button
630
type="button"
631
data-thread-selection-safe
632
data-testid={`thread-archive-${thread.id}`}
633
aria-label={`Archive ${thread.title}`}
630
- className="inline-flex size-5 cursor-pointer items-center justify-center text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring"
634
+ className="inline-flex size-5 cursor-pointer items-center justify-center text-muted-foreground/60 transition-colors hover:text-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring"
635
onPointerDown={stopPropagationOnPointerDown}
636
onClick={handleStartArchiveConfirmation}
637
>
@@ -638,13 +642,13 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
642
<Tooltip>
643
<TooltipTrigger
644
render={
641
- <div className="pointer-events-none absolute top-1/2 right-1 -translate-y-1/2 opacity-0 transition-opacity duration-150 group-hover/menu-sub-item:pointer-events-auto group-hover/menu-sub-item:opacity-100 group-focus-within/menu-sub-item:pointer-events-auto group-focus-within/menu-sub-item:opacity-100">
645
+ <div className="pointer-events-none absolute top-1/2 right-1 -translate-y-1/2 opacity-0 transition-opacity duration-150 max-sm:pointer-events-auto max-sm:opacity-100 group-hover/menu-sub-item:pointer-events-auto group-hover/menu-sub-item:opacity-100 group-focus-within/menu-sub-item:pointer-events-auto group-focus-within/menu-sub-item:opacity-100">
646
<button
647
type="button"
648
data-thread-selection-safe
649
data-testid={`thread-archive-${thread.id}`}
650
aria-label={`Archive ${thread.title}`}
647
- className="inline-flex size-5 cursor-pointer items-center justify-center text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring"
651
+ className="inline-flex size-5 cursor-pointer items-center justify-center text-muted-foreground/60 transition-colors hover:text-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring"
652
onPointerDown={stopPropagationOnPointerDown}
653
onClick={handleArchiveImmediateClick}
654
>
@@ -665,11 +669,11 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
669
render={
670
<span
671
aria-label={threadEnvironmentLabel ?? "Remote"}
668
- className="inline-flex items-center justify-center"
672
+ className="inline-flex h-5 items-center justify-center"
673
/>
674
}
675
>
672
- <CloudIcon className="size-3 text-muted-foreground/40" />
676
+ <CloudIcon className="block size-3 text-muted-foreground/60" />
677
</TooltipTrigger>
678
<TooltipPopup side="top">{threadEnvironmentLabel}</TooltipPopup>
679
</Tooltip>
@@ -2025,7 +2029,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
2029
? "Remote project"
2030
: "Available in multiple environments"
2031
}
2028
- className="pointer-events-none absolute top-1 right-1.5 inline-flex size-5 items-center justify-center rounded-md text-muted-foreground/50 transition-opacity duration-150 max-sm:right-7 group-hover/project-header:opacity-0 group-focus-within/project-header:opacity-0 max-sm:group-hover/project-header:opacity-100 max-sm:group-focus-within/project-header:opacity-100"
2032
+ className="pointer-events-none absolute top-1 right-1.5 inline-flex size-5 items-center justify-center rounded-md text-muted-foreground/60 transition-opacity duration-150 max-sm:right-7 group-hover/project-header:opacity-0 group-focus-within/project-header:opacity-0 max-sm:group-hover/project-header:opacity-100 max-sm:group-focus-within/project-header:opacity-100"
2033
/>
2034
}
2035
>
@@ -2044,7 +2048,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
2048
type="button"
2049
aria-label={`Create new thread in ${project.displayName}`}
2050
data-testid="new-thread-button"
2047
- className="inline-flex size-5 cursor-pointer items-center justify-center rounded-md text-muted-foreground/70 hover:bg-secondary hover:text-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring"
2051
+ className="inline-flex size-5 cursor-pointer items-center justify-center rounded-md text-muted-foreground/60 hover:bg-secondary hover:text-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring"
2052
onClick={handleCreateThreadClick}
2053
>
2054
<SquarePenIcon className="size-3.5" />
@@ -2420,9 +2424,13 @@ const SidebarChromeHeader = memo(function SidebarChromeHeader({
2424
2425
const SidebarChromeFooter = memo(function SidebarChromeFooter() {
2426
const navigate = useNavigate();
2427
+ const { isMobile, setOpenMobile } = useSidebar();
2428
const handleSettingsClick = useCallback(() => {
2429
+ if (isMobile) {
2430
+ setOpenMobile(false);
2431
+ }
2432
void navigate({ to: "/settings" });
2425
- }, [navigate]);
2433
+ }, [isMobile, navigate, setOpenMobile]);
2434
2435
return (
2436
<SidebarFooter className="p-2">
apps/web/src/components/settings/SettingsSidebarNav.tsx
+26
-4
@@ -1,6 +1,6 @@
1
-import type { ComponentType } from "react";
1
+import { useCallback, type ComponentType } from "react";
2
import { ArchiveIcon, ArrowLeftIcon, Link2Icon, Settings2Icon } from "lucide-react";
3
-import { useNavigate } from "@tanstack/react-router";
3
+import { useCanGoBack, useNavigate } from "@tanstack/react-router";
4
5
import {
6
SidebarContent,
@@ -10,6 +10,7 @@ import {
10
SidebarMenuButton,
11
SidebarMenuItem,
12
SidebarSeparator,
13
+ useSidebar,
14
} from "../ui/sidebar";
15
16
export type SettingsSectionPath =
@@ -29,6 +30,27 @@ export const SETTINGS_NAV_ITEMS: ReadonlyArray<{
30
31
export function SettingsSidebarNav({ pathname }: { pathname: string }) {
32
const navigate = useNavigate();
33
+ const canGoBack = useCanGoBack();
34
+ const { isMobile, setOpenMobile } = useSidebar();
35
+ const handleSectionClick = useCallback(
36
+ (to: SettingsSectionPath) => {
37
+ if (isMobile) {
38
+ setOpenMobile(false);
39
+ }
40
+ void navigate({ to, replace: true });
41
+ },
42
+ [isMobile, navigate, setOpenMobile],
43
+ );
44
+ const handleBackClick = useCallback(() => {
45
+ if (isMobile) {
46
+ setOpenMobile(false);
47
+ }
48
+ if (canGoBack) {
49
+ window.history.back();
50
+ return;
51
+ }
52
+ void navigate({ to: "/" });
53
+ }, [canGoBack, isMobile, navigate, setOpenMobile]);
54
55
return (
56
<>
@@ -48,7 +70,7 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
70
? "gap-2.5 px-2.5 py-2 text-left text-[13px] font-medium text-foreground"
71
: "gap-2.5 px-2.5 py-2 text-left text-[13px] text-muted-foreground/70 hover:text-foreground/80"
72
}
51
- onClick={() => void navigate({ to: item.to, replace: true })}
73
+ onClick={() => handleSectionClick(item.to)}
74
>
75
<Icon
76
className={
@@ -73,7 +95,7 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
95
<SidebarMenuButton
96
size="sm"
97
className="gap-2 px-2 py-2 text-xs text-muted-foreground hover:bg-accent hover:text-foreground"
76
- onClick={() => window.history.back()}
98
+ onClick={handleBackClick}
99
>
100
<ArrowLeftIcon className="size-4" />
101
<span>Back</span>
apps/web/src/routes/settings.tsx
+20
-4
@@ -1,6 +1,13 @@
1
import { RotateCcwIcon } from "lucide-react";
2
-import { Outlet, createFileRoute, redirect, useLocation } from "@tanstack/react-router";
3
-import { useEffect, useState } from "react";
2
+import {
3
+ Outlet,
4
+ createFileRoute,
5
+ redirect,
6
+ useCanGoBack,
7
+ useLocation,
8
+ useNavigate,
9
+} from "@tanstack/react-router";
10
+import { useCallback, useEffect, useState } from "react";
11
12
import { useSettingsRestore } from "../components/settings/SettingsPanels";
13
import { Button } from "../components/ui/button";
@@ -25,16 +32,25 @@ function RestoreDefaultsButton({ onRestored }: { onRestored: () => void }) {
32
33
function SettingsContentLayout() {
34
const location = useLocation();
35
+ const navigate = useNavigate();
36
+ const canGoBack = useCanGoBack();
37
const [restoreSignal, setRestoreSignal] = useState(0);
38
const showRestoreDefaults = location.pathname === "/settings/general";
39
const handleRestored = () => setRestoreSignal((value) => value + 1);
40
+ const navigateBackWithinApp = useCallback(() => {
41
+ if (canGoBack) {
42
+ window.history.back();
43
+ return;
44
+ }
45
+ void navigate({ to: "/" });
46
+ }, [canGoBack, navigate]);
47
48
useEffect(() => {
49
const onKeyDown = (event: KeyboardEvent) => {
50
if (event.defaultPrevented) return;
51
if (event.key === "Escape") {
52
event.preventDefault();
37
- window.history.back();
53
+ navigateBackWithinApp();
54
}
55
};
56
@@ -42,7 +58,7 @@ function SettingsContentLayout() {
58
return () => {
59
window.removeEventListener("keydown", onKeyDown);
60
};
45
- }, []);
61
+ }, [navigateBackWithinApp]);
62
63
return (
64
<SidebarInset className="h-dvh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground isolate">