2025-09-21 12:03:29 +01:00
|
|
|
import { Toaster } from 'sonner';
|
|
|
|
|
import type { Metadata } from 'next';
|
|
|
|
|
import { Geist, Geist_Mono } from 'next/font/google';
|
|
|
|
|
import { ThemeProvider } from '@/components/theme-provider';
|
2023-05-19 12:33:56 -04:00
|
|
|
|
2025-09-21 12:03:29 +01:00
|
|
|
import './globals.css';
|
|
|
|
|
import { SessionProvider } from 'next-auth/react';
|
2023-11-26 12:32:01 -06:00
|
|
|
|
2024-10-11 18:00:22 +05:30
|
|
|
export const metadata: Metadata = {
|
2025-09-21 12:03:29 +01:00
|
|
|
metadataBase: new URL('https://chat.vercel.ai'),
|
|
|
|
|
title: 'Next.js Chatbot Template',
|
|
|
|
|
description: 'Next.js chatbot template using the AI SDK.',
|
2024-10-11 18:00:22 +05:30
|
|
|
};
|
2023-05-19 12:33:56 -04:00
|
|
|
|
2024-10-23 12:21:30 -04:00
|
|
|
export const viewport = {
|
|
|
|
|
maximumScale: 1, // Disable auto-zoom on mobile Safari
|
|
|
|
|
};
|
|
|
|
|
|
2025-03-18 13:57:06 -07:00
|
|
|
const geist = Geist({
|
2025-09-21 12:03:29 +01:00
|
|
|
subsets: ['latin'],
|
|
|
|
|
display: 'swap',
|
|
|
|
|
variable: '--font-geist',
|
2025-03-18 13:57:06 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const geistMono = Geist_Mono({
|
2025-09-21 12:03:29 +01:00
|
|
|
subsets: ['latin'],
|
|
|
|
|
display: 'swap',
|
|
|
|
|
variable: '--font-geist-mono',
|
2025-03-18 13:57:06 -07:00
|
|
|
});
|
|
|
|
|
|
2025-09-21 12:03:29 +01:00
|
|
|
const LIGHT_THEME_COLOR = 'hsl(0 0% 100%)';
|
|
|
|
|
const DARK_THEME_COLOR = 'hsl(240deg 10% 3.92%)';
|
2024-10-23 12:21:30 -04:00
|
|
|
const THEME_COLOR_SCRIPT = `\
|
|
|
|
|
(function() {
|
|
|
|
|
var html = document.documentElement;
|
|
|
|
|
var meta = document.querySelector('meta[name="theme-color"]');
|
|
|
|
|
if (!meta) {
|
|
|
|
|
meta = document.createElement('meta');
|
|
|
|
|
meta.setAttribute('name', 'theme-color');
|
|
|
|
|
document.head.appendChild(meta);
|
|
|
|
|
}
|
|
|
|
|
function updateThemeColor() {
|
|
|
|
|
var isDark = html.classList.contains('dark');
|
|
|
|
|
meta.setAttribute('content', isDark ? '${DARK_THEME_COLOR}' : '${LIGHT_THEME_COLOR}');
|
|
|
|
|
}
|
|
|
|
|
var observer = new MutationObserver(updateThemeColor);
|
|
|
|
|
observer.observe(html, { attributes: true, attributeFilter: ['class'] });
|
|
|
|
|
updateThemeColor();
|
|
|
|
|
})();`;
|
|
|
|
|
|
2025-09-21 12:03:29 +01:00
|
|
|
export default async function RootLayout({
|
2024-10-11 18:00:22 +05:30
|
|
|
children,
|
|
|
|
|
}: Readonly<{
|
|
|
|
|
children: React.ReactNode;
|
|
|
|
|
}>) {
|
2023-05-19 12:33:56 -04:00
|
|
|
return (
|
2024-10-23 12:21:30 -04:00
|
|
|
<html
|
2025-09-21 12:03:29 +01:00
|
|
|
lang="en"
|
2024-10-23 12:21:30 -04:00
|
|
|
// `next-themes` injects an extra classname to the body element to avoid
|
|
|
|
|
// visual flicker before hydration. Hence the `suppressHydrationWarning`
|
|
|
|
|
// prop is necessary to avoid the React hydration mismatch warning.
|
|
|
|
|
// https://github.com/pacocoursey/next-themes?tab=readme-ov-file#with-app
|
|
|
|
|
suppressHydrationWarning
|
2025-09-21 12:03:29 +01:00
|
|
|
className={`${geist.variable} ${geistMono.variable}`}
|
2024-10-23 12:21:30 -04:00
|
|
|
>
|
|
|
|
|
<head>
|
|
|
|
|
<script
|
|
|
|
|
dangerouslySetInnerHTML={{
|
|
|
|
|
__html: THEME_COLOR_SCRIPT,
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</head>
|
2025-03-18 13:57:06 -07:00
|
|
|
<body className="antialiased">
|
2024-10-11 18:00:22 +05:30
|
|
|
<ThemeProvider
|
2023-12-04 12:42:53 -05:00
|
|
|
attribute="class"
|
|
|
|
|
defaultTheme="system"
|
2025-09-20 12:47:10 -07:00
|
|
|
enableSystem
|
2025-09-21 12:03:29 +01:00
|
|
|
disableTransitionOnChange
|
2023-12-04 12:42:53 -05:00
|
|
|
>
|
2024-10-11 18:00:22 +05:30
|
|
|
<Toaster position="top-center" />
|
2025-04-25 23:40:15 -07:00
|
|
|
<SessionProvider>{children}</SessionProvider>
|
2024-10-11 18:00:22 +05:30
|
|
|
</ThemeProvider>
|
2023-06-16 11:49:14 -04:00
|
|
|
</body>
|
|
|
|
|
</html>
|
2024-10-11 18:00:22 +05:30
|
|
|
);
|
2023-05-19 12:33:56 -04:00
|
|
|
}
|