QLFW-52: «О фонде» без пометок и повторов #33
@ -14,6 +14,7 @@
|
||||
- QLFW-9: базовые тексты главной и книги — src/i18n/{ru,kk,en}.ts; Payload сохраняет приоритет, fallbackLocale отключён. Почта и URL Flip — src/lib/home-model.ts.
|
||||
- QLFW-11: по выбору PM связь — видимая почта и Instagram https://www.instagram.com/serkebayev_book/; без формы показываем обычную ссылку на политику, PrivacyNote оставляем только для форм. SMTP не требуется.
|
||||
- QLFW-5: отдельные разделы /[locale]/about, /projects, /contacts, /news и /news/[id]; тексты sections в ru/kk/en. News: body/sourceUrl локализованы, imageUrl общий; без перевода заголовка материал скрыт, пустой /news = 404. Контакты без формы по QLFW-11.
|
||||
- QLFW-52: люди и партнёры страницы «О фонде» — src/lib/about-model.ts (по языкам, пока пусто); блок виден только при непустом списке.
|
||||
|
||||
## Грабли
|
||||
- QLFW-32: страница книги уже была готова (QLFW-8); локальный main может отставать — worktree делать от origin/main после git fetch.
|
||||
|
||||
@ -0,0 +1 @@
|
||||
Данные людей и партнёров — типизированный файл src/lib/about-model.ts по языкам (пока пустой): без миграций БД; блок появляется, когда добавлена запись. Решение агента.
|
||||
@ -0,0 +1,6 @@
|
||||
## Why
|
||||
На странице «О фонде» видны пометки «Нужно уточнить», а «Цели» пересказывают «Миссию».
|
||||
|
||||
## What Changes
|
||||
- Блоки «Учредитель», «Руководство», «Попечительский совет», «Партнёры» показываются только при наличии данных (src/lib/about-model.ts).
|
||||
- Новый текст «Целей» на ru/kk/en.
|
||||
@ -0,0 +1,13 @@
|
||||
## ADDED Requirements
|
||||
### Requirement: Страница «О фонде» без служебных пометок
|
||||
Блоки с людьми и партнёрами SHALL показываться только при наличии данных.
|
||||
|
||||
#### Scenario: Данных нет
|
||||
- **GIVEN** фонд не передал сведения о руководстве и партнёрах
|
||||
- **WHEN** посетитель открывает «О фонде»
|
||||
- **THEN** блоков «Учредитель», «Руководство», «Попечительский совет», «Партнёры» и пометки «Нужно уточнить» нет
|
||||
|
||||
#### Scenario: Данные появились
|
||||
- **GIVEN** в списке учредителя есть запись
|
||||
- **WHEN** посетитель открывает «О фонде»
|
||||
- **THEN** виден блок «Учредитель» с этим именем
|
||||
@ -0,0 +1,3 @@
|
||||
- [x] Скрыть пустые блоки, добавить «Партнёры»
|
||||
- [x] Переписать «Цели» на ru/kk/en
|
||||
- [x] Тесты
|
||||
19
openspec/specs/about/spec.md
Normal file
19
openspec/specs/about/spec.md
Normal file
@ -0,0 +1,19 @@
|
||||
# about Specification
|
||||
|
||||
## Purpose
|
||||
TBD - created by archiving change qlfw-52-about-cleanup. Update Purpose after archive.
|
||||
|
||||
## Requirements
|
||||
|
||||
### Requirement: Страница «О фонде» без служебных пометок
|
||||
Блоки с людьми и партнёрами SHALL показываться только при наличии данных.
|
||||
|
||||
#### Scenario: Данных нет
|
||||
- **GIVEN** фонд не передал сведения о руководстве и партнёрах
|
||||
- **WHEN** посетитель открывает «О фонде»
|
||||
- **THEN** блоков «Учредитель», «Руководство», «Попечительский совет», «Партнёры» и пометки «Нужно уточнить» нет
|
||||
|
||||
#### Scenario: Данные появились
|
||||
- **GIVEN** в списке учредителя есть запись
|
||||
- **WHEN** посетитель открывает «О фонде»
|
||||
- **THEN** виден блок «Учредитель» с этим именем
|
||||
@ -3,7 +3,7 @@ import { getDict, isLocale, locales } from '@/i18n'
|
||||
import { loadContent, loadLegal } from '@/lib/content'
|
||||
import { buildHomeModel } from '@/lib/home-model'
|
||||
import { SectionPage } from '@/components/SectionPage'
|
||||
import { Tbc } from '@/components/Tbc'
|
||||
import { aboutPeople } from '@/lib/about-model'
|
||||
|
||||
export const dynamic = 'force-dynamic'
|
||||
export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }) {
|
||||
@ -18,12 +18,19 @@ 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)
|
||||
const data = aboutPeople[locale]
|
||||
const people = [
|
||||
{ label: t.sections.founder, items: data.founder },
|
||||
{ label: t.sections.leadership, items: data.leadership },
|
||||
{ label: t.sections.board, items: data.board },
|
||||
].filter(b => b.items.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>
|
||||
<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 ?? t.tbc}</p></li>)}</ul>
|
||||
<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-6 sm:grid-cols-3">{[t.sections.founder,t.sections.leadership,t.sections.board].map(label => <section key={label}><h2 className="mb-4 font-serif text-2xl">{label}</h2><Tbc label={t.tbc} /></section>)}</div>
|
||||
{people.length > 0 && <div className="mt-12 grid gap-6 sm:grid-cols-3">{people.map(b => <section key={b.label}><h2 className="mb-4 font-serif text-2xl">{b.label}</h2><ul className="space-y-2">{b.items.map(p => <li key={p.name}><span className="font-medium">{p.name}</span>{p.role ? <span className="block text-sm text-muted">{p.role}</span> : null}</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>
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import type { Dict } from './types'
|
||||
|
||||
export const en: Dict = {
|
||||
sections: {"about": "About the foundation", "contacts": "Contacts", "goals": "Goals", "goalText": "Preserve the legacy of outstanding cultural figures and artists, pass it on to new generations, and support cultural and educational initiatives.", "founder": "Founder", "leadership": "Leadership", "board": "Board of trustees", "read": "Read", "source": "Source", "review": "Translation awaiting review."},
|
||||
sections: {"about": "About the foundation", "contacts": "Contacts", "partners": "Partners", "goals": "Goals", "goalText": "Collect and organise archives, manuscripts and recordings; publish books and music collections; make the legacy available to a wide audience in digital form; support young musicians and researchers; build ties with cultural organisations abroad.", "founder": "Founder", "leadership": "Leadership", "board": "Board of trustees", "read": "Read", "source": "Source", "review": "Translation awaiting review."},
|
||||
siteName: 'Qazaq Legacy Foundation',
|
||||
metaTitle: 'Qazaq Legacy Foundation — a private foundation for Kazakhstan’s heritage',
|
||||
metaDescription:
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import type { Dict } from './types'
|
||||
|
||||
export const kk: Dict = {
|
||||
sections: {"about": "Қор туралы", "contacts": "Байланыс", "goals": "Мақсаттар", "goalText": "Мәдениет пен өнердің көрнекті қайраткерлерінің мұрасын сақтау, оны жаңа ұрпаққа жеткізу және мәдени-ағартушылық бастамаларды қолдау.", "founder": "Құрылтайшы", "leadership": "Басшылық", "board": "Қамқоршылық кеңес", "read": "Оқу", "source": "Дереккөз", "review": "Аударманы тексеру қажет."},
|
||||
sections: {"about": "Қор туралы", "contacts": "Байланыс", "partners": "Серіктестер", "goals": "Мақсаттар", "goalText": "Мұрағаттарды, қолжазбалар мен жазбаларды жинап, жүйелеу; кітаптар мен музыкалық жинақтар шығару; мұраны кең аудиторияға цифрлық түрде ұсыну; жас музыканттар мен зерттеушілерге қолдау көрсету; шетелдік мәдени ұйымдармен байланыс орнату.", "founder": "Құрылтайшы", "leadership": "Басшылық", "board": "Қамқоршылық кеңес", "read": "Оқу", "source": "Дереккөз", "review": "Аударманы тексеру қажет."},
|
||||
siteName: 'Qazaq Legacy Foundation',
|
||||
metaTitle: 'Qazaq Legacy Foundation — Қазақстан мұрасының жеке қоры',
|
||||
metaDescription:
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import type { Dict } from './types'
|
||||
|
||||
export const ru: Dict = {
|
||||
sections: {"about": "О фонде", "contacts": "Контакты", "goals": "Цели", "goalText": "Сохранять наследие выдающихся деятелей культуры и искусства, передавать его новым поколениям и поддерживать культурные и просветительские инициативы.", "founder": "Учредитель", "leadership": "Руководство", "board": "Попечительский совет", "read": "Читать", "source": "Источник", "review": ""},
|
||||
sections: {"about": "О фонде", "contacts": "Контакты", "partners": "Партнёры", "goals": "Цели", "goalText": "Собирать и систематизировать архивы, рукописи и записи; издавать книги и музыкальные сборники; открывать наследие широкой аудитории в цифровом виде; помогать молодым музыкантам и исследователям; выстраивать связи с зарубежными культурными организациями.", "founder": "Учредитель", "leadership": "Руководство", "board": "Попечительский совет", "read": "Читать", "source": "Источник", "review": ""},
|
||||
siteName: 'Qazaq Legacy Foundation',
|
||||
metaTitle: 'Qazaq Legacy Foundation — частный фонд наследия Казахстана',
|
||||
metaDescription:
|
||||
|
||||
@ -2,7 +2,7 @@ export const locales = ['ru', 'kk', 'en'] as const
|
||||
export type Locale = (typeof locales)[number]
|
||||
|
||||
export type Dict = {
|
||||
sections: { about: string; contacts: string; goals: string; goalText: string; founder: string; leadership: string; board: string; read: string; source: string; review: string }
|
||||
sections: { about: string; contacts: string; partners: string; goals: string; goalText: string; founder: string; leadership: string; board: string; read: string; source: string; review: string }
|
||||
siteName: string
|
||||
metaTitle: string
|
||||
metaDescription: string
|
||||
|
||||
15
src/lib/about-model.ts
Normal file
15
src/lib/about-model.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import type { Locale } from '@/i18n'
|
||||
|
||||
export type AboutPerson = { name: string; role?: string }
|
||||
export type AboutPartner = { name: string; url?: string }
|
||||
export type AboutPeople = { founder: AboutPerson[]; leadership: AboutPerson[]; board: AboutPerson[]; partners: AboutPartner[] }
|
||||
|
||||
/**
|
||||
* Данные страницы «О фонде». Пока фонд не передал сведения, списки пусты, и блоки не показываются.
|
||||
* Как только в список на нужном языке добавят запись, блок появится сам.
|
||||
*/
|
||||
export const aboutPeople: Record<Locale, AboutPeople> = {
|
||||
ru: { founder: [], leadership: [], board: [], partners: [] },
|
||||
kk: { founder: [], leadership: [], board: [], partners: [] },
|
||||
en: { founder: [], leadership: [], board: [], partners: [] },
|
||||
}
|
||||
@ -18,14 +18,17 @@ vi.mock('./content', () => ({
|
||||
describe('Разделы и языки', () => {
|
||||
for (const locale of locales) {
|
||||
const params = Promise.resolve({ locale })
|
||||
it(`Нет сведений о руководстве: явные пометки, партнёры скрыты — ${locale}`, async () => {
|
||||
it(`Нет сведений о руководстве: блоки и пометки скрыты, цели не повторяют миссию — ${locale}`, async () => {
|
||||
const html = renderToStaticMarkup(await About({ params }))
|
||||
const t = getDict(locale)
|
||||
expect(html).toContain(t.sections.founder)
|
||||
expect(html).toContain(t.sections.board)
|
||||
expect(html).toContain(t.tbc)
|
||||
expect(html).not.toContain(t.sections.founder)
|
||||
expect(html).not.toContain(t.sections.leadership)
|
||||
expect(html).not.toContain(t.sections.board)
|
||||
expect(html).not.toContain(t.sections.partners)
|
||||
expect(html).not.toContain(t.tbc)
|
||||
expect(html).toContain(t.mission.text)
|
||||
expect(html).not.toContain('partners')
|
||||
expect(html).toContain(t.sections.goalText)
|
||||
expect(t.mission.text).not.toContain(t.sections.goalText)
|
||||
})
|
||||
it(`Переключение языка каталога сохраняет путь — ${locale}`, async () => {
|
||||
const html = renderToStaticMarkup(await Projects({ params }))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user