Compare commits
5 Commits
494cfeda5a
...
d972b920ca
| Author | SHA1 | Date | |
|---|---|---|---|
| d972b920ca | |||
| 08e2cb0ed5 | |||
| ecc93c4ed2 | |||
| 136ad2ab24 | |||
| 92b48a7e8a |
@ -17,6 +17,7 @@
|
||||
- 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-55: руководство фонда — глобал Payload `foundation` (имена без перевода, роль chair/member; подписи в i18n sections), значения по умолчанию в src/lib/foundation-people.ts; миграция написана вручную (SQL). Общая плашка «перевод на проверке» на kk/en — на всю страницу, не на блоки. В macOS sed -i требует суффикс — правки файлов с [locale] делать через python.
|
||||
- QLFW-44: ссылки магазинов в BookWhere — карта storeUrls; Flip.kz = bookUrl, Marwin = marwinUrl (src/lib/home-model.ts, пусто → просто название); при пустом адресе ссылка не показывается.
|
||||
|
||||
## Грабли
|
||||
- QLFW-32: страница книги уже была готова (QLFW-8); локальный main может отставать — worktree делать от origin/main после git fetch.
|
||||
|
||||
@ -1 +0,0 @@
|
||||
Адреса — в src/lib/book-links.ts. Marwin и «Эрудит» — главные страницы (точные страницы книги не найдены), Flip — страница книги.
|
||||
@ -1,10 +0,0 @@
|
||||
## Why
|
||||
Посетитель должен дойти от карточки книги до покупки: названия магазинов в блоке «Где купить книгу» были простым текстом.
|
||||
|
||||
## What Changes
|
||||
- Marwin, Flip.kz, «Эрудит» — ссылки; «Книжный мир» без ссылки, пока нет подтверждённого адреса.
|
||||
- Блок одинаков на RU, KK, EN и показан также на странице книги.
|
||||
- «Подробнее» уже ведёт на /projects/ermek-serkebayev.
|
||||
|
||||
## Impact
|
||||
src/components/BookWhere.tsx, src/lib/book-links.ts, словари.
|
||||
@ -1,3 +0,0 @@
|
||||
## 1. Реализация
|
||||
- [x] 1.1 Ссылки на магазины и блок на странице книги
|
||||
- [x] 1.2 Тесты
|
||||
@ -1,4 +0,0 @@
|
||||
## Why
|
||||
ПМ прислал адрес страницы книги на Marwin; в main стояла главная страница магазина (QLFW-50).
|
||||
## What
|
||||
Marwin в book-links ведёт на страницу книги.
|
||||
@ -1 +0,0 @@
|
||||
- [x] адрес, тест
|
||||
4
openspec/changes/qlfw-44-store-links/proposal.md
Normal file
4
openspec/changes/qlfw-44-store-links/proposal.md
Normal file
@ -0,0 +1,4 @@
|
||||
## Why
|
||||
Marwin и Flip.kz в «Где купить книгу» были просто словами.
|
||||
## What
|
||||
Flip.kz — ссылка (новая вкладка) на страницу книги на всех языках. Marwin — ссылка на страницу книги (`marwinUrl` в home-model; если пуст — показывается название). Фраза про наличие и стоимость не менялась.
|
||||
1
openspec/changes/qlfw-44-store-links/tasks.md
Normal file
1
openspec/changes/qlfw-44-store-links/tasks.md
Normal file
@ -0,0 +1 @@
|
||||
- [x] ссылки, тест
|
||||
@ -1,6 +1,5 @@
|
||||
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'
|
||||
@ -39,7 +38,6 @@ 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">
|
||||
|
||||
@ -1,12 +1,8 @@
|
||||
import React from 'react'
|
||||
import type { Dict } from '@/i18n'
|
||||
import { bookShopLinks } from '@/lib/book-links'
|
||||
import { bookUrl, marwinUrl } from '@/lib/home-model'
|
||||
|
||||
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>
|
||||
}
|
||||
const storeUrls: Record<string, string> = { Marwin: marwinUrl, 'Flip.kz': bookUrl }
|
||||
|
||||
export function BookWhere({ t }: { t: Dict['book']; tbc?: string }) {
|
||||
const buy = t.buy
|
||||
@ -16,12 +12,16 @@ export function BookWhere({ t }: { t: Dict['book']; tbc?: string }) {
|
||||
<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}><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>)}
|
||||
{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>
|
||||
)
|
||||
|
||||
@ -2,30 +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, '&')}" target="_blank" rel="noopener noreferrer" class="underline">${name}</a>`
|
||||
|
||||
describe('Сценарий: где купить книгу', () => {
|
||||
it('русский текст целиком, площадки и магазины списком со ссылками', () => {
|
||||
const html = render('ru')
|
||||
expect(html).toContain('Где купить книгу')
|
||||
expect(html).toContain('можно приобрести онлайн на платформах:')
|
||||
expect(html).toContain('href="https://www.marwin.kz/product/serkebaeva-i-ermek-serkebaev-i-zhizn-i-molodost-i-schaste-220988"')
|
||||
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>')
|
||||
})
|
||||
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('href="https://www.marwin.kz/product/serkebaeva-i-ermek-serkebaev-i-zhizn-i-molodost-i-schaste-220988"')
|
||||
expect(html).toContain('href="https://www.flip.kz/catalog?prod=6364653')
|
||||
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)
|
||||
})
|
||||
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>')
|
||||
})
|
||||
})
|
||||
|
||||
@ -90,8 +90,7 @@ export const en: Dict = {
|
||||
"buy": {
|
||||
"intro": "Irina Serkebayeva’s book “Ermek Serkebayev. И жизнь, и молодость, и счастье. Новые страницы” is available online on these platforms:",
|
||||
"platforms": ["Marwin", "Flip.kz"],
|
||||
"storesIntro": "It is also sold in the bookshops:",
|
||||
"stores": ["Эрудит", "Книжный мир"],
|
||||
"stores": "It is also sold in the bookshops “Эрудит” and “Книжный мир”.",
|
||||
"note": "Please check availability and price directly with the sellers."
|
||||
},
|
||||
"cover": "Cover",
|
||||
|
||||
@ -90,8 +90,7 @@ export const kk: Dict = {
|
||||
"buy": {
|
||||
"intro": "Ирина Серкебаеваның «Ермек Серкебаев. И жизнь, и молодость, и счастье. Новые страницы» кітабын онлайн мына платформалардан сатып алуға болады:",
|
||||
"platforms": ["Marwin", "Flip.kz"],
|
||||
"storesIntro": "Сондай-ақ кітап дүкендерінен:",
|
||||
"stores": ["Эрудит", "Книжный мир"],
|
||||
"stores": "Сондай-ақ «Эрудит» және «Книжный мир» кітап дүкендерінен.",
|
||||
"note": "Кітаптың бар-жоғы мен бағасын сатушылардан тікелей нақтылаңыз."
|
||||
},
|
||||
"cover": "Мұқаба",
|
||||
|
||||
@ -90,8 +90,7 @@ export const ru: Dict = {
|
||||
"buy": {
|
||||
"intro": "Книгу Ирины Серкебаевой «Ермек Серкебаев. И жизнь, и молодость, и счастье. Новые страницы» можно приобрести онлайн на платформах:",
|
||||
"platforms": ["Marwin", "Flip.kz"],
|
||||
"storesIntro": "А также в книжных магазинах:",
|
||||
"stores": ["Эрудит", "Книжный мир"],
|
||||
"stores": "А также в книжных магазинах «Эрудит» и «Книжный мир».",
|
||||
"note": "Наличие и стоимость книги уточняйте непосредственно у продавцов."
|
||||
},
|
||||
"cover": "Обложка",
|
||||
|
||||
@ -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[]; storesIntro: 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[]; 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 }
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
import { bookUrl } from './home-model'
|
||||
|
||||
/** Адреса магазинов, где продаётся книга. Ключ — название на экране. */
|
||||
export const bookShopLinks: Record<string, string | null> = {
|
||||
Marwin: 'https://www.marwin.kz/product/serkebaeva-i-ermek-serkebaev-i-zhizn-i-molodost-i-schaste-220988',
|
||||
'Flip.kz': bookUrl,
|
||||
'Эрудит': 'https://erudit.kz/',
|
||||
'Книжный мир': null, // адрес не подтверждён — показываем без ссылки
|
||||
}
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user