29 lines
1.8 KiB
TypeScript
29 lines
1.8 KiB
TypeScript
import { notFound } from 'next/navigation'
|
|
import { getDict, isLocale, locales } from '@/i18n'
|
|
import { loadContent, loadLegal } from '@/lib/content'
|
|
import { buildHomeModel } from '@/lib/home-model'
|
|
import { SectionPage } from '@/components/SectionPage'
|
|
import Image from 'next/image'
|
|
import Link from 'next/link'
|
|
|
|
export const dynamic = 'force-dynamic'
|
|
export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }) {
|
|
const { locale } = await params
|
|
if (!isLocale(locale)) notFound()
|
|
const t = getDict(locale)
|
|
return { title: `${t.projects.title} — ${t.siteName}`, description: t.metaDescription, alternates: { languages: Object.fromEntries(locales.map(l => [l, `/${l}/projects`])) } }
|
|
}
|
|
export default async function Page({ params }: { params: Promise<{ locale: string }> }) {
|
|
const { locale } = await params
|
|
if (!isLocale(locale)) notFound()
|
|
const t = getDict(locale)
|
|
const { home, news } = await loadContent(locale)
|
|
const m = buildHomeModel(home, news, t)
|
|
return <SectionPage legal={await loadLegal(locale)} t={t} locale={locale} path="/projects" title={t.projects.title} showNews={m.news.length > 0}>
|
|
<article className="grid gap-8 border border-line p-6 sm:p-10 md:grid-cols-[1fr_2fr]">
|
|
<Link href={`/${locale}/projects/ermek-serkebayev`}><Image src="/books/serkebayev/cover.jpg" alt={t.book.cover} width={677} height={1000} sizes="(min-width: 768px) 320px, 100vw" className="mx-auto h-auto w-full max-w-sm" /></Link>
|
|
<div className="min-w-0"><p>{t.book.author}</p><h2 className="mt-3 font-serif text-2xl sm:text-3xl">{t.book.title}</h2>{t.book.paragraphs.map(text => <p key={text} className="mt-5">{text}</p>)}<Link href={`/${locale}/projects/ermek-serkebayev`} className="mt-6 inline-flex min-h-11 items-center underline underline-offset-4">{t.projects.more}</Link></div>
|
|
</article>
|
|
</SectionPage>
|
|
}
|