qazaq-legacy-foundation-web/src/app/(site)/[locale]/page.tsx

134 lines
6.6 KiB
TypeScript

import { notFound } from 'next/navigation'
import { Footer } from '@/components/Footer'
import { Header } from '@/components/Header'
import { PrivacyNote } from '@/components/PrivacyNote'
import { Tbc } from '@/components/Tbc'
import { getDict, isLocale } from '@/i18n'
import { loadContent } from '@/lib/content'
import { buildHomeModel, bookUrl, type Card } from '@/lib/home-model'
export const dynamic = 'force-dynamic'
function Cards({ items, tbc }: { items: Card[]; tbc: string }) {
return (
<ul className="grid gap-px border border-line bg-line sm:grid-cols-2 lg:grid-cols-3">
{items.map((c) => (
<li key={c.title} className="bg-paper p-7 sm:p-9">
<h3 className="font-serif text-2xl leading-snug">{c.title}</h3>
<p className="mt-4 text-muted">{c.tbc ? <Tbc label={tbc} /> : c.text}</p>
</li>
))}
</ul>
)
}
const Section = ({ id, title, children }: { id: string; title: string; children: React.ReactNode }) => (
<section id={id} className="mx-auto max-w-6xl scroll-mt-8 px-5 py-20 sm:px-8 md:py-28">
<h2 className="reveal mb-10 font-serif text-3xl text-burgundy sm:text-4xl">{title}</h2>
{children}
</section>
)
export default async function Home({ 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)
const fmt = new Intl.DateTimeFormat(locale, { day: 'numeric', month: 'long', year: 'numeric' })
return (
<>
<Header t={t} locale={locale} showProjects={true} showNews={m.news.length > 0} />
<main>
<section className="relative flex min-h-[88svh] items-center overflow-hidden border-b border-line"
style={{ background: 'radial-gradient(ellipse at 85% 10%, rgba(122,31,43,0.16), transparent 55%), linear-gradient(180deg, #f7f5f2, #efebe6)' }}>
<svg aria-hidden viewBox="0 0 200 200" fill="none" stroke="#7a1f2b"
className="pointer-events-none absolute -right-24 top-1/2 hidden h-[42rem] w-[42rem] -translate-y-1/2 opacity-[0.14] sm:block">
{[96, 80, 64, 48, 32, 16].map((r) => <circle key={r} cx="100" cy="100" r={r} strokeWidth="0.8" />)}
{Array.from({ length: 12 }, (_, i) => (
<path key={i} d="M100 4 C112 36 112 64 100 100 C88 64 88 36 100 4Z" strokeWidth="0.8" transform={`rotate(${i * 30} 100 100)`} />
))}
</svg>
<div className="relative mx-auto w-full max-w-6xl px-5 pb-16 pt-36 sm:px-8 md:pb-24">
<div className="reveal mb-8 h-1 w-20 bg-burgundy" aria-hidden />
<h1 className="reveal max-w-5xl font-serif text-[clamp(2.4rem,8vw,6.5rem)] font-semibold leading-[1.05] tracking-tight text-graphite">{t.motto}</h1>
<p className="reveal reveal-2 mt-8 max-w-2xl text-lg leading-relaxed text-graphite sm:text-xl">{t.heroLead}</p>
<a href="#directions" className="reveal reveal-3 mt-10 inline-block bg-burgundy px-8 py-3 text-paper transition hover:bg-graphite">
{t.nav.directions}
</a>
</div>
</section>
<Section id="mission" title={t.mission.title}>
<p className="max-w-3xl font-serif text-2xl leading-relaxed sm:text-3xl">{m.mission.text}</p>
{m.mission.tbc && <p className="mt-6"><Tbc label={t.tbc} note={t.mission.missing} /></p>}
</Section>
<Section id="directions" title={t.directions.title}>
<Cards items={m.directions} tbc={t.tbc} />
</Section>
<Section id="projects" title={t.projects.title}>
<article className="grid gap-8 border border-line p-6 sm:p-10 md:grid-cols-[1fr_2fr]">
<div className="space-y-5">
<div className="flex aspect-[3/4] items-center justify-center border border-dashed border-line p-5">
<Tbc label={t.tbc} note={t.book.cover} />
</div>
<p><Tbc label={t.tbc} note={t.book.photo} /></p>
</div>
<div className="min-w-0">
<p className="mb-3 text-muted">{t.book.author}</p>
<h3 className="font-serif text-2xl leading-snug sm:text-3xl">{t.book.title}</h3>
{t.book.paragraphs.map((text) => <p key={text} className="mt-5 text-muted">{text}</p>)}
<p className="mt-6"><Tbc label={t.tbc} note={t.book.role} /></p>
<a href={bookUrl} className="mt-8 inline-block bg-burgundy px-7 py-3 text-paper transition hover:bg-graphite">{t.book.get}</a>
</div>
</article>
{m.projects.length > 0 && <div className="mt-8"><Cards items={m.projects} tbc={t.tbc} /></div>}
</Section>
{m.news.length > 0 && (
<Section id="news" title={t.news.title}>
<ul className="divide-y divide-line border-y border-line">
{m.news.map((n) => (
<li key={n.id} className="grid gap-2 py-7 md:grid-cols-[14rem_1fr] md:gap-10">
<div className="text-sm text-muted">
<time dateTime={n.date}>{fmt.format(new Date(n.date))}</time>
<div className="mt-1 text-burgundy">{n.kind === 'event' ? t.news.event : t.news.news}</div>
</div>
<div>
<h3 className="font-serif text-2xl">{n.title}</h3>
{n.summary && <p className="mt-2 text-muted">{n.summary}</p>}
{n.place && <p className="mt-2 text-sm text-muted">{n.place}</p>}
</div>
</li>
))}
</ul>
</Section>
)}
<section id="collaboration" className="bg-graphite text-paper">
<div className="mx-auto max-w-6xl px-5 py-20 sm:px-8 md:py-28">
<h2 className="font-serif text-3xl sm:text-5xl">{t.collaboration.title}</h2>
<p className="mt-8 max-w-2xl text-lg text-paper/75">{m.collaboration.text}</p>
<p className="mt-10">
{m.collaboration.email ? (
<a href={`mailto:${m.collaboration.email}`} className="inline-block max-w-full break-all border border-paper/60 px-5 py-3 transition hover:bg-paper hover:text-graphite">
{m.collaboration.email}
</a>
) : (
<span className="inline-block rounded-sm border border-dashed border-paper/50 px-2 py-0.5 text-sm text-paper/80">
{t.tbc}: {t.collaboration.contactMissing}
</span>
)}
</p>
<PrivacyNote t={t} locale={locale} className="mt-6 text-paper/70" />
</div>
</section>
</main>
<Footer t={t} locale={locale} />
</>
)
}