Files
gridpilot.gg/apps/website/templates/layout/RootAppShellTemplate.tsx
2026-01-19 21:41:59 +01:00

47 lines
1.4 KiB
TypeScript

'use client';
import { AppFooter } from '@/components/layout/AppFooter';
import { AppHeader } from '@/components/layout/AppHeader';
import { AppSidebar } from '@/components/layout/AppSidebar';
import { useCurrentSession } from '@/hooks/auth/useCurrentSession';
import { routes } from '@/lib/routing/RouteConfig';
import { Layout } from '@/ui/Layout';
import { Container } from '@/ui/Container';
import { usePathname } from 'next/navigation';
import React from 'react';
export interface RootAppShellViewData {
children: React.ReactNode;
}
/**
* RootAppShellTemplate orchestrates the top-level semantic shells of the application.
* It uses the canonical ui/Layout component to define the app frame.
*/
export function RootAppShellTemplate({ children }: RootAppShellViewData) {
const pathname = usePathname();
const { data: session } = useCurrentSession();
const isAuthenticated = !!session;
// Hide sidebar on landing page for unauthenticated users
const isLandingPage = pathname === routes.public.home;
const showSidebar = isAuthenticated && !isLandingPage;
return (
<Layout
header={<AppHeader />}
sidebar={showSidebar ? <AppSidebar /> : undefined}
footer={<AppFooter />}
fixedHeader
fixedSidebar
>
<Container
size={isLandingPage ? 'full' : 'xl'}
py={isLandingPage ? 0 : 8}
>
{children}
</Container>
</Layout>
);
}