All checks were successful
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
49 lines
3.5 KiB
TypeScript
49 lines
3.5 KiB
TypeScript
import { notFound } from 'next/navigation'
|
|
import { getDict, isLocale, locales } from '@/i18n'
|
|
import { loadAbout, loadContent, loadFoundation, loadLegal } from '@/lib/content'
|
|
import { mediaOf, paragraphs } from '@/lib/site-model'
|
|
import { buildHomeModel } from '@/lib/home-model'
|
|
import { SectionPage } from '@/components/SectionPage'
|
|
import { aboutPeople } from '@/lib/about-model'
|
|
import { buildFoundationPeople } from '@/lib/foundation-people'
|
|
|
|
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.sections.about} — ${t.siteName}`, description: t.metaDescription, alternates: { languages: Object.fromEntries(locales.map(l => [l, `/${l}/about`])) } }
|
|
}
|
|
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)
|
|
const data = aboutPeople[locale]
|
|
const people = buildFoundationPeople(await loadFoundation())
|
|
const about = await loadAbout(locale)
|
|
const aboutText = paragraphs(about?.text)
|
|
const aboutPhoto = mediaOf(about?.photo)
|
|
return <SectionPage legal={await loadLegal(locale)} t={t} locale={locale} path="/about" title={t.sections.about} showNews={m.news.length > 0}>
|
|
{aboutText.length > 0 && <section className="mb-12 max-w-3xl">
|
|
{/* eslint-disable-next-line @next/next/no-img-element -- загруженные сотрудниками фото отдаёт Payload */}
|
|
{aboutPhoto && <img src={aboutPhoto.url} alt={aboutPhoto.alt} className="mb-6 h-auto w-full" />}
|
|
{aboutText.map((text) => <p key={text} className="mt-4 text-lg leading-relaxed">{text}</p>)}
|
|
</section>}
|
|
<section><h2 className="font-serif text-2xl">{t.mission.title}</h2><p className="mt-4 max-w-3xl text-lg">{m.mission.text}</p></section>
|
|
<section className="mt-12"><h2 className="font-serif text-2xl">{t.sections.goals}</h2><p className="mt-4 max-w-3xl">{t.sections.goalText}</p></section>
|
|
<section id="directions" className="mt-12 scroll-mt-8"><h2 className="font-serif text-2xl">{t.directions.title}</h2>
|
|
<ul className="mt-6 grid gap-6 sm:grid-cols-2">{m.directions.map(d => <li key={d.title} className="border border-line p-6"><h3 className="font-serif text-xl">{d.title}</h3><p className="mt-3">{d.text}</p></li>)}</ul>
|
|
</section>
|
|
<div className="mt-12 grid gap-8 sm:grid-cols-3">
|
|
<section id="founder"><h2 className="mb-4 font-serif text-2xl">{t.sections.founder}</h2><p>{people.founder}</p></section>
|
|
<section id="leadership"><h2 className="mb-4 font-serif text-2xl">{t.sections.leadership}</h2><p className="text-sm text-graphite">{t.sections.director}</p><p>{people.director}</p></section>
|
|
<section id="board"><h2 className="mb-4 font-serif text-2xl">{t.sections.board}</h2>
|
|
<ul className="space-y-3">{people.board.map(b => <li key={b.name}><p className="text-sm text-graphite">{b.role === 'chair' ? t.sections.chair : t.sections.boardMember}</p><p>{b.name}</p></li>)}</ul>
|
|
</section>
|
|
</div>
|
|
{data.partners.length > 0 && <section className="mt-12"><h2 className="font-serif text-2xl">{t.sections.partners}</h2><ul className="mt-4 space-y-2">{data.partners.map(p => <li key={p.name}>{p.url ? <a className="underline" href={p.url}>{p.name}</a> : p.name}</li>)}</ul></section>}
|
|
</SectionPage>
|
|
}
|