Show the sidebar on every page except the print view
AppShell showed the sidebar only on the project list and overview, so it disappeared on the building structure page and in the circuit list editor. It is collapsible, so it now stays on every page. Only the print view, a stand-alone document opened in its own tab and printed as PDF, keeps the full width. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
cd89c4a499
commit
5f4d9bf789
2 changed files with 5 additions and 3 deletions
|
|
@ -4,12 +4,14 @@ import { useEffect, useState } from "react";
|
|||
import { usePathname } from "next/navigation";
|
||||
import { Sidebar } from "./Sidebar";
|
||||
|
||||
const PROJECT_AREA_PATTERN = /^\/projects(\/[^/]+)?$/;
|
||||
// Every page shows the (collapsible) sidebar except the print view, which is
|
||||
// a stand-alone document opened in its own tab and printed as PDF.
|
||||
const PRINT_VIEW_PATTERN = /^\/projects\/[^/]+\/print(\/|$)/;
|
||||
const SIDEBAR_COLLAPSED_STORAGE_KEY = "leistungsbilanz:sidebar-collapsed";
|
||||
|
||||
export function AppShell({ children }: { children: React.ReactNode }) {
|
||||
const pathname = usePathname();
|
||||
const showSidebar = PROJECT_AREA_PATTERN.test(pathname ?? "");
|
||||
const showSidebar = !PRINT_VIEW_PATTERN.test(pathname ?? "");
|
||||
const [isSidebarCollapsed, setIsSidebarCollapsed] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue