QLFW-18: ссылка на политику в согласии у форм только при полном тексте
All checks were successful
All checks were successful
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8cee95c6f5
commit
3f0ba34d85
@ -5,7 +5,8 @@ import { ContactForm } from '@/components/ContactForm'
|
||||
import { Footer } from '@/components/Footer'
|
||||
import { Header } from '@/components/Header'
|
||||
import { getDict, isLocale, locales } from '@/i18n'
|
||||
import { loadContent } from '@/lib/content'
|
||||
import { loadContent, loadLegal } from '@/lib/content'
|
||||
import { isLegalPublished } from '@/lib/legal-model'
|
||||
import { FALLBACK_EMAIL } from '@/lib/inquiry'
|
||||
|
||||
export const dynamic = 'force-dynamic'
|
||||
@ -30,6 +31,7 @@ export default async function ContactsPage({ params }: Props) {
|
||||
if (!isLocale(locale)) notFound()
|
||||
const t = getDict(locale)
|
||||
const { home } = await loadContent(locale)
|
||||
const legal = await loadLegal(locale)
|
||||
const email = home?.contactEmail?.trim() || FALLBACK_EMAIL
|
||||
return (
|
||||
<>
|
||||
@ -43,10 +45,10 @@ export default async function ContactsPage({ params }: Props) {
|
||||
{t.contacts.emailLabel}: <a href={`mailto:${email}`} className="text-burgundy underline underline-offset-4 hover:no-underline">{email}</a>
|
||||
</p>
|
||||
<div className="mt-10">
|
||||
<ContactForm t={t} locale={locale} email={email} />
|
||||
<ContactForm t={t} locale={locale} email={email} privacyLink={isLegalPublished(legal?.privacy)} />
|
||||
</div>
|
||||
</main>
|
||||
<Footer t={t} locale={locale} />
|
||||
<Footer t={t} locale={locale} legal={legal} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { isLegalPublished } from '@/lib/legal-model'
|
||||
import { loadLegal } from '@/lib/content'
|
||||
import { isLegalPublished } from '@/lib/legal-model'
|
||||
import Image from 'next/image'
|
||||
import { notFound } from 'next/navigation'
|
||||
import { BookWhere } from '@/components/BookWhere'
|
||||
@ -41,6 +41,7 @@ export default async function Home({ params }: { params: Promise<{ locale: strin
|
||||
const { home, news } = await loadContent(locale)
|
||||
const m = buildHomeModel(home, news, t)
|
||||
const email = m.collaboration.email ?? FALLBACK_EMAIL
|
||||
const legal = await loadLegal(locale)
|
||||
const fmt = new Intl.DateTimeFormat(locale, { day: 'numeric', month: 'long', year: 'numeric' })
|
||||
|
||||
return (
|
||||
@ -119,7 +120,7 @@ export default async function Home({ params }: { params: Promise<{ locale: strin
|
||||
<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>
|
||||
<div className="mt-10">
|
||||
<ContactForm t={t} locale={locale} email={email} dark />
|
||||
<ContactForm t={t} locale={locale} email={email} dark privacyLink={isLegalPublished(legal?.privacy)} />
|
||||
</div>
|
||||
<a href="https://www.instagram.com/serkebayev_book/" className="mt-6 inline-flex min-h-11 items-center gap-3 underline underline-offset-4 hover:text-paper/75">
|
||||
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7" className="h-6 w-6 shrink-0">
|
||||
@ -132,7 +133,7 @@ export default async function Home({ params }: { params: Promise<{ locale: strin
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<Footer t={t} locale={locale} legal={await loadLegal(locale)} />
|
||||
<Footer t={t} locale={locale} legal={legal} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ import { submitInquiry, type InquiryState } from '@/app/actions/inquiry'
|
||||
import type { Dict, Locale } from '@/i18n'
|
||||
|
||||
/** Форма обращения. dark — на тёмном фоне блока «Сотрудничество». Тексты — из словаря, ошибки по полям. */
|
||||
export function ContactForm({ t, locale, email, dark = false }: { t: Dict; locale: Locale; email: string; dark?: boolean }) {
|
||||
export function ContactForm({ t, locale, email, dark = false, privacyLink = false }: { t: Dict; locale: Locale; email: string; dark?: boolean; privacyLink?: boolean }) {
|
||||
const [state, action, pending] = useActionState<InquiryState, FormData>(submitInquiry, { status: 'idle' })
|
||||
const openedAt = useRef(0)
|
||||
const errors = state.status === 'error' ? state.errors : []
|
||||
@ -55,7 +55,9 @@ export function ContactForm({ t, locale, email, dark = false }: { t: Dict; local
|
||||
<input name="consent" type="checkbox" required className="mt-1 h-4 w-4 shrink-0 accent-[#7a1f2b]" {...bad('consent')} />
|
||||
<span>
|
||||
{f.consent}
|
||||
<Link href={`/${locale}/privacy`} className="underline underline-offset-4 hover:no-underline">{t.legal.consentLink}</Link>
|
||||
{privacyLink
|
||||
? <Link href={`/${locale}/privacy`} className="underline underline-offset-4 hover:no-underline">{t.legal.consentLink}</Link>
|
||||
: t.legal.consentLink}
|
||||
{t.legal.consentAfter}
|
||||
</span>
|
||||
</label>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user