Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions apps/web/src/components/sidebar/SidebarChrome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SettingsIcon,
} from "lucide-react";
import { memo, useCallback } from "react";
import { Link, useLocation, useNavigate } from "@tanstack/react-router";
import { Link, useCanGoBack, useLocation, useNavigate } from "@tanstack/react-router";

import { useEnvironmentIdentificationMode } from "../../hooks/useSettings";
import { cn } from "../../lib/utils";
Expand Down Expand Up @@ -119,14 +119,17 @@ function T3Wordmark() {

export const SidebarChromeFooter = memo(function SidebarChromeFooter() {
const navigate = useNavigate();
const canGoBack = useCanGoBack();
const { isMobile, setOpenMobile } = useSidebar();
const currentFooterPage = useLocation({
select: (location) =>
location.pathname === "/usage"
? "usage"
: location.pathname === "/pull-requests"
? "pull-requests"
: null,
: location.pathname.startsWith("/projects/")
? "project-settings"
: null,
Comment thread
macroscopeapp[bot] marked this conversation as resolved.
Outdated
});
const { environments } = useEnvironments();
// The page reads every connected server, so one of them offering pull requests is enough for
Expand Down Expand Up @@ -157,8 +160,12 @@ export const SidebarChromeFooter = memo(function SidebarChromeFooter() {

const handleBackClick = useCallback(() => {
closeMobileSidebar();
if (canGoBack) {
window.history.back();
return;
}
void navigate({ to: "/" });
}, [closeMobileSidebar, navigate]);
}, [canGoBack, closeMobileSidebar, navigate]);

return (
<SidebarFooter className="p-[var(--sidebar-content-inset)]">
Expand Down
Loading