Compare commits

...

6 Commits

Author SHA1 Message Date
8cef63c8b6 Merge branch 'main' into task/qlfw-44
All checks were successful
peppa/lint lint: success за 2с
peppa/typecheck typecheck: success за 3с
peppa/test test: success за 1с
peppa/build build: success за 49с
ci / checks (pull_request) Successful in 1m24s
deploy / deploy (pull_request) Successful in 2m7s
2026-11-17 18:55:03 +05:00
66b180ebca QLFW-44: тесты ссылок на магазины
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 1m16s
deploy / deploy (pull_request) Successful in 2m6s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 18:49:53 +05:00
c372aba83d QLFW-44: тесты ссылок Marwin и Flip.kz
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 18:49:52 +05:00
88d9b1fc6a QLFW-44: адрес Marwin
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 18:49:52 +05:00
9b2e888b84 QLFW-44: память проекта
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 18:49:52 +05:00
3226ce7e4d QLFW-44: ссылки на Flip.kz и Marwin в «Где купить книгу»
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 18:49:49 +05:00
6 changed files with 40 additions and 21 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-44: ссылки магазинов в BookWhere — карта storeUrls; Flip.kz = bookUrl, Marwin = marwinUrl (src/lib/home-model.ts, пусто → просто название); при пустом адресе ссылка не показывается.
## Грабли
- QLFW-32: страница книги уже была готова (QLFW-8); локальный main может отставать — worktree делать от origin/main после git fetch.

View File

@ -0,0 +1,4 @@
## Why
Marwin и Flip.kz в «Где купить книгу» были просто словами.
## What
Flip.kz — ссылка (новая вкладка) на страницу книги на всех языках. Marwin — ссылка на страницу книги (`marwinUrl` в home-model; если пуст — показывается название). Фраза про наличие и стоимость не менялась.

View File

@ -0,0 +1 @@
- [x] ссылки, тест

View File

@ -1,5 +1,8 @@
import React from 'react'
import type { Dict } from '@/i18n'
import { bookUrl, marwinUrl } from '@/lib/home-model'
const storeUrls: Record<string, string> = { Marwin: marwinUrl, 'Flip.kz': bookUrl }
export function BookWhere({ t }: { t: Dict['book']; tbc?: string }) {
const buy = t.buy
@ -7,16 +10,19 @@ 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) => {
const href = storeUrls[p]
return (
<li key={p}>
{href ? <a href={href} target="_blank" rel="noopener noreferrer" className="underline">{p}</a> : p}
</li>
)
})}
</ul>
<p className="mt-3 text-muted">{buy.stores}</p>
<p className="mt-3 text-muted">{buy.note}</p>
</div>
)
}

View File

@ -2,28 +2,33 @@ import { createElement } from 'react'
import { renderToStaticMarkup } from 'react-dom/server'
import { describe, expect, it } from 'vitest'
import { getDict } from '@/i18n'
import { bookUrl, marwinUrl } from '@/lib/home-model'
import { BookWhere } from './BookWhere'
const render = (l: 'ru' | 'kk' | 'en') => {
const d = getDict(l)
return renderToStaticMarkup(createElement(BookWhere, { t: d.book, tbc: d.tbc }))
}
const link = (href: string, name: string) =>
`<a href="${href.replace(/&/g, '&amp;')}" target="_blank" rel="noopener noreferrer" class="underline">${name}</a>`
describe('Сценарий: где купить книгу', () => {
it('русский текст целиком, площадки списком без ссылок', () => {
const html = render('ru')
expect(html).toContain('Где купить книгу')
expect(html).toContain('можно приобрести онлайн на платформах:')
expect(html).toContain('<li>Marwin</li><li>Flip.kz</li>')
expect(html).toContain('<p class="mt-3 text-muted">Наличие и стоимость книги уточняйте непосредственно у продавцов.</p>')
expect(html).not.toContain('<a')
})
it.each(['kk', 'en'] as const)('язык %s: те же магазины, без пометок', (l) => {
it.each(['ru', 'kk', 'en'] as const)('язык %s: Marwin и Flip.kz — ссылки в новой вкладке, без пометок', (l) => {
const html = render(l)
expect(html).toContain('<li>Marwin</li><li>Flip.kz</li>')
expect(html).toContain(link(marwinUrl, 'Marwin'))
expect(html).toContain(link(bookUrl, 'Flip.kz'))
expect(html).toContain('Эрудит')
expect(html).toContain('Книжный мир')
expect(html).not.toContain(getDict(l).tbc)
expect(html).not.toContain('<a')
})
it('русский текст: подпись и фраза про наличие на месте', () => {
const html = render('ru')
expect(html).toContain('Где купить книгу')
expect(html).toContain('Наличие и стоимость книги уточняйте непосредственно у продавцов.')
})
it('без адреса магазина ссылка не показывается, название остаётся', () => {
const d = getDict('ru')
const html = renderToStaticMarkup(createElement(BookWhere, { t: { ...d.book, buy: { ...d.book.buy!, platforms: ['Неизвестный'] } } }))
expect(html).toContain('<li>Неизвестный</li>')
})
})

View File

@ -21,6 +21,8 @@ export type HomeModel = {
}
export const foundationEmail = 'qazaqlegacy@gmail.com'
// Адрес книги на Marwin; если пусто — ссылка не показывается.
export const marwinUrl = 'https://www.marwin.kz/product/serkebaeva-i-ermek-serkebaev-i-zhizn-i-molodost-i-schaste-220988'
export const bookUrl = 'https://www.flip.kz/catalog?prod=6364653&utm_source=ig&utm_medium=social&utm_content=link_in_bio'
const clean = (v?: string | null) => (v && v.trim() ? v.trim() : null)