Compare commits

...

5 Commits

Author SHA1 Message Date
28d9bdc208 QLFW-50: ссылки на магазины в блоке «Где купить книгу»
All checks were successful
peppa/lint lint: success за 1с
peppa/typecheck typecheck: success за 2с
peppa/test test: success за 1с
peppa/build build: success за 40с
ci / checks (pull_request) Successful in 1m17s
deploy / deploy (pull_request) Successful in 1m54s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 18:59:13 +05:00
fa829d6a6d Merge pull request 'QLFW-46: фраза согласия не отсылает к неопубликованной политике' (#31) from task/qlfw-46 into main
All checks were successful
peppa/lint lint: success за 2с
peppa/typecheck typecheck: success за 3с
peppa/test test: success за 1с
deploy / deploy (push) Successful in 24s
peppa/build build: success за 41с
ci / checks (push) Successful in 1m10s
2026-11-17 18:59:08 +05:00
bf6d444c54 Merge branch 'main' into task/qlfw-46
All checks were successful
peppa/lint lint: success за 2с
peppa/typecheck typecheck: success за 2с
peppa/test test: success за 0с
peppa/build build: success за 42с
ci / checks (pull_request) Successful in 1m13s
deploy / deploy (pull_request) Successful in 19s
2026-11-17 18:54:21 +05:00
54ead3145d QLFW-46: память проекта
All checks were successful
peppa/lint lint: success за 2с
peppa/typecheck typecheck: success за 3с
peppa/test test: success за 1с
peppa/build build: success за 44с
ci / checks (pull_request) Successful in 1m19s
deploy / deploy (pull_request) Successful in 1m53s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 18:50:00 +05:00
245fa0b4aa QLFW-46: фраза согласия без политики, пока её текст не опубликован
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 18:49:56 +05:00
19 changed files with 136 additions and 27 deletions

View File

@ -15,6 +15,7 @@
- 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-46: фраза согласия в ContactForm — form.consent (без политики) или form.consentPolicy{Before,Link,After} (со ссылкой, если isLegalPublished). Общую рабочую копию правят параллельные сессии — работать в git worktree (ln -s node_modules для проверок).
## Грабли
- QLFW-32: страница книги уже была готова (QLFW-8); локальный main может отставать — worktree делать от origin/main после git fetch.

View File

@ -0,0 +1,2 @@
## Решение
В словарь формы добавлены `consent` (без политики) и `consentPolicyBefore/Link/After` (со ссылкой). `ContactForm` выбирает вариант по `privacyLink = isLegalPublished(legal.privacy)`; на казахском фраза со ссылкой перестроена ("… құпиялылық саясатына сәйкес келісемін.").

View File

@ -0,0 +1,7 @@
## Why
Под формой написано «в соответствии с политикой конфиденциальности», хотя текста политики нет: посетитель не может прочитать то, с чем соглашается.
## What Changes
- Пока политика не опубликована, фраза согласия (ru/kk/en) не упоминает политику и не содержит ссылки.
- Когда политика опубликована, фраза содержит ссылку на неё.
- Юридические страницы и так возвращают 404 без полного текста и даты (QLFW-31), служебных пометок на них нет.

View File

@ -0,0 +1,16 @@
## ADDED Requirements
### Requirement: Согласие не отсылает к неопубликованной политике
Фраза согласия под формой SHALL упоминать политику конфиденциальности и ссылаться на неё только когда политика опубликована с полным текстом и датой вступления в силу.
#### Scenario: Политики нет
- **GIVEN** текст политики конфиденциальности не опубликован
- **WHEN** посетитель открывает форму на русском, казахском или английском
- **THEN** фраза согласия не упоминает политику
- **AND** в ней нет ссылки
#### Scenario: Политика опубликована
- **GIVEN** политика опубликована на выбранном языке с датой вступления в силу
- **WHEN** посетитель открывает форму
- **THEN** во фразе согласия есть ссылка на политику
- **AND** она открывает настоящий текст на этом языке

View File

@ -0,0 +1,3 @@
- [x] 1. Тексты согласия без политики и со ссылкой на ru/kk/en
- [x] 2. ContactForm выбирает вариант по публикации политики
- [x] 3. Тест сценариев

View File

@ -0,0 +1 @@
Адреса — в src/lib/book-links.ts. Marwin и «Эрудит» — главные страницы (точные страницы книги не найдены), Flip — страница книги.

View File

@ -0,0 +1,10 @@
## Why
Посетитель должен дойти от карточки книги до покупки: названия магазинов в блоке «Где купить книгу» были простым текстом.
## What Changes
- Marwin, Flip.kz, «Эрудит» — ссылки; «Книжный мир» без ссылки, пока нет подтверждённого адреса.
- Блок одинаков на RU, KK, EN и показан также на странице книги.
- «Подробнее» уже ведёт на /projects/ermek-serkebayev.
## Impact
src/components/BookWhere.tsx, src/lib/book-links.ts, словари.

View File

@ -0,0 +1,3 @@
## 1. Реализация
- [x] 1.1 Ссылки на магазины и блок на странице книги
- [x] 1.2 Тесты

View File

@ -50,3 +50,18 @@ TBD - created by archiving change qlfw-15-contact-form. Update Purpose after arc
- **GIVEN** посетитель открыл блок «Сотрудничество»
- **WHEN** он смотрит под формой
- **THEN** он видит ссылку-почту qazaqlegacy@gmail.com
### Requirement: Согласие не отсылает к неопубликованной политике
Фраза согласия под формой SHALL упоминать политику конфиденциальности и ссылаться на неё только когда политика опубликована с полным текстом и датой вступления в силу.
#### Scenario: Политики нет
- **GIVEN** текст политики конфиденциальности не опубликован
- **WHEN** посетитель открывает форму на русском, казахском или английском
- **THEN** фраза согласия не упоминает политику
- **AND** в ней нет ссылки
#### Scenario: Политика опубликована
- **GIVEN** политика опубликована на выбранном языке с датой вступления в силу
- **WHEN** посетитель открывает форму
- **THEN** во фразе согласия есть ссылка на политику
- **AND** она открывает настоящий текст на этом языке

View File

@ -1,5 +1,6 @@
import { loadLegal } from '@/lib/content'
import { BookLink } from '@/components/BookLink'
import { BookWhere } from '@/components/BookWhere'
import Image from 'next/image'
import Link from 'next/link'
import { notFound } from 'next/navigation'
@ -38,6 +39,7 @@ export default async function BookProject({ params }: { params: Promise<{ locale
{[...t.book.paragraphs, ...t.book.additions].map(text => <p key={text} className="mt-5 leading-relaxed">{text}</p>)}
<p className="mt-6 font-medium">{t.book.organiser}</p>
<BookLink url={bookUrl} t={t.book} />
<BookWhere t={t.book} />
</div>
</article>
<section className="mt-16">

View File

@ -1,5 +1,12 @@
import React from 'react'
import type { Dict } from '@/i18n'
import { bookShopLinks } from '@/lib/book-links'
function Shop({ name }: { name: string }) {
const href = bookShopLinks[name]
if (!href) return <>{name}</>
return <a href={href} target="_blank" rel="noopener noreferrer" className="underline underline-offset-4">{name}</a>
}
export function BookWhere({ t }: { t: Dict['book']; tbc?: string }) {
const buy = t.buy
@ -7,16 +14,15 @@ export function BookWhere({ t }: { t: Dict['book']; tbc?: string }) {
return (
<div className="mt-8">
<h4 className="font-serif text-xl sm:text-2xl">{t.get}</h4>
{(
<>
<p className="mt-3 text-muted">{buy.intro}</p>
<ul className="mt-3 list-disc space-y-1 pl-6 text-muted">
{buy.platforms.map((p) => <li key={p}>{p}</li>)}
</ul>
<p className="mt-3 text-muted">{buy.stores}</p>
<p className="mt-3 text-muted">{buy.note}</p>
</>
)}
<p className="mt-3 text-muted">{buy.intro}</p>
<ul className="mt-3 list-disc space-y-1 pl-6 text-muted">
{buy.platforms.map((p) => <li key={p}><Shop name={p} /></li>)}
</ul>
<p className="mt-3 text-muted">{buy.storesIntro}</p>
<ul className="mt-3 list-disc space-y-1 pl-6 text-muted">
{buy.stores.map((p) => <li key={p}><Shop name={p} /></li>)}
</ul>
<p className="mt-3 text-muted">{buy.note}</p>
</div>
)
}

View File

@ -54,11 +54,13 @@ export function ContactForm({ t, locale, email, dark = false, privacyLink = fals
<label className="flex items-start gap-3 text-sm">
<input name="consent" type="checkbox" required className="mt-1 h-4 w-4 shrink-0 accent-[#7a1f2b]" {...bad('consent')} />
<span>
{f.consent}
{privacyLink
? <Link href={`/${locale}/privacy`} className="underline underline-offset-4 hover:no-underline">{t.legal.consentLink}</Link>
: t.legal.consentLink}
{t.legal.consentAfter}
{privacyLink ? (
<>
{f.consentPolicyBefore}
<Link href={`/${locale}/privacy`} className="underline underline-offset-4 hover:no-underline">{f.consentPolicyLink}</Link>
{f.consentPolicyAfter}
</>
) : f.consent}
</span>
</label>
{err('consent')}

View File

@ -10,20 +10,22 @@ const render = (l: 'ru' | 'kk' | 'en') => {
}
describe('Сценарий: где купить книгу', () => {
it('русский текст целиком, площадки списком без ссылок', () => {
it('русский текст целиком, площадки и магазины списком со ссылками', () => {
const html = render('ru')
expect(html).toContain('Где купить книгу')
expect(html).toContain('можно приобрести онлайн на платформах:')
expect(html).toContain('<li>Marwin</li><li>Flip.kz</li>')
expect(html).toContain('href="https://www.marwin.kz/"')
expect(html).toContain('href="https://www.flip.kz/catalog?prod=6364653')
expect(html).toContain('href="https://erudit.kz/"')
expect(html).toContain('Книжный мир')
expect(html).toContain('<p class="mt-3 text-muted">Наличие и стоимость книги уточняйте непосредственно у продавцов.</p>')
expect(html).not.toContain('<a')
})
it.each(['kk', 'en'] as const)('язык %s: те же магазины, без пометок', (l) => {
const html = render(l)
expect(html).toContain('<li>Marwin</li><li>Flip.kz</li>')
expect(html).toContain('href="https://www.marwin.kz/"')
expect(html).toContain('href="https://www.flip.kz/catalog?prod=6364653')
expect(html).toContain('Эрудит')
expect(html).toContain('Книжный мир')
expect(html).not.toContain(getDict(l).tbc)
expect(html).not.toContain('<a')
})
})

View File

@ -0,0 +1,24 @@
import { createElement } from 'react'
import { renderToStaticMarkup } from 'react-dom/server'
import { describe, expect, it, vi } from 'vitest'
import { getDict } from '@/i18n'
import { ContactForm } from './ContactForm'
vi.mock('@/app/actions/inquiry', () => ({ submitInquiry: async () => ({ status: 'idle' }) }))
const render = (l: 'ru' | 'kk' | 'en', privacyLink: boolean) =>
renderToStaticMarkup(createElement(ContactForm, { t: getDict(l), locale: l, email: 'a@example.com', privacyLink }))
describe('Сценарий: фраза согласия в форме', () => {
it.each(['ru', 'kk', 'en'] as const)('язык %s: политики нет — без упоминания и ссылки', (l) => {
const html = render(l, false)
expect(html).toContain(getDict(l).form.consent)
expect(html).not.toContain('/privacy')
expect(html).not.toMatch(/политик|саясат|policy/i)
})
it.each(['ru', 'kk', 'en'] as const)('язык %s: политика есть — ссылка на неё', (l) => {
const html = render(l, true)
expect(html).toContain(`href="/${l}/privacy"`)
expect(html).toContain(getDict(l).form.consentPolicyLink)
})
})

View File

@ -59,7 +59,7 @@ export const en: Dict = {
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.', emailLabel: 'Email' },
form: {
name: 'Your name', email: 'Email', organization: 'Organization', optional: 'optional', message: 'Your message',
consent: 'I agree to the processing of my personal data in accordance with the ', consentNeed: 'To send the message, please tick the consent box.',
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.',
submit: 'Send message', sending: 'Sending…',
successTitle: 'Message received', successText: 'Thank you! We will read it and reply to the email you gave.', again: 'Write another',
fallback: 'If the form does not work, write to us by email: ',
@ -90,7 +90,8 @@ export const en: Dict = {
"buy": {
"intro": "Irina Serkebayeva’s book “Ermek Serkebayev. И жизнь, и молодость, и счастье. Новые страницы” is available online on these platforms:",
"platforms": ["Marwin", "Flip.kz"],
"stores": "It is also sold in the bookshops “Эрудит” and “Книжный мир”.",
"storesIntro": "It is also sold in the bookshops:",
"stores": ["Эрудит", "Книжный мир"],
"note": "Please check availability and price directly with the sellers."
},
"cover": "Cover",

View File

@ -59,7 +59,7 @@ export const kk: Dict = {
contacts: { title: 'Байланыс', description: 'Qazaq Legacy Foundation қорымен байланысыңыз: өтініш формасы және электрондық пошта.', lead: 'Бізге жазыңыз — өтінішті оқып, көрсеткен поштаңызға жауап береміз.', emailLabel: 'Электрондық пошта' },
form: {
name: 'Атыңыз', email: 'Электрондық пошта', organization: 'Ұйым', optional: 'міндетті емес', message: 'Өтінішіңіз',
consent: 'Жеке деректерімді өңдеуге келісемін: ', consentNeed: 'Өтінішті жіберу үшін келісім белгісі қажет.',
consent: 'Жеке деректерімді өңдеуге келісемін.', consentPolicyBefore: 'Жеке деректерімді өңдеуге ', consentPolicyLink: 'құпиялылық саясатына', consentPolicyAfter: ' сәйкес келісемін.', consentNeed: 'Өтінішті жіберу үшін келісім белгісі қажет.',
submit: 'Өтінішті жіберу', sending: 'Жіберілуде…',
successTitle: 'Өтініш қабылданды', successText: 'Рақмет! Біз оны оқып, көрсеткен поштаңызға жауап береміз.', again: 'Тағы жазу',
fallback: 'Егер форма жұмыс істемесе, бізге поштаға жазыңыз: ',
@ -90,7 +90,8 @@ export const kk: Dict = {
"buy": {
"intro": "Ирина Серкебаеваның «Ермек Серкебаев. И жизнь, и молодость, и счастье. Новые страницы» кітабын онлайн мына платформалардан сатып алуға болады:",
"platforms": ["Marwin", "Flip.kz"],
"stores": "Сондай-ақ «Эрудит» және «Книжный мир» кітап дүкендерінен.",
"storesIntro": "Сондай-ақ кітап дүкендерінен:",
"stores": ["Эрудит", "Книжный мир"],
"note": "Кітаптың бар-жоғы мен бағасын сатушылардан тікелей нақтылаңыз."
},
"cover": "Мұқаба",

View File

@ -59,7 +59,7 @@ export const ru: Dict = {
contacts: { title: 'Контакты', description: 'Свяжитесь с Qazaq Legacy Foundation: форма обращения и электронная почта.', lead: 'Напишите нам — мы прочитаем обращение и ответим на указанную почту.', emailLabel: 'Электронная почта' },
form: {
name: 'Ваше имя', email: 'Электронная почта', organization: 'Организация', optional: 'необязательно', message: 'Ваше обращение',
consent: 'Я согласен(на) на обработку персональных данных в соответствии с ', consentNeed: 'Чтобы отправить обращение, нужна отметка о согласии.',
consent: 'Я согласен(на) на обработку моих персональных данных.', consentPolicyBefore: 'Я согласен(на) на обработку персональных данных в соответствии с ', consentPolicyLink: 'политикой конфиденциальности', consentPolicyAfter: '.', consentNeed: 'Чтобы отправить обращение, нужна отметка о согласии.',
submit: 'Отправить обращение', sending: 'Отправляем…',
successTitle: 'Обращение принято', successText: 'Спасибо! Мы прочитаем его и ответим на указанную вами почту.', again: 'Написать ещё',
fallback: 'Если форма не работает, напишите нам на почту: ',
@ -90,7 +90,8 @@ export const ru: Dict = {
"buy": {
"intro": "Книгу Ирины Серкебаевой «Ермек Серкебаев. И жизнь, и молодость, и счастье. Новые страницы» можно приобрести онлайн на платформах:",
"platforms": ["Marwin", "Flip.kz"],
"stores": "А также в книжных магазинах «Эрудит» и «Книжный мир».",
"storesIntro": "А также в книжных магазинах:",
"stores": ["Эрудит", "Книжный мир"],
"note": "Наличие и стоимость книги уточняйте непосредственно у продавцов."
},
"cover": "Обложка",

View File

@ -13,7 +13,7 @@ export type Dict = {
mission: { title: string; text: string; missing: string }
directions: { title: string; items: { title: string; text: string }[] }
projects: { title: string; more: string }
book: { title: string; author: string; paragraphs: string[]; get: string; getNote: string; buy: { intro: string; platforms: string[]; stores: string; note: string } | null; cover: string; photo: string; role: string; organiser: string; translationReview: string; gallery: string; additions: string[] }
book: { title: string; author: string; paragraphs: string[]; get: string; getNote: string; buy: { intro: string; platforms: string[]; storesIntro: string; stores: string[]; note: string } | null; cover: string; photo: string; role: string; organiser: string; translationReview: string; gallery: string; additions: string[] }
news: { title: string; news: string; event: string }
collaboration: { title: string; text: string; write: string; instagram: string }
contacts: { title: string; description: string; lead: string; emailLabel: string }
@ -24,6 +24,9 @@ export type Dict = {
optional: string
message: string
consent: string
consentPolicyBefore: string
consentPolicyLink: string
consentPolicyAfter: string
consentNeed: string
submit: string
sending: string

9
src/lib/book-links.ts Normal file
View File

@ -0,0 +1,9 @@
import { bookUrl } from './home-model'
/** Адреса магазинов, где продаётся книга. Ключ — название на экране. */
export const bookShopLinks: Record<string, string | null> = {
Marwin: 'https://www.marwin.kz/',
'Flip.kz': bookUrl,
'Эрудит': 'https://erudit.kz/',
'Книжный мир': null, // адрес не подтверждён — показываем без ссылки
}