Mounts a dev-only client component that syncs the react-grab debug toolbar's pinned edge / collapsed state across viewport changes (so the toolbar doesn't drift off-screen when resizing or rotating). Render is gated by NODE_ENV === 'development' in src/app/layout.tsx; production builds tree-shake the import out via process.env replacement. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
75 lines
2.0 KiB
TypeScript
75 lines
2.0 KiB
TypeScript
import type { Metadata, Viewport } from 'next';
|
|
import Script from 'next/script';
|
|
import { headers } from 'next/headers';
|
|
import { Inter, JetBrains_Mono } from 'next/font/google';
|
|
import { Toaster } from 'sonner';
|
|
import { classifyFormFactor } from '@/lib/form-factor';
|
|
import { ReactGrabViewportSync } from '@/components/dev/react-grab-viewport-sync';
|
|
import './globals.css';
|
|
|
|
const inter = Inter({
|
|
subsets: ['latin'],
|
|
variable: '--font-sans',
|
|
display: 'swap',
|
|
});
|
|
|
|
const jetbrainsMono = JetBrains_Mono({
|
|
subsets: ['latin'],
|
|
variable: '--font-mono',
|
|
display: 'swap',
|
|
});
|
|
|
|
export const viewport: Viewport = {
|
|
width: 'device-width',
|
|
initialScale: 1,
|
|
viewportFit: 'cover',
|
|
themeColor: '#1e2844',
|
|
};
|
|
|
|
export const metadata: Metadata = {
|
|
title: {
|
|
default: 'Port Nimara CRM',
|
|
template: '%s | Port Nimara CRM',
|
|
},
|
|
description: 'Marina management system for Port Nimara',
|
|
appleWebApp: {
|
|
capable: true,
|
|
statusBarStyle: 'black-translucent',
|
|
title: 'Port Nimara',
|
|
},
|
|
icons: {
|
|
icon: [
|
|
{ url: '/icon-192.png', sizes: '192x192', type: 'image/png' },
|
|
{ url: '/icon-512.png', sizes: '512x512', type: 'image/png' },
|
|
],
|
|
apple: '/apple-touch-icon.png',
|
|
},
|
|
};
|
|
|
|
export default async function RootLayout({ children }: { children: React.ReactNode }) {
|
|
const headerList = await headers();
|
|
const formFactor = classifyFormFactor(headerList.get('user-agent'));
|
|
|
|
return (
|
|
<html lang="en" suppressHydrationWarning>
|
|
<head>
|
|
{process.env.NODE_ENV === 'development' && (
|
|
<Script
|
|
src="//unpkg.com/react-grab/dist/index.global.js"
|
|
crossOrigin="anonymous"
|
|
strategy="beforeInteractive"
|
|
/>
|
|
)}
|
|
</head>
|
|
<body
|
|
data-form-factor={formFactor}
|
|
className={`${inter.variable} ${jetbrainsMono.variable} font-sans antialiased`}
|
|
>
|
|
{children}
|
|
<Toaster richColors position="top-right" />
|
|
{process.env.NODE_ENV === 'development' && <ReactGrabViewportSync />}
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|