website refactor
This commit is contained in:
@@ -9,6 +9,9 @@ import { GlobalSidebarTemplate } from './GlobalSidebarTemplate';
|
||||
import { GlobalFooterTemplate } from './GlobalFooterTemplate';
|
||||
import { HeaderContentTemplate } from './HeaderContentTemplate';
|
||||
import { Box } from '@/ui/Box';
|
||||
import { usePathname } from 'next/navigation';
|
||||
import { useCurrentSession } from '@/hooks/auth/useCurrentSession';
|
||||
import { routes } from '@/lib/routing/RouteConfig';
|
||||
|
||||
export interface RootAppShellViewData {
|
||||
children: React.ReactNode;
|
||||
@@ -22,6 +25,14 @@ export interface RootAppShellViewData {
|
||||
* - ContentViewport = content area
|
||||
*/
|
||||
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 (
|
||||
<AppShell>
|
||||
<ControlBar>
|
||||
@@ -31,10 +42,10 @@ export function RootAppShellTemplate({ children }: RootAppShellViewData) {
|
||||
</ControlBar>
|
||||
|
||||
<Box display="flex" flexGrow={1} overflow="hidden">
|
||||
<GlobalSidebarTemplate />
|
||||
{showSidebar && <GlobalSidebarTemplate />}
|
||||
|
||||
<Box display="flex" flexGrow={1} flexDirection="col" overflow="hidden">
|
||||
<ContentViewport>
|
||||
<ContentViewport fullWidth={!showSidebar}>
|
||||
{children}
|
||||
</ContentViewport>
|
||||
<GlobalFooterTemplate />
|
||||
|
||||
Reference in New Issue
Block a user