- Added Sentry integration for error tracking across various components, including error boundaries and user actions. - Updated global error handling to capture exceptions and provide detailed feedback to users. - Enhanced user notifications with toast messages for actions such as credit management, image generation, and canvas exports. - Improved user experience by displaying relevant messages during interactions, ensuring better visibility of system states and errors.
49 lines
1.2 KiB
TypeScript
49 lines
1.2 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";
|
|
|
|
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 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="de"
|
|
suppressHydrationWarning
|
|
className={cn("h-full", "antialiased", "font-sans", manrope.variable)}
|
|
>
|
|
<body className="min-h-full flex flex-col">
|
|
<Providers initialToken={initialToken}>
|
|
<InitUser />
|
|
{children}
|
|
</Providers>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|