qazaq-legacy-foundation-web/src/app/(site)/[locale]/contacts/page.tsx
Peppa 1a58c2a4d9
All checks were successful
peppa/lint lint: success за 1с
peppa/typecheck typecheck: success за 2с
peppa/test test: success за 1с
peppa/build build: success за 41с
ci / checks (pull_request) Successful in 1m22s
deploy / deploy (pull_request) Successful in 17s
QLFW-6: панель управления: проекты, фото, контакты и текст «О фонде»
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 23:33:54 +05:00

68 lines
3.3 KiB
TypeScript

import type { Metadata } from 'next'
import Link from 'next/link'
import { notFound } from 'next/navigation'
import { ContactForm } from '@/components/ContactForm'
import { Footer } from '@/components/Footer'
import { Header } from '@/components/Header'
import { getDict, isLocale, locales } from '@/i18n'
import { loadContent, loadLegal, loadSettings } from '@/lib/content'
import { isLegalPublished } from '@/lib/legal-model'
import { emailLinkHtml } from '@/lib/home-model'
import { buildContacts } from '@/lib/site-model'
import { FALLBACK_EMAIL } from '@/lib/inquiry'
export const dynamic = 'force-dynamic'
type Props = { params: Promise<{ locale: string }> }
export async function generateMetadata({ params }: Props): Promise<Metadata> {
const { locale } = await params
if (!isLocale(locale)) return {}
const t = getDict(locale)
const title = `${t.contacts.title} — ${t.siteName}`
return {
title,
description: t.contacts.description,
alternates: { languages: Object.fromEntries(locales.map((l) => [l, `/${l}/contacts`])) },
openGraph: { title, description: t.contacts.description, type: 'website', locale },
}
}
export default async function ContactsPage({ params }: Props) {
const { locale } = await params
if (!isLocale(locale)) notFound()
const t = getDict(locale)
const { home, news } = await loadContent(locale)
const legal = await loadLegal(locale)
const c = buildContacts(await loadSettings(locale), home?.contactEmail)
const email = c.email || FALLBACK_EMAIL
return (
<>
<Header t={t} locale={locale} showProjects showNews={news.length > 0} path="/contacts" />
<main className="mx-auto max-w-3xl px-5 pb-24 pt-40 sm:px-8">
<Link href={`/${locale}`} className="text-sm text-muted hover:text-burgundy">← {t.legal.back}</Link>
<h1 className="mt-6 font-serif text-4xl leading-tight text-burgundy sm:text-5xl">{t.contacts.title}</h1>
<div className="mt-10 h-px w-24 bg-burgundy" aria-hidden />
<p className="mt-10 max-w-2xl text-lg text-muted">{t.contacts.lead}</p>
<p className="mt-4">
{t.contacts.emailLabel}: <span dangerouslySetInnerHTML={{ __html: emailLinkHtml(email, 'text-burgundy underline underline-offset-4 hover:no-underline') }} />
</p>
{c.phone && <p className="mt-2">{t.contacts.phoneLabel}: <a href={`tel:${c.phone.replace(/[^+\d]/g, '')}`} className="text-burgundy underline underline-offset-4 hover:no-underline">{c.phone}</a></p>}
{c.address && <p className="mt-2">{t.contacts.addressLabel}: {c.address}</p>}
{c.socials.length > 0 && (
<p className="mt-2">{t.contacts.socialsLabel}:{' '}
{c.socials.map((s, i) => <span key={s.url}>{i > 0 && ', '}<a href={s.url} rel="noopener" className="text-burgundy underline underline-offset-4 hover:no-underline">{s.label}</a></span>)}
</p>
)}
<p className="mt-2">
<a href="https://www.instagram.com/serkebayev_book/" className="text-burgundy underline underline-offset-4 hover:no-underline">{t.collaboration.instagram}</a>
</p>
<div className="mt-10">
<ContactForm t={t} locale={locale} email={email} privacyLink={isLegalPublished(legal?.privacy)} />
</div>
</main>
<Footer t={t} locale={locale} legal={legal} />
</>
)
}