2024-07-24 12:35:33 +02:00
|
|
|
import type { LocaleProps } from "@repo/i18n/config"
|
2024-07-31 15:46:01 +02:00
|
|
|
import { Link } from "@repo/ui/Design/Link"
|
|
|
|
import { Typography } from "@repo/ui/Design/Typography"
|
|
|
|
import { MainLayout } from "@repo/ui/Layout/MainLayout"
|
2024-08-16 02:50:11 +02:00
|
|
|
import { fromLocaleToWikipediaLocale, getWikipediaLink } from "@repo/wikipedia"
|
2024-07-24 12:35:33 +02:00
|
|
|
import { WikipediaClient } from "@repo/wikipedia-game-solver/WikipediaClient"
|
|
|
|
import { useTranslations } from "next-intl"
|
|
|
|
import { unstable_setRequestLocale } from "next-intl/server"
|
|
|
|
import Image from "next/image"
|
|
|
|
|
2024-07-31 15:46:01 +02:00
|
|
|
import WikipediaLogo from "#public/images/Wikipedia-Logo.webp"
|
2024-07-31 16:07:10 +02:00
|
|
|
import { Section } from "@repo/ui/Layout/Section"
|
2024-07-24 12:35:33 +02:00
|
|
|
|
|
|
|
interface HomePageProps extends LocaleProps {}
|
|
|
|
|
|
|
|
const HomePage: React.FC<HomePageProps> = (props) => {
|
|
|
|
const { params } = props
|
|
|
|
|
|
|
|
// Enable static rendering
|
|
|
|
unstable_setRequestLocale(params.locale)
|
|
|
|
|
|
|
|
const t = useTranslations()
|
|
|
|
|
2024-07-31 15:46:01 +02:00
|
|
|
const localeWikipedia = fromLocaleToWikipediaLocale(params.locale)
|
|
|
|
|
2024-07-24 12:35:33 +02:00
|
|
|
return (
|
2024-07-31 16:07:10 +02:00
|
|
|
<MainLayout center>
|
|
|
|
<Section horizontalSpacing>
|
2024-07-24 12:35:33 +02:00
|
|
|
<Typography as="h1" variant="h1">
|
|
|
|
{t("home.title")}
|
|
|
|
</Typography>
|
|
|
|
|
|
|
|
<Typography as="p" variant="text1" className="mt-3">
|
|
|
|
{t.rich("home.description", {
|
2024-07-31 15:46:01 +02:00
|
|
|
"wikipedia-link": (children) => {
|
2024-07-24 12:35:33 +02:00
|
|
|
return (
|
2024-07-31 15:46:01 +02:00
|
|
|
<Link href={getWikipediaLink(localeWikipedia)} target="_blank">
|
2024-07-24 12:35:33 +02:00
|
|
|
{children}
|
|
|
|
</Link>
|
|
|
|
)
|
|
|
|
},
|
|
|
|
})}
|
|
|
|
</Typography>
|
2024-07-31 16:07:10 +02:00
|
|
|
</Section>
|
2024-07-24 12:35:33 +02:00
|
|
|
|
|
|
|
<section className="my-6 flex items-center justify-center">
|
|
|
|
<Image src={WikipediaLogo} alt="Wikipedia" className="w-72" />
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<WikipediaClient />
|
|
|
|
</MainLayout>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default HomePage
|