Create toast provider
This commit is contained in:
@@ -4,6 +4,7 @@ import { Providers } from './providers';
|
||||
import Header from './Header';
|
||||
import clsx from 'clsx';
|
||||
import { getTranslations } from 'next-intl/server';
|
||||
import { useTranslations } from 'next-intl';
|
||||
|
||||
export async function generateMetadata({ params: { locale } }) {
|
||||
const t = await getTranslations({ locale, namespace: 'Header' });
|
||||
@@ -25,11 +26,20 @@ export default function RootLayout({
|
||||
children: React.ReactNode;
|
||||
params: { locale: string };
|
||||
}) {
|
||||
const t = useTranslations('Toast');
|
||||
const toastMessages = {
|
||||
needSignedIn: t('need_signed_in'),
|
||||
sessionExpired: t('session_expired'),
|
||||
};
|
||||
|
||||
return (
|
||||
<html lang={locale} suppressHydrationWarning>
|
||||
<head />
|
||||
<body className={clsx('min-h-[calc(100vh-64px)] bg-background font-sans antialiased', fontSans.variable)}>
|
||||
<Providers themeProps={{ attribute: 'class', defaultTheme: 'light' }} tokenProps={{ locale: locale }}>
|
||||
<Providers
|
||||
themeProps={{ attribute: 'class', defaultTheme: 'light' }}
|
||||
tokenProps={{ toastMessages: toastMessages, locale: locale }}
|
||||
>
|
||||
<div className="relative flex flex-col min-h-screen light:bg-neutral-50 dark:bg-neutral-800">
|
||||
<Header locale={locale} />
|
||||
<main>{children}</main>
|
||||
|
||||
Reference in New Issue
Block a user