The best way to control Claude Code, Codex and more from any computer or phone
feat(web): add back buttons for the pull requests and usage pages in the sidebar footer (#6031)
Co-authored-by: shivam <91240327+shivamhwp@users.noreply.github.com>
Utkarsh Patil committed
Aug 11, 2026 at 21:56 UTC
44621c345fe7ce7cfa5d8e5286290d9c8dc20ce5
1 file changed
+48
-9
apps/web/src/components/sidebar/SidebarChrome.tsx
+48
-9
@@ -1,6 +1,11 @@
1
-import { ChartNoAxesColumnIcon, GitPullRequestIcon, SettingsIcon } from "lucide-react";
1
+import {
2
+ ArrowLeftIcon,
3
+ ChartNoAxesColumnIcon,
4
+ GitPullRequestIcon,
5
+ SettingsIcon,
6
+} from "lucide-react";
7
import { memo, useCallback } from "react";
3
-import { Link, useNavigate } from "@tanstack/react-router";
8
+import { Link, useCanGoBack, useLocation, useNavigate } from "@tanstack/react-router";
9
10
import { useEnvironmentIdentificationMode } from "../../hooks/useSettings";
11
import { cn } from "../../lib/utils";
@@ -114,6 +119,15 @@ function T3Wordmark() {
119
export const SidebarChromeFooter = memo(function SidebarChromeFooter() {
120
const navigate = useNavigate();
121
const { isMobile, setOpenMobile } = useSidebar();
122
+ const canGoBack = useCanGoBack();
123
+ const currentFooterPage = useLocation({
124
+ select: (location) =>
125
+ location.pathname === "/usage"
126
+ ? "usage"
127
+ : location.pathname === "/pull-requests"
128
+ ? "pull-requests"
129
+ : null,
130
+ });
131
const primaryEnvironment = usePrimaryEnvironment();
132
const pullRequestsSupported =
133
primaryEnvironment?.serverConfig?.environment.capabilities.pullRequests === true;
@@ -138,12 +152,28 @@ export const SidebarChromeFooter = memo(function SidebarChromeFooter() {
152
void navigate({ to: "/usage" });
153
}, [isMobile, navigate, setOpenMobile]);
154
155
+ const handleBackClick = useCallback(() => {
156
+ closeMobileSidebar();
157
+ if (canGoBack) {
158
+ window.history.back();
159
+ return;
160
+ }
161
+ void navigate({ to: "/" });
162
+ }, [canGoBack, closeMobileSidebar, navigate]);
163
+
164
return (
165
<SidebarFooter className="p-[var(--sidebar-content-inset)]">
166
<SidebarProviderUpdatePill />
167
<SidebarUpdatePill />
168
<SidebarMenu>
146
- {pullRequestsSupported ? (
169
+ {currentFooterPage === "pull-requests" ? (
170
+ <SidebarMenuItem>
171
+ <SidebarMenuButton onClick={handleBackClick}>
172
+ <ArrowLeftIcon />
173
+ <span>Back</span>
174
+ </SidebarMenuButton>
175
+ </SidebarMenuItem>
176
+ ) : pullRequestsSupported ? (
177
<SidebarMenuItem>
178
<SidebarMenuButton onClick={handlePullRequestsClick}>
179
<GitPullRequestIcon />
@@ -151,12 +181,21 @@ export const SidebarChromeFooter = memo(function SidebarChromeFooter() {
181
</SidebarMenuButton>
182
</SidebarMenuItem>
183
) : null}
154
- <SidebarMenuItem>
155
- <SidebarMenuButton onClick={handleUsageClick}>
156
- <ChartNoAxesColumnIcon />
157
- <span>Usage</span>
158
- </SidebarMenuButton>
159
- </SidebarMenuItem>
184
+ {currentFooterPage === "usage" ? (
185
+ <SidebarMenuItem>
186
+ <SidebarMenuButton onClick={handleBackClick}>
187
+ <ArrowLeftIcon />
188
+ <span>Back</span>
189
+ </SidebarMenuButton>
190
+ </SidebarMenuItem>
191
+ ) : (
192
+ <SidebarMenuItem>
193
+ <SidebarMenuButton onClick={handleUsageClick}>
194
+ <ChartNoAxesColumnIcon />
195
+ <span>Usage</span>
196
+ </SidebarMenuButton>
197
+ </SidebarMenuItem>
198
+ )}
199
<SidebarMenuItem>
200
<SidebarMenuButton onClick={handleSettingsClick}>
201
<SettingsIcon />