MotorSignal-App/website/components/site-page-frame.tsx

23 lines
801 B
TypeScript

'use client';
import React from 'react';
import { usePathname } from 'next/navigation';
/**
* SitePageFrame wraps page content.
* For portal and operations routes that manage their own internal <main> landmark,
* it renders a non-semantic <div> to avoid invalid nested <main> elements.
* For standard public and content routes, it renders a semantic <main> landmark
* to ensure assistive technologies can identify the primary content.
*/
export function SitePageFrame({ children }: { children: React.ReactNode }) {
const pathname = usePathname();
const isPortalRoute = pathname?.includes('/manage') || pathname?.startsWith('/admin');
if (isPortalRoute) {
return <div className="site-page-frame">{children}</div>;
}
return <main className="site-page-frame">{children}</main>;
}