From ecf1898e9d2178a8e5af02a1fd681766ac4e7cd1 Mon Sep 17 00:00:00 2001 From: peppa-bot Date: Wed, 25 Nov 2026 12:39:17 +0000 Subject: [PATCH] =?UTF-8?q?QLFW-88:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=80=D0=B5=D0=B4=D0=B0=D0=BA=D1=82=D0=B8=D1=80?= =?UTF-8?q?=D1=83=D0=B5=D0=BC=D1=8B=D0=B9=20=D1=82=D0=B5=D0=BA=D1=81=D1=82?= =?UTF-8?q?=20=D0=BA=D0=BE=D0=BD=D1=82=D0=B0=D0=BA=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/glossary.md | 1 + .../qlfw-88-admin-workflow/.openspec.yaml | 2 ++ .../changes/qlfw-88-admin-workflow/design.md | 5 +++++ .../changes/qlfw-88-admin-workflow/proposal.md | 16 ++++++++++++++++ .../specs/admin-panel/spec.md | 15 +++++++++++++++ openspec/changes/qlfw-88-admin-workflow/tasks.md | 5 +++++ src/app/(site)/[locale]/contacts/page.tsx | 5 +++-- src/globals/SiteSettings.ts | 2 ++ src/i18n/en.ts | 2 +- src/i18n/kk.ts | 2 +- src/i18n/ru.ts | 2 +- src/lib/site-model.ts | 2 +- src/migrations/20261125_120000_contacts_intro.ts | 9 +++++++++ src/migrations/index.ts | 2 ++ src/payload-types.ts | 2 ++ 15 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 openspec/changes/qlfw-88-admin-workflow/.openspec.yaml create mode 100644 openspec/changes/qlfw-88-admin-workflow/design.md create mode 100644 openspec/changes/qlfw-88-admin-workflow/proposal.md create mode 100644 openspec/changes/qlfw-88-admin-workflow/specs/admin-panel/spec.md create mode 100644 openspec/changes/qlfw-88-admin-workflow/tasks.md create mode 100644 src/migrations/20261125_120000_contacts_intro.ts diff --git a/docs/glossary.md b/docs/glossary.md index 199d2f2..e2bebd1 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -69,3 +69,4 @@ | Контакты и соцсети | почта, телефон, адрес, соцсети | глобал, settings | Заполняются в панели и показываются на странице «Контакты» | | Адрес страницы проекта | адрес страницы | slug | У каждого проекта свой адрес. Адрес книги уже занят. | | Подпись фотографии книги | разворот, выходные данные, фотография книги | Фото 1, Photo 1 | Короткое описание того, что видно на снимке | +| Текст страницы контактов | Вводный текст страницы «Контакты» / «Байланыс» бетінің кіріспе мәтіні / Contacts page introduction | — | Текст под заголовком страницы на выбранном языке | diff --git a/openspec/changes/qlfw-88-admin-workflow/.openspec.yaml b/openspec/changes/qlfw-88-admin-workflow/.openspec.yaml new file mode 100644 index 0000000..462e04d --- /dev/null +++ b/openspec/changes/qlfw-88-admin-workflow/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-11-25 diff --git a/openspec/changes/qlfw-88-admin-workflow/design.md b/openspec/changes/qlfw-88-admin-workflow/design.md new file mode 100644 index 0000000..cfcf4e3 --- /dev/null +++ b/openspec/changes/qlfw-88-admin-workflow/design.md @@ -0,0 +1,5 @@ +## Решения + +Добавляем локализованное необязательное поле в существующий раздел «Контакты и соцсети». При пустом значении используется текущий текст словаря на языке страницы. Обратимая миграция добавляет столбец без перезаписи существующих данных. + +Новость и событие проверяем как две записи раздела «Новости и события». Сценарий использует настоящие интерфейс, миграции, хранение фото и страницы сайта. Отдельная база и локальный запуск сборки позволяют создавать и удалять записи без вмешательства в общий сайт фонда. diff --git a/openspec/changes/qlfw-88-admin-workflow/proposal.md b/openspec/changes/qlfw-88-admin-workflow/proposal.md new file mode 100644 index 0000000..ee5bede --- /dev/null +++ b/openspec/changes/qlfw-88-admin-workflow/proposal.md @@ -0,0 +1,16 @@ +## Зачем + +QLFW-88. Владелец фонда должен увидеть, как сотрудник меняет сайт через панель управления. + +## Что меняем + +- Делается редактируемым вводный текст страницы «Контакты». +- Записывается сквозная проверка входа, работы с проектом, новостью, событием, фото и страницами фонда на отдельной проверочной копии. + +## Вне задачи + +Доступы сотрудников и содержимое общей базы фонда. + +## Вопросы к владельцу + +Нет. diff --git a/openspec/changes/qlfw-88-admin-workflow/specs/admin-panel/spec.md b/openspec/changes/qlfw-88-admin-workflow/specs/admin-panel/spec.md new file mode 100644 index 0000000..f69e03a --- /dev/null +++ b/openspec/changes/qlfw-88-admin-workflow/specs/admin-panel/spec.md @@ -0,0 +1,15 @@ +## ADDED Requirements + +### Requirement: Редактируемый вводный текст страницы контактов + +Раздел «Контакты и соцсети» SHALL позволять сотруднику менять вводный текст страницы «Контакты» отдельно для каждого языка. + +#### Scenario: Сохранён новый вводный текст +- **GIVEN** сотрудник сохранил для русского языка текст «По вопросам выставок напишите фонду.» +- **WHEN** посетитель открывает /ru/contacts +- **THEN** под заголовком «Контакты» виден текст «По вопросам выставок напишите фонду.» + +#### Scenario: Вводный текст на английском пуст +- **GIVEN** сотрудник заполнил русский текст и оставил английское поле пустым +- **WHEN** посетитель открывает /en/contacts +- **THEN** показан штатный английский вводный текст из словаря сайта diff --git a/openspec/changes/qlfw-88-admin-workflow/tasks.md b/openspec/changes/qlfw-88-admin-workflow/tasks.md new file mode 100644 index 0000000..fc79b66 --- /dev/null +++ b/openspec/changes/qlfw-88-admin-workflow/tasks.md @@ -0,0 +1,5 @@ +## 1. Панель управления + +- [x] 1.1 Добавить локализованный вводный текст страницы «Контакты» и миграцию. +- [ ] 1.2 Проверить через браузер вход, работу с тремя видами материалов, фото и страницами фонда. Приложить снимки. +- [ ] 1.3 Запустить проверки проекта, проверить /healthz и выполнить openspec validate. diff --git a/src/app/(site)/[locale]/contacts/page.tsx b/src/app/(site)/[locale]/contacts/page.tsx index 8f4cf78..2d530f1 100644 --- a/src/app/(site)/[locale]/contacts/page.tsx +++ b/src/app/(site)/[locale]/contacts/page.tsx @@ -34,7 +34,8 @@ export default async function ContactsPage({ params }: Props) { const t = getDict(locale) const { home, news } = await loadContent(locale) const legal = await loadLegal(locale) - const c = buildContacts(await loadSettings(locale), home?.contactEmail) + const settings = await loadSettings(locale) + const c = buildContacts(settings, home?.contactEmail) const email = c.email || FALLBACK_EMAIL return ( <> @@ -43,7 +44,7 @@ export default async function ContactsPage({ params }: Props) { ← {t.legal.back}

