All checks were successful
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
68 lines
3.3 KiB
TypeScript
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} />
|
|
</>
|
|
)
|
|
}
|