QLFW-5: подвал разделов учитывает полноту юридических текстов (QLFW-31)
All checks were successful
peppa/lint lint: success за 1с
peppa/typecheck typecheck: success за 2с
peppa/test test: success за 0с
peppa/build build: success за 40с
ci / checks (pull_request) Successful in 1m19s
deploy / deploy (pull_request) Successful in 2m1s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Peppa 2026-11-17 18:23:07 +05:00
parent 84f3d1cd2d
commit 06f6f2f3ba
7 changed files with 12 additions and 11 deletions

View File

@ -1,6 +1,6 @@
import { notFound } from 'next/navigation'
import { getDict, isLocale, locales } from '@/i18n'
import { loadContent } from '@/lib/content'
import { loadContent, loadLegal } from '@/lib/content'
import { buildHomeModel } from '@/lib/home-model'
import { SectionPage } from '@/components/SectionPage'
import { Tbc } from '@/components/Tbc'
@ -18,7 +18,7 @@ export default async function Page({ params }: { params: Promise<{ locale: strin
const t = getDict(locale)
const { home, news } = await loadContent(locale)
const m = buildHomeModel(home, news, t)
return <SectionPage t={t} locale={locale} path="/about" title={t.sections.about} showNews={m.news.length > 0}>
return <SectionPage legal={await loadLegal(locale)} t={t} locale={locale} path="/about" title={t.sections.about} showNews={m.news.length > 0}>
<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>

View File

@ -1,7 +1,7 @@
import Link from 'next/link'
import { notFound } from 'next/navigation'
import { getDict, isLocale, locales } from '@/i18n'
import { loadNews } from '@/lib/content'
import { loadNews, loadLegal } from '@/lib/content'
import { visibleNews } from '@/lib/news-model'
import { SectionPage } from '@/components/SectionPage'
@ -26,7 +26,7 @@ export default async function Page({ params }: { params: Promise<{ locale: strin
if (!n) notFound()
const image = safeWebUrl(n.imageUrl)
const source = safeWebUrl(n.sourceUrl)
return <SectionPage t={t} locale={locale} path={`/news/${id}`} title={n.title} showNews>
return <SectionPage legal={await loadLegal(locale)} t={t} locale={locale} path={`/news/${id}`} title={n.title} showNews>
<article className="max-w-3xl">
<time dateTime={n.date}>{new Intl.DateTimeFormat(locale, { dateStyle: 'long' }).format(new Date(n.date))}</time>
{n.place && <p className="mt-3">{n.place}</p>}

View File

@ -1,7 +1,7 @@
import Link from 'next/link'
import { notFound } from 'next/navigation'
import { getDict, isLocale, locales } from '@/i18n'
import { loadNews } from '@/lib/content'
import { loadNews, loadLegal } from '@/lib/content'
import { visibleNews } from '@/lib/news-model'
import { SectionPage } from '@/components/SectionPage'
@ -20,7 +20,7 @@ export default async function Page({ params }: { params: Promise<{ locale: strin
const news = visibleNews(await loadNews(locale))
if (!news.length) notFound()
const fmt = new Intl.DateTimeFormat(locale, { dateStyle: 'long' })
return <SectionPage t={t} locale={locale} path="/news" title={t.news.title} showNews>
return <SectionPage legal={await loadLegal(locale)} t={t} locale={locale} path="/news" title={t.news.title} showNews>
<ul className="divide-y divide-line">{news.map(n => <li key={n.id} className="py-7">
<time dateTime={n.date}>{fmt.format(new Date(n.date))}</time>
<h2 className="mt-3 font-serif text-2xl"><Link href={`/${locale}/news/${n.id}`} className="underline underline-offset-4">{n.title}</Link></h2>

View File

@ -1,6 +1,6 @@
import { notFound } from 'next/navigation'
import { getDict, isLocale, locales } from '@/i18n'
import { loadContent } from '@/lib/content'
import { loadContent, loadLegal } from '@/lib/content'
import { buildHomeModel } from '@/lib/home-model'
import { SectionPage } from '@/components/SectionPage'
import Image from 'next/image'
@ -19,7 +19,7 @@ export default async function Page({ params }: { params: Promise<{ locale: strin
const t = getDict(locale)
const { home, news } = await loadContent(locale)
const m = buildHomeModel(home, news, t)
return <SectionPage t={t} locale={locale} path="/projects" title={t.projects.title} showNews={m.news.length > 0}>
return <SectionPage legal={await loadLegal(locale)} t={t} locale={locale} path="/projects" title={t.projects.title} showNews={m.news.length > 0}>
<article className="grid gap-8 border border-line p-6 sm:p-10 md:grid-cols-[1fr_2fr]">
<Link href={`/${locale}/projects/ermek-serkebayev`}><Image src="/books/serkebayev/cover.jpg" alt={t.book.cover} width={677} height={1000} sizes="(min-width: 768px) 320px, 100vw" className="mx-auto h-auto w-full max-w-sm" /></Link>
<div className="min-w-0"><p>{t.book.author}</p><h2 className="mt-3 font-serif text-2xl sm:text-3xl">{t.book.title}</h2>{t.book.paragraphs.map(text => <p key={text} className="mt-5">{text}</p>)}<Link href={`/${locale}/projects/ermek-serkebayev`} className="mt-6 inline-flex min-h-11 items-center underline underline-offset-4">{t.projects.more}</Link></div>

View File

@ -1,8 +1,9 @@
import { Header } from './Header'
import { Footer } from './Footer'
import type { CmsLegal } from '@/lib/legal-model'
import type { Dict, Locale } from '@/i18n'
export function SectionPage({ t, locale, path, title, showNews, children }: { t: Dict; locale: Locale; path: string; title: string; showNews: boolean; children: React.ReactNode }) {
export function SectionPage({ t, locale, path, title, showNews, legal, children }: { t: Dict; locale: Locale; path: string; title: string; showNews: boolean; legal: CmsLegal | null; children: React.ReactNode }) {
return <>
<Header t={t} locale={locale} path={path} showProjects showNews={showNews} />
<main className="mx-auto max-w-6xl px-5 pb-20 pt-64 sm:px-8 sm:pt-56 md:pt-44">
@ -10,6 +11,6 @@ export function SectionPage({ t, locale, path, title, showNews, children }: { t:
{t.sections.review && <p className="mb-8 text-sm">{t.sections.review}</p>}
{children}
</main>
<Footer t={t} locale={locale} />
<Footer t={t} locale={locale} legal={legal} />
</>
}

View File

@ -5,7 +5,6 @@ import BookProject from '../app/(site)/[locale]/projects/ermek-serkebayev/page'
import { getDict, locales } from '../i18n'
import { bookUrl } from './home-model'
vi.mock('./content', () => ({ loadContent: vi.fn(async () => ({ home: null, news: [] })) }))
describe('Подтверждённая страница книги', () => {
for (const locale of locales) {

View File

@ -12,6 +12,7 @@ vi.mock('@/app/actions/inquiry', () => ({ submitInquiry: vi.fn() }))
vi.mock('./content', () => ({
loadContent: vi.fn(async () => ({ home: null, news: [] })),
loadNews: vi.fn(async () => []),
loadLegal: vi.fn(async () => null),
}))
describe('Разделы и языки', () => {