Files
lemonspace_app/app/layout.tsx
Matthias Meister 75e5535a86 Enhance Providers component with time zone support
- Updated `RootLayout` to retrieve the user's time zone using `getTimeZone` from `next-intl/server`.
- Modified the `Providers` component to accept and pass the time zone prop to `NextIntlClientProvider`, improving localization capabilities.
2026-04-01 18:21:16 +02:00

76 lines
2.3 KiB
TypeScript

import type { Metadata } from "next";
import { Manrope } from "next/font/google";
import * as Sentry from "@sentry/nextjs";
import "./globals.css";
import { cn } from "@/lib/utils";
import { Providers } from "@/components/providers";
import { InitUser } from "@/components/init-user";
import { getAuthUser, getToken } from "@/lib/auth-server";
import { getLocale, getMessages, getTimeZone } from "next-intl/server";
const manrope = Manrope({ subsets: ["latin"], variable: "--font-sans" });
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
export default async function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
const initialToken = await getToken();
const locale = await getLocale();
const messages = await getMessages();
const timeZone = await getTimeZone();
const user = await getAuthUser();
if (user) {
const id = user.userId ?? String(user._id);
Sentry.setUser({
id,
email: user.email ?? undefined,
});
} else {
Sentry.setUser(null);
}
return (
<html
lang={locale}
suppressHydrationWarning
className={cn("h-full", "antialiased", "font-sans", manrope.variable)}
>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="description"
content="Lemonspace is a platform for creating and sharing digital content with nodes."
/>
<meta name="keywords" content="Lemonspace, digital content, platform" />
<meta name="author" content="Lemonspace" />
<meta name="robots" content="index, follow" />
<meta name="googlebot" content="index, follow" />
<meta name="bingbot" content="index, follow" />
<meta name="yandexbot" content="index, follow" />
<script
src="https://rybbit.matthias.lol/api/script.js"
data-site-id="bb1ac546eda7"
defer
></script>
</head>
<body className="min-h-full flex flex-col">
<Providers
initialToken={initialToken}
locale={locale}
messages={messages}
timeZone={timeZone}
>
<InitUser />
{children}
</Providers>
</body>
</html>
);
}