From 768c41c699fdb255a2a6a4cbd9849e97c6d959b5 Mon Sep 17 00:00:00 2001 From: Peppa Date: Tue, 17 Nov 2026 18:35:22 +0500 Subject: [PATCH] =?UTF-8?q?QLFW-44:=20=D1=81=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= =?UTF-8?q?=20=D0=BD=D0=B0=20Flip.kz=20=D0=B8=20Marwin=20=D0=B2=20=C2=AB?= =?UTF-8?q?=D0=93=D0=B4=D0=B5=20=D0=BA=D1=83=D0=BF=D0=B8=D1=82=D1=8C=20?= =?UTF-8?q?=D0=BA=D0=BD=D0=B8=D0=B3=D1=83=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 --- .../changes/qlfw-44-store-links/proposal.md | 4 +++ openspec/changes/qlfw-44-store-links/tasks.md | 1 + src/components/BookWhere.tsx | 26 ++++++++++++------- src/components/book-where.test.ts | 12 +++++---- src/lib/home-model.ts | 2 ++ 5 files changed, 30 insertions(+), 15 deletions(-) create mode 100644 openspec/changes/qlfw-44-store-links/proposal.md create mode 100644 openspec/changes/qlfw-44-store-links/tasks.md 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.platforms.map((p) =>
  • {p}
  • )} -
-

{buy.stores}

-

{buy.note}

- - )} +

{buy.intro}

+
    + {buy.platforms.map((p) => { + const href = storeUrls[p] + return ( +
  • + {href ? {p} : p} +
  • + ) + })} +
+

{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)