Files
tm_panel/src/components/Layouts/conditional-layout.tsx
T
AmirReza Jamali 283aa9385e refactor(tender-details): enhance tender section navigation and layout
- Introduced a scroll spy feature for tender sections to improve navigation experience.
- Added TenderSectionNavList component for better section navigation and user interaction.
- Updated MainLayout to adjust main content overflow behavior for improved layout consistency.
- Refactored TendersTable to remove unnecessary create button and streamline feedback navigation.
2026-05-10 10:13:57 +03:30

49 lines
1.4 KiB
TypeScript

"use client";
import { AuthGuard, LoginGuard } from "@/contexts";
import { useIsMobile } from "@/hooks/use-mobile";
import { usePathname } from "next/navigation";
import type { PropsWithChildren } from "react";
import { Header } from "./header";
import Notification from "./notification";
import { Sidebar } from "./sidebar";
function MainLayout({ children }: PropsWithChildren) {
const isMobile = useIsMobile();
return (
<div className="flex min-h-screen">
<Sidebar />
{/* Spacer to reserve space for collapsed sidebar on mobile - avoids reflow */}
{isMobile && <div className="w-[70px] shrink-0" />}
<div className="flex min-h-0 min-w-0 flex-1 flex-col bg-gray-2 dark:bg-[#020d1a]">
<Header />
<main className="isolate mx-auto flex min-h-0 w-full max-w-screen-2xl flex-1 flex-col overflow-x-clip px-3 py-4 md:px-4 md:py-6 2xl:px-6 2xl:py-4">
{children}
</main>
</div>
</div>
);
}
export function ConditionalLayout({ children }: PropsWithChildren) {
const pathname = usePathname();
const isAuthPage = pathname.startsWith("/auth");
return (
<>
{isAuthPage ? (
<LoginGuard>
<main>{children}</main>
</LoginGuard>
) : (
<AuthGuard>
<Notification>
<MainLayout>{children}</MainLayout>
</Notification>
</AuthGuard>
)}
</>
);
}