diff --git a/openspec/changes/qlfw-44-store-links/proposal.md b/openspec/changes/qlfw-44-store-links/proposal.md new file mode 100644 index 0000000..522cf38 --- /dev/null +++ b/openspec/changes/qlfw-44-store-links/proposal.md @@ -0,0 +1,4 @@ +## Why +Marwin и Flip.kz в «Где купить книгу» были просто словами. +## What +Flip.kz — ссылка (новая вкладка) на страницу книги на всех языках. Адреса Marwin в проекте нет: `marwinUrl` в home-model пуст, пока пуст — показывается просто название. Фраза про наличие и стоимость не менялась. diff --git a/openspec/changes/qlfw-44-store-links/tasks.md b/openspec/changes/qlfw-44-store-links/tasks.md new file mode 100644 index 0000000..b9b0464 --- /dev/null +++ b/openspec/changes/qlfw-44-store-links/tasks.md @@ -0,0 +1 @@ +- [x] ссылки, тест diff --git a/src/components/BookWhere.tsx b/src/components/BookWhere.tsx index 9623265..f0371b9 100644 --- a/src/components/BookWhere.tsx +++ b/src/components/BookWhere.tsx @@ -1,5 +1,8 @@ import React from 'react' import type { Dict } from '@/i18n' +import { bookUrl, marwinUrl } from '@/lib/home-model' + +const storeUrls: Record = { 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 (

{t.get}

- {( - <> -

{buy.intro}

- -

{buy.stores}

-

{buy.note}

- - )} +

{buy.intro}

+ +

{buy.stores}

+

{buy.note}

) } diff --git a/src/components/book-where.test.ts b/src/components/book-where.test.ts index afb3bc7..10f44c0 100644 --- a/src/components/book-where.test.ts +++ b/src/components/book-where.test.ts @@ -2,6 +2,7 @@ import { createElement } from 'react' import { renderToStaticMarkup } from 'react-dom/server' import { describe, expect, it } from 'vitest' import { getDict } from '@/i18n' +import { bookUrl } from '@/lib/home-model' import { BookWhere } from './BookWhere' const render = (l: 'ru' | 'kk' | 'en') => { @@ -10,20 +11,21 @@ const render = (l: 'ru' | 'kk' | 'en') => { } describe('Сценарий: где купить книгу', () => { - it('русский текст целиком, площадки списком без ссылок', () => { + it('русский текст целиком, Flip.kz — ссылка в новой вкладке, Marwin без адреса — просто текст', () => { const html = render('ru') expect(html).toContain('Где купить книгу') expect(html).toContain('можно приобрести онлайн на платформах:') - expect(html).toContain('
  • Marwin
  • Flip.kz
  • ') + expect(html).toContain('
  • Marwin
  • ') + expect(html).toContain(`Flip.kz`) expect(html).toContain('

    Наличие и стоимость книги уточняйте непосредственно у продавцов.

    ') - expect(html).not.toContain(' { const html = render(l) - expect(html).toContain('
  • Marwin
  • Flip.kz
  • ') + expect(html).toContain('
  • Marwin
  • ') + expect(html).toContain('target="_blank"') + expect(html).toContain('>Flip.kz') expect(html).toContain('Эрудит') expect(html).toContain('Книжный мир') expect(html).not.toContain(getDict(l).tbc) - expect(html).not.toContain(' (v && v.trim() ? v.trim() : null)