{t.contacts.title}

-

{t.contacts.lead}

+

{settings?.intro?.trim() || t.contacts.lead}

{t.contacts.emailLabel}:

diff --git a/src/globals/SiteSettings.ts b/src/globals/SiteSettings.ts index dff66dd..84020d7 100644 --- a/src/globals/SiteSettings.ts +++ b/src/globals/SiteSettings.ts @@ -1,10 +1,12 @@ import type { GlobalConfig } from 'payload' +import { getDict } from '../i18n' export const SiteSettings: GlobalConfig = { slug: 'site-settings', label: 'Контакты и соцсети', access: { read: () => true }, fields: [ + { name: 'intro', label: { ru: getDict('ru').contacts.adminIntroLabel, kk: getDict('kk').contacts.adminIntroLabel, en: getDict('en').contacts.adminIntroLabel }, type: 'textarea', localized: true }, { name: 'email', label: 'Почта для связи', type: 'email' }, { name: 'phone', label: 'Телефон', type: 'text' }, { name: 'address', label: 'Адрес', type: 'text', localized: true }, diff --git a/src/i18n/en.ts b/src/i18n/en.ts index 296537e..3355645 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -57,7 +57,7 @@ export const en: Dict = { text: 'If our goal is close to yours, we would be glad to discuss joint projects, partnerships and ideas.', write: 'Write to us', }, - contacts: { title: 'Contacts', description: 'Get in touch with Qazaq Legacy Foundation: a message form and an email address.', lead: 'Write to us — we will read your message and reply to the email you give. You can also propose a partnership or a joint project here.', emailLabel: 'Email', phoneLabel: 'Phone', addressLabel: 'Address', socialsLabel: 'We are on social media' }, + contacts: { adminIntroLabel: 'Contacts page introduction', title: 'Contacts', description: 'Get in touch with Qazaq Legacy Foundation: a message form and an email address.', lead: 'Write to us — we will read your message and reply to the email you give. You can also propose a partnership or a joint project here.', emailLabel: 'Email', phoneLabel: 'Phone', addressLabel: 'Address', socialsLabel: 'We are on social media' }, form: { name: 'Your name', email: 'Email', organization: 'Organization', optional: 'optional', message: 'Your message', consent: 'I agree to the processing of my personal data.', consentPolicyBefore: 'I agree to the processing of my personal data in accordance with the ', consentPolicyLink: 'Privacy Policy', consentPolicyAfter: '.', consentNeed: 'To send the message, please tick the consent box.', diff --git a/src/i18n/kk.ts b/src/i18n/kk.ts index 8612df1..49a0bb2 100644 --- a/src/i18n/kk.ts +++ b/src/i18n/kk.ts @@ -57,7 +57,7 @@ export const kk: Dict = { text: 'Біздің мақсат сізге жақын болса, бірлескен жобаларды, серіктестікті және идеяларды талқылауға қуанамыз.', write: 'Бізге жазыңыз', }, - contacts: { title: 'Байланыс', description: 'Qazaq Legacy Foundation қорымен байланысыңыз: өтініш формасы және электрондық пошта.', lead: 'Бізге жазыңыз — өтінішті оқып, көрсеткен поштаңызға жауап береміз. Серіктестік немесе бірлескен жоба туралы да осы жерден жаза аласыз.', emailLabel: 'Электрондық пошта', phoneLabel: 'Телефон', addressLabel: 'Мекенжай', socialsLabel: 'Әлеуметтік желілер' }, + contacts: { adminIntroLabel: '«Байланыс» бетінің кіріспе мәтіні', title: 'Байланыс', description: 'Qazaq Legacy Foundation қорымен байланысыңыз: өтініш формасы және электрондық пошта.', lead: 'Бізге жазыңыз — өтінішті оқып, көрсеткен поштаңызға жауап береміз. Серіктестік немесе бірлескен жоба туралы да осы жерден жаза аласыз.', emailLabel: 'Электрондық пошта', phoneLabel: 'Телефон', addressLabel: 'Мекенжай', socialsLabel: 'Әлеуметтік желілер' }, form: { name: 'Атыңыз', email: 'Электрондық пошта', organization: 'Ұйым', optional: 'міндетті емес', message: 'Өтінішіңіз', consent: 'Жеке деректерімді өңдеуге келісемін.', consentPolicyBefore: 'Жеке деректерімді өңдеуге ', consentPolicyLink: 'құпиялылық саясатына', consentPolicyAfter: ' сәйкес келісемін.', consentNeed: 'Өтінішті жіберу үшін келісім белгісі қажет.', diff --git a/src/i18n/ru.ts b/src/i18n/ru.ts index 9c2bece..6e4944e 100644 --- a/src/i18n/ru.ts +++ b/src/i18n/ru.ts @@ -57,7 +57,7 @@ export const ru: Dict = { text: 'Если вам близка наша цель, мы будем рады обсудить совместные проекты, партнёрства и идеи.', write: 'Написать нам', }, - contacts: { title: 'Контакты', description: 'Свяжитесь с Qazaq Legacy Foundation: форма обращения и электронная почта.', lead: 'Напишите нам — мы прочитаем обращение и ответим на указанную почту. Здесь же можно предложить партнёрство или совместный проект.', emailLabel: 'Электронная почта', phoneLabel: 'Телефон', addressLabel: 'Адрес', socialsLabel: 'Мы в соцсетях' }, + contacts: { adminIntroLabel: 'Вводный текст страницы «Контакты»', title: 'Контакты', description: 'Свяжитесь с Qazaq Legacy Foundation: форма обращения и электронная почта.', lead: 'Напишите нам — мы прочитаем обращение и ответим на указанную почту. Здесь же можно предложить партнёрство или совместный проект.', emailLabel: 'Электронная почта', phoneLabel: 'Телефон', addressLabel: 'Адрес', socialsLabel: 'Мы в соцсетях' }, form: { name: 'Ваше имя', email: 'Электронная почта', organization: 'Организация', optional: 'необязательно', message: 'Ваше обращение', consent: 'Я согласен(на) на обработку моих персональных данных.', consentPolicyBefore: 'Я согласен(на) на обработку персональных данных в соответствии с ', consentPolicyLink: 'политикой конфиденциальности', consentPolicyAfter: '.', consentNeed: 'Чтобы отправить обращение, нужна отметка о согласии.', diff --git a/src/lib/site-model.ts b/src/lib/site-model.ts index 9b08204..24d3c91 100644 --- a/src/lib/site-model.ts +++ b/src/lib/site-model.ts @@ -4,7 +4,7 @@ import { bookProjectSlug } from './project-paths' export type CmsMedia = { url?: string | null; alt?: string | null } | number | string | null | undefined export type CmsProject = { id: string | number; slug: string; title?: string | null; summary?: string | null; body?: string | null; cover?: CmsMedia; order?: number | null } export type CmsAbout = { text?: string | null; photo?: CmsMedia } | null -export type CmsSettings = { email?: string | null; phone?: string | null; address?: string | null; socials?: { label?: string | null; url?: string | null }[] | null; bookPhotos?: { photo?: CmsMedia }[] | null } | null +export type CmsSettings = { intro?: string | null; email?: string | null; phone?: string | null; address?: string | null; socials?: { label?: string | null; url?: string | null }[] | null; bookPhotos?: { photo?: CmsMedia }[] | null } | null const clean = (v?: string | null) => (v && v.trim() ? v.trim() : null) diff --git a/src/migrations/20261125_120000_contacts_intro.ts b/src/migrations/20261125_120000_contacts_intro.ts new file mode 100644 index 0000000..ed39991 --- /dev/null +++ b/src/migrations/20261125_120000_contacts_intro.ts @@ -0,0 +1,9 @@ +import { type MigrateUpArgs, type MigrateDownArgs, sql } from '@payloadcms/db-sqlite' + +export async function up({ db }: MigrateUpArgs): Promise { + await db.run(sql`ALTER TABLE site_settings_locales ADD COLUMN intro text`) +} + +export async function down({ db }: MigrateDownArgs): Promise { + await db.run(sql`ALTER TABLE site_settings_locales DROP COLUMN intro`) +} diff --git a/src/migrations/index.ts b/src/migrations/index.ts index fbc1d88..a1321af 100644 --- a/src/migrations/index.ts +++ b/src/migrations/index.ts @@ -1,3 +1,4 @@ +import * as migration_contacts_intro from './20261125_120000_contacts_intro'; import * as migration_admin_panel from './20261117_200000_admin_panel'; import * as migration_book_photos from './20261119_100000_book_photos'; import * as migration_news_details from './20261117_170000_news_details'; @@ -31,4 +32,5 @@ export const migrations = [ { up: migration_foundation.up, down: migration_foundation.down, name: '20261117_190000_foundation' }, { up: migration_admin_panel.up, down: migration_admin_panel.down, name: '20261117_200000_admin_panel' }, { up: migration_book_photos.up, down: migration_book_photos.down, name: '20261119_100000_book_photos' }, + { up: migration_contacts_intro.up, down: migration_contacts_intro.down, name: '20261125_120000_contacts_intro' }, ]; diff --git a/src/payload-types.ts b/src/payload-types.ts index fb58580..c7fc0d7 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -493,6 +493,7 @@ export interface About { */ export interface SiteSetting { id: number; + intro?: string | null; email?: string | null; phone?: string | null; address?: string | null; @@ -609,6 +610,7 @@ export interface AboutSelect { * via the `definition` "site-settings_select". */ export interface SiteSettingsSelect { + intro?: T; email?: T; phone?: T; address?: T;