2024-07-24 12:35:33 +02:00
|
|
|
import "@repo/config-tailwind/styles.css"
|
|
|
|
import type { Locale, LocaleProps } from "@repo/i18n/config"
|
|
|
|
import { LOCALES } from "@repo/i18n/config"
|
2024-07-31 15:46:01 +02:00
|
|
|
import { Footer } from "@repo/ui/Layout/Footer"
|
|
|
|
import { Header } from "@repo/ui/Layout/Header"
|
|
|
|
import { ThemeProvider } from "@repo/ui/Layout/Header/SwitchTheme"
|
|
|
|
import { VERSION } from "@repo/utils/constants"
|
2024-07-24 12:35:33 +02:00
|
|
|
import type { Metadata } from "next"
|
|
|
|
import { NextIntlClientProvider } from "next-intl"
|
|
|
|
import {
|
|
|
|
getMessages,
|
|
|
|
getTranslations,
|
|
|
|
unstable_setRequestLocale,
|
|
|
|
} from "next-intl/server"
|
|
|
|
|
|
|
|
export const generateMetadata = async ({
|
|
|
|
params,
|
|
|
|
}: LocaleProps): Promise<Metadata> => {
|
|
|
|
const t = await getTranslations({ locale: params.locale })
|
2024-07-31 15:46:01 +02:00
|
|
|
const title = t("meta.title")
|
|
|
|
const description = t("meta.description")
|
|
|
|
const image = "/images/Wikipedia-Logo.webp"
|
|
|
|
const url = new URL("https://wikipedia-game-solver.theoludwig.fr")
|
|
|
|
const locale = LOCALES.join(", ")
|
|
|
|
|
2024-07-24 12:35:33 +02:00
|
|
|
return {
|
2024-07-31 15:46:01 +02:00
|
|
|
title,
|
|
|
|
description,
|
|
|
|
metadataBase: url,
|
|
|
|
openGraph: {
|
|
|
|
title,
|
|
|
|
description,
|
|
|
|
url,
|
|
|
|
siteName: title,
|
|
|
|
images: [
|
|
|
|
{
|
|
|
|
url: image,
|
|
|
|
width: 96,
|
|
|
|
height: 96,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
locale,
|
|
|
|
type: "website",
|
|
|
|
},
|
|
|
|
twitter: {
|
|
|
|
card: "summary",
|
|
|
|
title,
|
|
|
|
description,
|
|
|
|
images: [image],
|
|
|
|
},
|
2024-07-24 12:35:33 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export const generateStaticParams = (): Array<{ locale: Locale }> => {
|
|
|
|
return LOCALES.map((locale) => {
|
|
|
|
return {
|
|
|
|
locale,
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2024-08-02 00:50:10 +02:00
|
|
|
interface LocaleLayoutProps extends React.PropsWithChildren, LocaleProps {}
|
2024-07-24 12:35:33 +02:00
|
|
|
|
|
|
|
const LocaleLayout: React.FC<LocaleLayoutProps> = async (props) => {
|
|
|
|
const { children, params } = props
|
|
|
|
|
|
|
|
// Enable static rendering
|
|
|
|
unstable_setRequestLocale(params.locale)
|
|
|
|
|
|
|
|
const messages = await getMessages()
|
|
|
|
|
|
|
|
return (
|
|
|
|
<html lang={params.locale} suppressHydrationWarning>
|
|
|
|
<body>
|
|
|
|
<ThemeProvider>
|
|
|
|
<NextIntlClientProvider messages={messages}>
|
|
|
|
<Header />
|
|
|
|
{children}
|
|
|
|
<Footer version={VERSION} />
|
|
|
|
</NextIntlClientProvider>
|
|
|
|
</ThemeProvider>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default LocaleLayout
|