Compare commits
3 Commits
d972b920ca
...
494cfeda5a
| Author | SHA1 | Date | |
|---|---|---|---|
| 494cfeda5a | |||
| cbf31dbb59 | |||
| 1102a55010 |
@ -17,7 +17,6 @@
|
|||||||
- QLFW-52: люди и партнёры страницы «О фонде» — src/lib/about-model.ts (по языкам, пока пусто); блок виден только при непустом списке.
|
- 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-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-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.
|
- QLFW-32: страница книги уже была готова (QLFW-8); локальный main может отставать — worktree делать от origin/main после git fetch.
|
||||||
|
|||||||
@ -0,0 +1 @@
|
|||||||
|
Адреса — в src/lib/book-links.ts. Marwin и «Эрудит» — главные страницы (точные страницы книги не найдены), Flip — страница книги.
|
||||||
@ -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, словари.
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
## 1. Реализация
|
||||||
|
- [x] 1.1 Ссылки на магазины и блок на странице книги
|
||||||
|
- [x] 1.2 Тесты
|
||||||
4
openspec/changes/qlfw-44-marwin-product-link/proposal.md
Normal file
4
openspec/changes/qlfw-44-marwin-product-link/proposal.md
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
## Why
|
||||||
|
ПМ прислал адрес страницы книги на Marwin; в main стояла главная страница магазина (QLFW-50).
|
||||||
|
## What
|
||||||
|
Marwin в book-links ведёт на страницу книги.
|
||||||
1
openspec/changes/qlfw-44-marwin-product-link/tasks.md
Normal file
1
openspec/changes/qlfw-44-marwin-product-link/tasks.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
- [x] адрес, тест
|
||||||
@ -1,4 +0,0 @@
|
|||||||
## Why
|
|
||||||
Marwin и Flip.kz в «Где купить книгу» были просто словами.
|
|
||||||
## What
|
|
||||||
Flip.kz — ссылка (новая вкладка) на страницу книги на всех языках. Marwin — ссылка на страницу книги (`marwinUrl` в home-model; если пуст — показывается название). Фраза про наличие и стоимость не менялась.
|
|
||||||
@ -1 +0,0 @@
|
|||||||
- [x] ссылки, тест
|
|
||||||
@ -1,5 +1,6 @@
|
|||||||
import { loadLegal } from '@/lib/content'
|
import { loadLegal } from '@/lib/content'
|
||||||
import { BookLink } from '@/components/BookLink'
|
import { BookLink } from '@/components/BookLink'
|
||||||
|
import { BookWhere } from '@/components/BookWhere'
|
||||||
import Image from 'next/image'
|
import Image from 'next/image'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { notFound } from 'next/navigation'
|
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>)}
|
{[...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>
|
<p className="mt-6 font-medium">{t.book.organiser}</p>
|
||||||
<BookLink url={bookUrl} t={t.book} />
|
<BookLink url={bookUrl} t={t.book} />
|
||||||
|
<BookWhere t={t.book} />
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
<section className="mt-16">
|
<section className="mt-16">
|
||||||
|
|||||||
@ -1,8 +1,12 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import type { Dict } from '@/i18n'
|
import type { Dict } from '@/i18n'
|
||||||
import { bookUrl, marwinUrl } from '@/lib/home-model'
|
import { bookShopLinks } from '@/lib/book-links'
|
||||||
|
|
||||||
const storeUrls: Record<string, string> = { Marwin: marwinUrl, 'Flip.kz': bookUrl }
|
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 }) {
|
export function BookWhere({ t }: { t: Dict['book']; tbc?: string }) {
|
||||||
const buy = t.buy
|
const buy = t.buy
|
||||||
@ -12,16 +16,12 @@ export function BookWhere({ t }: { t: Dict['book']; tbc?: string }) {
|
|||||||
<h4 className="font-serif text-xl sm:text-2xl">{t.get}</h4>
|
<h4 className="font-serif text-xl sm:text-2xl">{t.get}</h4>
|
||||||
<p className="mt-3 text-muted">{buy.intro}</p>
|
<p className="mt-3 text-muted">{buy.intro}</p>
|
||||||
<ul className="mt-3 list-disc space-y-1 pl-6 text-muted">
|
<ul className="mt-3 list-disc space-y-1 pl-6 text-muted">
|
||||||
{buy.platforms.map((p) => {
|
{buy.platforms.map((p) => <li key={p}><Shop name={p} /></li>)}
|
||||||
const href = storeUrls[p]
|
</ul>
|
||||||
return (
|
<p className="mt-3 text-muted">{buy.storesIntro}</p>
|
||||||
<li key={p}>
|
<ul className="mt-3 list-disc space-y-1 pl-6 text-muted">
|
||||||
{href ? <a href={href} target="_blank" rel="noopener noreferrer" className="underline">{p}</a> : p}
|
{buy.stores.map((p) => <li key={p}><Shop name={p} /></li>)}
|
||||||
</li>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
</ul>
|
</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.note}</p>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -2,33 +2,30 @@ import { createElement } from 'react'
|
|||||||
import { renderToStaticMarkup } from 'react-dom/server'
|
import { renderToStaticMarkup } from 'react-dom/server'
|
||||||
import { describe, expect, it } from 'vitest'
|
import { describe, expect, it } from 'vitest'
|
||||||
import { getDict } from '@/i18n'
|
import { getDict } from '@/i18n'
|
||||||
import { bookUrl, marwinUrl } from '@/lib/home-model'
|
|
||||||
import { BookWhere } from './BookWhere'
|
import { BookWhere } from './BookWhere'
|
||||||
|
|
||||||
const render = (l: 'ru' | 'kk' | 'en') => {
|
const render = (l: 'ru' | 'kk' | 'en') => {
|
||||||
const d = getDict(l)
|
const d = getDict(l)
|
||||||
return renderToStaticMarkup(createElement(BookWhere, { t: d.book, tbc: d.tbc }))
|
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('Сценарий: где купить книгу', () => {
|
describe('Сценарий: где купить книгу', () => {
|
||||||
it.each(['ru', 'kk', 'en'] as const)('язык %s: Marwin и Flip.kz — ссылки в новой вкладке, без пометок', (l) => {
|
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) => {
|
||||||
const html = render(l)
|
const html = render(l)
|
||||||
expect(html).toContain(link(marwinUrl, 'Marwin'))
|
expect(html).toContain('href="https://www.marwin.kz/product/serkebaeva-i-ermek-serkebaev-i-zhizn-i-molodost-i-schaste-220988"')
|
||||||
expect(html).toContain(link(bookUrl, 'Flip.kz'))
|
expect(html).toContain('href="https://www.flip.kz/catalog?prod=6364653')
|
||||||
expect(html).toContain('Эрудит')
|
expect(html).toContain('Эрудит')
|
||||||
expect(html).toContain('Книжный мир')
|
expect(html).toContain('Книжный мир')
|
||||||
expect(html).not.toContain(getDict(l).tbc)
|
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,7 +90,8 @@ export const en: Dict = {
|
|||||||
"buy": {
|
"buy": {
|
||||||
"intro": "Irina Serkebayeva’s book “Ermek Serkebayev. И жизнь, и молодость, и счастье. Новые страницы” is available online on these platforms:",
|
"intro": "Irina Serkebayeva’s book “Ermek Serkebayev. И жизнь, и молодость, и счастье. Новые страницы” is available online on these platforms:",
|
||||||
"platforms": ["Marwin", "Flip.kz"],
|
"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."
|
"note": "Please check availability and price directly with the sellers."
|
||||||
},
|
},
|
||||||
"cover": "Cover",
|
"cover": "Cover",
|
||||||
|
|||||||
@ -90,7 +90,8 @@ export const kk: Dict = {
|
|||||||
"buy": {
|
"buy": {
|
||||||
"intro": "Ирина Серкебаеваның «Ермек Серкебаев. И жизнь, и молодость, и счастье. Новые страницы» кітабын онлайн мына платформалардан сатып алуға болады:",
|
"intro": "Ирина Серкебаеваның «Ермек Серкебаев. И жизнь, и молодость, и счастье. Новые страницы» кітабын онлайн мына платформалардан сатып алуға болады:",
|
||||||
"platforms": ["Marwin", "Flip.kz"],
|
"platforms": ["Marwin", "Flip.kz"],
|
||||||
"stores": "Сондай-ақ «Эрудит» және «Книжный мир» кітап дүкендерінен.",
|
"storesIntro": "Сондай-ақ кітап дүкендерінен:",
|
||||||
|
"stores": ["Эрудит", "Книжный мир"],
|
||||||
"note": "Кітаптың бар-жоғы мен бағасын сатушылардан тікелей нақтылаңыз."
|
"note": "Кітаптың бар-жоғы мен бағасын сатушылардан тікелей нақтылаңыз."
|
||||||
},
|
},
|
||||||
"cover": "Мұқаба",
|
"cover": "Мұқаба",
|
||||||
|
|||||||
@ -90,7 +90,8 @@ export const ru: Dict = {
|
|||||||
"buy": {
|
"buy": {
|
||||||
"intro": "Книгу Ирины Серкебаевой «Ермек Серкебаев. И жизнь, и молодость, и счастье. Новые страницы» можно приобрести онлайн на платформах:",
|
"intro": "Книгу Ирины Серкебаевой «Ермек Серкебаев. И жизнь, и молодость, и счастье. Новые страницы» можно приобрести онлайн на платформах:",
|
||||||
"platforms": ["Marwin", "Flip.kz"],
|
"platforms": ["Marwin", "Flip.kz"],
|
||||||
"stores": "А также в книжных магазинах «Эрудит» и «Книжный мир».",
|
"storesIntro": "А также в книжных магазинах:",
|
||||||
|
"stores": ["Эрудит", "Книжный мир"],
|
||||||
"note": "Наличие и стоимость книги уточняйте непосредственно у продавцов."
|
"note": "Наличие и стоимость книги уточняйте непосредственно у продавцов."
|
||||||
},
|
},
|
||||||
"cover": "Обложка",
|
"cover": "Обложка",
|
||||||
|
|||||||
@ -13,7 +13,7 @@ export type Dict = {
|
|||||||
mission: { title: string; text: string; missing: string }
|
mission: { title: string; text: string; missing: string }
|
||||||
directions: { title: string; items: { title: string; text: string }[] }
|
directions: { title: string; items: { title: string; text: string }[] }
|
||||||
projects: { title: string; more: 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 }
|
news: { title: string; news: string; event: string }
|
||||||
collaboration: { title: string; text: string; write: string; instagram: string }
|
collaboration: { title: string; text: string; write: string; instagram: string }
|
||||||
contacts: { title: string; description: string; lead: string; emailLabel: string }
|
contacts: { title: string; description: string; lead: string; emailLabel: string }
|
||||||
|
|||||||
9
src/lib/book-links.ts
Normal file
9
src/lib/book-links.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
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,8 +21,6 @@ export type HomeModel = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const foundationEmail = 'qazaqlegacy@gmail.com'
|
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'
|
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)
|
const clean = (v?: string | null) => (v && v.trim() ? v.trim() : null)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user