From 309e57496f1901719d1be4dcc3417dbdd59594cd Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 23 Nov 2026 15:04:04 +0800 Subject: [PATCH] =?UTF-8?q?fix(ui):=20title-bar=20buttons=20are=20one=20bo?= =?UTF-8?q?rderless=20style=20=E2=80=94=20=E6=8F=90=E9=97=AE=20and=20?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=20icon-only=20on=20phones=20with=20a=20count?= =?UTF-8?q?=20badge,=20=E4=B8=AD=20|=20EN=20switch,=20=E9=82=A3=E4=B8=80?= =?UTF-8?q?=E5=88=BB=E7=9A=84=E5=A4=A9=E7=A9=BA=20ghost=20(BUG-2258)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8 --- docs/BUG_HISTORY.md | 19 ++++ frontend/src/app/globals.css | 89 ++++++++++----- .../components/birth-sky/birth-sky-entry.tsx | 5 +- .../personal-report/report-actions.tsx | 66 ++++++++--- .../report-ask/report-ask-entry.tsx | 11 +- .../synastry/synastry-report-view.tsx | 10 +- ...icker-inspector-skeleton-20261102.test.tsx | 3 +- .../chat-chart-panel-compact-20261102.test.ts | 4 +- ...er-pills-and-quiet-cards-20261102.test.tsx | 6 +- .../tests/language-switch-selected.test.tsx | 24 ++-- frontend/tests/personal-report-view.test.ts | 10 +- .../tests/report-english-edition.test.tsx | 4 +- .../report-language-switch-20260930.test.tsx | 6 +- frontend/tests/report-questions-2081.test.tsx | 9 +- .../synastry-report-followups-2082.test.tsx | 19 ++-- .../tests/title-bar-buttons-2258.test.tsx | 107 ++++++++++++++++++ 16 files changed, 307 insertions(+), 85 deletions(-) create mode 100644 frontend/tests/title-bar-buttons-2258.test.tsx diff --git a/docs/BUG_HISTORY.md b/docs/BUG_HISTORY.md index 517d518d4..d98206275 100644 --- a/docs/BUG_HISTORY.md +++ b/docs/BUG_HISTORY.md @@ -30328,3 +30328,22 @@ - 验证与防复发:`tests/test_acceptance_1123_facts.py::test_report_reading_addresses_the_subject_as_you_2255`;需下一份别人档案的报告确认。已生成的那份没有重写。 - 关联记录:#228、BUG-2246。 - 修复版本:`claude/ui-items-2250`。 + + +## BUG-2258 | 报告标题栏三个按钮各一种样式:圆框提问、椭圆描边「中文 / English」、方框「导出」 + +- 状态:fixed-pending-verify(分支 `claude/header-buttons-2258`,未推送;staging 真机未看) +- 首次发现 / 最近更新:2026-11-23(负责人手机截图:「标题栏上面的聊天按钮、语言切换按钮和导出按钮三个样式太丑了」,要求语言切换改成「中 EN」;原型方案 A 获批「同意 a」)/ 2026-11-23 +- 影响面:个人报告、合盘报告、年运页的标题栏(提问、语言切换、导出),星盘页标题栏「那一刻的天空」。对话页右上角的星盘按钮本来就是无边框图标,未改;导出抽屉里的「中文 / English」分段在抽屉内有空间,保持全称未改。 +- 现象:手机上标题栏右侧依次是带圆框的提问图标、椭圆描边的「中文 | English」(选中项陶土描边)、带方框的「⬇ 导出」,三种边框、三种高度;星盘页「那一刻的天空」是陶土淡底胶囊,又是第四种。 +- 根因:样式逐个加出来,没有共用规则:提问用了正文「就这一节提问」的描边胶囊 `button.report-ask-entry`(BUG-2081);导出 2026-09-29 为了「找得到」改成 `variant="outline"` 带字;语言切换是独立的描边胶囊(`.report-language-switch`);「那一刻的天空」是 `variant="secondary"` 加强调色淡底(`.birth-sky-entry`)。 +- 修复: + - 新增共用的 `.title-bar-button`(`frontend/src/app/globals.css` 末尾):无边框、透明底,取顶栏统一的控件高度 `--chat-header-pill`(画 34px,`::after` 补到 ≥44px 点按区),18px 图标,悬停灰底。宽屏图标后带字;加 `.title-bar-icon-on-phone` 的按钮在 ≤640px 只留图标,提问的数字变成右上角小角标(`--color-action-fill` 底、`--color-on-action-fill` 字)。 + - `ReportAskPageEntry`(提问)、`ReportExportButton`(导出)改用 ghost + 上述类名,字放进 `title-bar-button-word`;读取全文时导出显示转圈图标,读屏名为「正在读取全文」。 + - 新增 `ReportLanguageSwitch`:个人报告和合盘报告共用,中英两版都显示「中 | EN」,读屏仍读「中文 / English」;样式为浅灰底小分段,选中项白底加粗,不再用陶土描边。 + - `BirthSkyEntry`:`variant="secondary"` → ghost + `.title-bar-button`,保留星座图标和「那一刻的天空」字样。 + - 删除不再需要的 CSS:`.birth-sky-entry` 淡底胶囊、手机 `button.report-ask-page-entry` 规则、406 / 360 宽以下逐个收窄按钮和藏导出图标的三条容器规则、≤767px 语言切换高度规则。 +- 验证:新增 `frontend/tests/title-bar-buttons-2258.test.tsx` 5 条(三个按钮同一类名且不是 outline / secondary;手机只留图标的范围;提问数字角标与读屏名;导出忙碌状态;「中 | EN」两版标签与读屏全称;CSS 无边框、控件高度变量、≥44px 点按区、手机角标、灰底分段与白底加粗选中、旧规则已删;年运只有提问和导出)。按「原值 / 新值 / 原因」更新:`language-switch-selected`(报告语言、合盘语言选中项改认白底加粗)、`synastry-report-followups-2082`(中EN、导出字在 span 里、容器规则数 6→5)、`report-questions-2081`、`chat-header-pills-and-quiet-cards-20261102`、`chat-chart-panel-compact-20261102`、`chart-picker-inspector-skeleton-20261102`(`.birth-sky-entry` → `.title-bar-button`)。截图(静态渲染 + Tailwind 编译的同一份样式表,390 / 1280,浅色 / 深色):`/tmp/claude-1000/-workspace-Jyotisha/7126d641-2604-4494-9ed5-fc1a6a545e81/scratchpad/shots2258/`。 +- 防复发:标题栏里的新按钮一律用 `.title-bar-button`(需要手机只留图标时加 `.title-bar-icon-on-phone` 并给 `aria-label`);回归测试钉住三个入口不能回到 outline / secondary。 +- 关联记录:BUG-2081(页面级提问入口)、BUG-2082(标题栏随版本换语言、窄栏让位)、BUG-2093、BUG-2138(导出读取全文)、2026-11-02 顶栏控件 34px 规则。 +- 修复版本:分支 `claude/header-buttons-2258`(待父会话推送)。 diff --git a/frontend/src/app/globals.css b/frontend/src/app/globals.css index 9610841b1..73c660002 100644 --- a/frontend/src/app/globals.css +++ b/frontend/src/app/globals.css @@ -4930,11 +4930,6 @@ input:not([type="radio"]):not([type="checkbox"]):not([class^="ant-"]):not([class 430px phone, 360 a 384px one.) */ @container (max-width: 406px) { .chat-header.is-title-yielding .personal-report-action-end { gap: var(--space-1); } - .chat-header.is-title-yielding .report-language-switch button { padding: 0 var(--space-2); } - .chat-header.is-title-yielding .personal-report-action-end > [data-slot="button"] { padding: 0 var(--space-2); } -} -@container (max-width: 360px) { - .chat-header.is-title-yielding .personal-report-action-end > [data-slot="button"]:last-child > svg { display: none; } } @media (max-width: 480px) { .chat-header.is-title-yielding { gap: var(--space-2); } @@ -5384,9 +5379,13 @@ input:not([type="radio"]):not([type="checkbox"]):not([class^="ant-"]):not([class .personal-report-back:hover { color: var(--color-ink); background: var(--color-canvas-muted); } .personal-report-action-end { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: var(--space-3); } /* 中文 | English: a two-segment switch in the reader's action bar, only on reports with both editions. */ -.report-language-switch { display: inline-flex; padding: 2px; border: 1px solid var(--color-border); border-radius: 999px; background: var(--color-canvas); } -.report-language-switch button { min-height: 40px; min-width: 64px; padding: 0 var(--space-3); border: 0; border-radius: 999px; background: transparent; color: var(--color-ink-secondary); font: inherit; font-size: var(--type-body-sm); cursor: pointer; } -.report-language-switch button:is([data-active], [aria-selected="true"]) { background: transparent; color: var(--color-action); font-weight: 600; box-shadow: inset 0 0 0 1px var(--color-action-strong); } +/* BUG-2258 (owner 2026-11-23, option A): 中 | EN on a light grey track; the shown edition is white + and bold. 原值: 描边胶囊,「中文 / English」,选中项陶土描边 / 新值: 灰底小分段、白底加粗 / 原因: 标题栏按钮样式统一。 + The track takes the bar's control height; the segments get a 44px touch height back through ::after. */ +.report-language-switch { display: inline-flex; height: var(--chat-header-pill, 34px); padding: 2px; border: 0; border-radius: 9px; background: var(--color-canvas-muted); } +.report-language-switch button { position: relative; height: 100%; min-height: 0; min-width: 36px; padding: 0 var(--space-2); border: 0; border-radius: 7px; background: transparent; color: var(--color-ink-secondary); font: inherit; font-size: var(--type-body-sm); line-height: 1; cursor: pointer; } +.report-language-switch button::after { position: absolute; inset: -7px 0; content: ""; } +.report-language-switch button:is([data-active], [aria-selected="true"]) { background: var(--color-canvas); color: var(--color-ink); font-weight: 600; box-shadow: 0 1px 2px color-mix(in srgb, var(--color-ink) 12%, transparent); } .report-language-switch button:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; } .personal-report-action-end > span { max-width: 440px; @@ -5687,8 +5686,6 @@ button.report-ask-clear:hover { color: var(--color-ink); } .report-ask-compose .composer { width: 100%; box-shadow: none; } /* BUG-2081: in a narrow panel the notice wraps; the chat page's one-line ellipsis cut it at 360. */ .report-ask-compose .composer-ai-notice { width: 100%; margin: 0; overflow: visible; text-overflow: clip; white-space: normal; } -/* BUG-2081: the page-level entry in the title bar; on a phone the word goes and the icon with the count stays. */ -@media (max-width: 640px) { button.report-ask-page-entry { padding: 0 10px; } .report-ask-page-entry-word { display: none; } } .report-ask-short { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; color: var(--color-ink); font-size: 16px; line-height: 1.6; } .report-ask-short a { color: var(--color-action); } .report-ask-sheet[data-slot="drawer-popup"] { height: min(72vh, 620px); padding: 10px 0 0; border-color: var(--color-border); border-radius: 20px 20px 0 0; background: var(--color-canvas); } @@ -6293,7 +6290,6 @@ button.report-ask-clear:hover { color: var(--color-ink); } .personal-report-back { padding: 0 var(--space-2); min-width: 44px; justify-content: center; } .personal-report-back-label { display: none; } .personal-report-action-end { flex-wrap: nowrap; gap: var(--space-2); } - .report-language-switch button { min-height: 36px; min-width: 0; padding: 0 var(--space-3); } .personal-report-action-end > [data-slot="button"] { height: 40px; padding: 0 var(--space-3); } .personal-report-action-end > span { display: none; } .personal-report-document { margin-top: var(--space-5); padding: var(--space-6) var(--space-4) var(--space-5); } @@ -6780,21 +6776,6 @@ button.report-ask-clear:hover { color: var(--color-ink); } .chart-page-skeleton .personal-report-chart-cell, .chart-page-skeleton .chart-skeleton-sector { animation: none; fill-opacity: 0; } } -/* 「那一刻的天空」: the chart header's one extra action, tinted with the accent and - a sparkle so it reads as an invitation rather than a thin outline (2026-09-29). - A 12% mix keeps it light in both themes (not the --color-action-soft block, BUG-1078). */ -.birth-sky-entry[data-slot="button"] { - height: var(--chat-header-pill, 34px); - min-height: var(--chat-header-pill, 34px); - padding: 0 16px; - border-radius: 999px; - background: color-mix(in srgb, var(--color-action) 12%, transparent); - color: var(--color-action); - font-size: var(--type-body-sm); - font-weight: 600; -} -.birth-sky-entry[data-slot="button"]:hover { background: color-mix(in srgb, var(--color-action) 20%, transparent); } -.birth-sky-entry svg { width: 16px; height: 16px; } .chart-page-vedic-stage { position: relative; background: var(--color-canvas); @@ -8696,3 +8677,59 @@ button.report-ask-clear:hover { color: var(--color-ink); } .redeem-success-ok { margin-top: 6px; border-radius: 999px; padding: 9px 26px; } @keyframes redeem-success-pop { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } } /* the centring lives in Tailwind's separate `translate` property */ @media (prefers-reduced-motion: reduce) { .redeem-success-dialog { animation: none; } } + +/* BUG-2258 (owner 2026-11-23, option A): every button in a page title bar — 提问, 导出, 那一刻的天空 — + is borderless, at the bar's one control height (--chat-header-pill, 34px drawn, ≥44px to touch + through ::after, like the person chip and the chart toggle), with an 18px icon; the 中 | EN switch sits beside them. Wider screens + show the word after the icon; on a phone 提问 and 导出 keep only the icon, and 提问's count becomes + a small badge. 原值: 圆框提问、椭圆描边语言、方框导出、陶土淡底「那一刻的天空」/ 新值: 同一种无边框按钮 / + 原因: 标题栏三个按钮各一种样式,负责人说太丑。Placed last so the older header rules (32px + .chat-header-actions buttons, 14–16px icons) do not win. */ +.chat-header-actions .title-bar-button[data-slot="button"], +.title-bar-button[data-slot="button"] { + position: relative; + height: var(--chat-header-pill, 34px); + min-height: var(--chat-header-pill, 34px); + gap: 6px; + padding: 0 10px; + border: 0; + border-radius: var(--radius-md); + background: transparent; + box-shadow: none; + color: var(--color-ink); + font-size: var(--type-body-sm); + font-weight: 500; + white-space: nowrap; +} +.chat-header-actions .title-bar-button[data-slot="button"]:hover:not(:disabled), +.title-bar-button[data-slot="button"]:hover:not(:disabled) { background: var(--color-canvas-muted); color: var(--color-ink); } +.title-bar-button[data-slot="button"]::after { position: absolute; inset: -5px 0; content: ""; } +.chat-header-actions .title-bar-button[data-slot="button"] > svg, +.title-bar-button[data-slot="button"] > svg { width: 18px; height: 18px; color: currentColor; } +.title-bar-count { color: var(--color-action); font-weight: 600; font-variant-numeric: tabular-nums; } +.title-bar-spin { animation: title-bar-spin 1s linear infinite; } +@keyframes title-bar-spin { to { transform: rotate(360deg); } } +@media (prefers-reduced-motion: reduce) { .title-bar-spin { animation: none; } } +.personal-report-header-actions .personal-report-action-end { gap: var(--space-1); } +@media (max-width: 640px) { + .chat-header-actions .title-bar-icon-on-phone[data-slot="button"], + .title-bar-icon-on-phone[data-slot="button"] { width: var(--chat-header-pill, 34px); padding: 0; } + .chat-header-actions .title-bar-icon-on-phone[data-slot="button"]::after, + .title-bar-icon-on-phone[data-slot="button"]::after { inset: -5px -4px; } + .title-bar-icon-on-phone .title-bar-button-word { display: none; } + .title-bar-icon-on-phone .title-bar-count { + position: absolute; + top: -4px; + right: -6px; + min-width: 16px; + height: 16px; + padding: 0 4px; + box-sizing: border-box; + border-radius: 8px; + background: var(--color-action-fill); + color: var(--color-on-action-fill); + font-size: 11px; + line-height: 16px; + text-align: center; + } +} diff --git a/frontend/src/components/birth-sky/birth-sky-entry.tsx b/frontend/src/components/birth-sky/birth-sky-entry.tsx index 32a754874..97e3cf665 100644 --- a/frontend/src/components/birth-sky/birth-sky-entry.tsx +++ b/frontend/src/components/birth-sky/birth-sky-entry.tsx @@ -20,13 +20,16 @@ export const BIRTH_SKY_ENTRY_LABEL = "那一刻的天空"; * replay opens the moment it arrives — no spinner in between; the replay's own * convergence is the wait. The replay is a lazy chunk and every open plays it * again (TASK-mobile-chart-and-confirmed-edit-20260929 M4). + * + * BUG-2258 (owner 2026-11-23): borderless like every title-bar button. 原值: variant="secondary" + * 加陶土淡底胶囊 / 新值: ghost + title-bar-button,图标加字 / 原因: 标题栏按钮统一一种样式。 */ export function BirthSkyEntry({ cover }: { cover: BirthSkyCover | null }) { const [wanted, setWanted] = useState(false); const open = wanted && cover !== null; return ( <> - diff --git a/frontend/src/components/personal-report/report-actions.tsx b/frontend/src/components/personal-report/report-actions.tsx index c0018f50e..1aa8a5c7d 100644 --- a/frontend/src/components/personal-report/report-actions.tsx +++ b/frontend/src/components/personal-report/report-actions.tsx @@ -6,7 +6,7 @@ import { useMemo, useState, type ReactNode } from "react"; import Link from "next/link"; -import { ArrowLeft, Download } from "lucide-react"; +import { ArrowLeft, Download, LoaderCircle } from "lucide-react"; import type { BirthInputState } from "@/lib/birth-input-revision"; import type { ReportBirthScenario, ReportBirthTimeNote, ReportBirthWindow } from "@/lib/report-birth-marking"; @@ -55,16 +55,58 @@ export const REPORT_ACTIONS_TEXT = { en: { actions: "Report actions", languageSwitch: "Report language", preparing: "Loading the full text", prepareFailed: "The full report did not finish loading. Check the network and export again.", exportLabel: "Export", exportAria: "Export report" }, } as const; +/** + * BUG-2258 (owner 2026-11-23, option A): a title-bar button like the others there — borderless, + * 40px, the download icon; the word 「导出」 shows on wider screens and the phone keeps the icon. + * 原值: variant="outline",图标加字,手机上也有边框和字 / 新值: ghost + title-bar-button,手机只留图标 / + * 原因: 标题栏三个按钮各一种样式(圆框、椭圆描边、方框),负责人说太丑。 + */ export function ReportExportButton({ onClick, language = "zh", busy = false }: { onClick: () => void; language?: ReportLanguage; busy?: boolean }) { const text = REPORT_ACTIONS_TEXT[language]; return ( - ); } +/** BUG-2258: the language switch reads 中 | EN in either edition; screen readers hear the full names. */ +export const REPORT_LANGUAGE_SWITCH_LABELS = { + zh: { short: "中", full: "中文" }, + en: { short: "EN", full: "English" }, +} as const; + +/** BUG-2258: the title bar's 中 | EN switch, shared by the personal and the pair report. */ +export function ReportLanguageSwitch({ value, label, onChange }: Readonly<{ + value: ReportLanguage; + label: string; + onChange: (language: ReportLanguage) => void; +}>) { + return ( + { + if (next === "zh" || next === "en") onChange(next); + }} + > + + {REPORT_LANGUAGE_SWITCH_LABELS.zh.short} + {REPORT_LANGUAGE_SWITCH_LABELS.en.short} + + + ); +} + export function ReportActions({ markdown, prepare, @@ -113,21 +155,9 @@ export function ReportActions({
{askEntry} {/* Only reports that carry an English edition show the switch (2026-09-29). */} - {canSwitch && ( - { - if (value === "zh" || value === "en") onLanguageChange(value); - }} - > - - 中文 - English - - - )} - {/* Labelled, outlined and full height (2026-09-29): the icon-only ghost - button it replaces was the one control people could not find. */} + {canSwitch && } + {/* BUG-2258: borderless like the other title-bar buttons; the word shows beside the icon + on wider screens (2026-09-29 had made it outlined so it could be found). */} {editions && ( void; }>) { - // On a phone the title bar is full: the word is dropped there and the icon (with the count) stays. const label = count > 0 ? text.asked(count) : text.askReport; return ( - ); } diff --git a/frontend/src/components/synastry/synastry-report-view.tsx b/frontend/src/components/synastry/synastry-report-view.tsx index 8ebe271cf..23cb76248 100644 --- a/frontend/src/components/synastry/synastry-report-view.tsx +++ b/frontend/src/components/synastry/synastry-report-view.tsx @@ -7,14 +7,13 @@ import { SYNASTRY_ENTERED_TIME_ZH, SYNASTRY_TRIAL_TIME_ZH, synastryAnalysisReaderText, synastryAuditReaderCell, synastrySoReaderText, synastryTechnicalReaderText, } from "@/lib/synastry-analysis-reader"; -import { ReportExportButton } from "@/components/personal-report/report-actions"; +import { ReportExportButton, ReportLanguageSwitch } from "@/components/personal-report/report-actions"; import { ReportExportDrawer } from "@/components/personal-report/report-export-drawer"; import { exportPairName } from "@/lib/report-export-blocks"; import { notifyInfo } from "@/lib/notify"; import { useCallback, useEffect, useRef, useState, type ReactNode } from "react"; import { SynastryWait } from "@/components/synastry/synastry-wait"; -import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { ReportAskEntry, ReportAskPageEntry } from "@/components/report-ask/report-ask-entry"; import { ReportAskPanel, ReportAskSheet } from "@/components/report-ask/report-ask-panel"; import { ReportAskSelection } from "@/components/report-ask/report-ask-selection"; @@ -418,12 +417,7 @@ export function SynastryReportView(props: { {waiting ? null : ( startAsk(null)} /> )} - { if (next === "en") showEnglish(); else setLanguage("zh"); }}> - - 中文 - English - - + { if (next === "en") showEnglish(); else setLanguage("zh"); }} /> {waiting ? null : setExporting(true)} />}
diff --git a/frontend/tests/chart-picker-inspector-skeleton-20261102.test.tsx b/frontend/tests/chart-picker-inspector-skeleton-20261102.test.tsx index c825cb13e..9251f4b01 100644 --- a/frontend/tests/chart-picker-inspector-skeleton-20261102.test.tsx +++ b/frontend/tests/chart-picker-inspector-skeleton-20261102.test.tsx @@ -122,7 +122,8 @@ test("the chart page header uses the chat's two-line chip, as tall as 「那一 assert.doesNotMatch(renderToStaticMarkup(), /is-chip/); // 原值:`var(--chat-header-pill, 44px)`;新值:后备值 34px,和顶栏变量一致 // 原因:2026-11-02 产品:顶栏胶囊太高、边框贴到顶栏上下边,画出来改成 34px - assert.match(cssDeclarations('.birth-sky-entry[data-slot="button"]', globalStyles), /height: var\(--chat-header-pill, 34px\)/); + // 原值(2):'.birth-sky-entry[data-slot="button"]' / 新值(2):'.title-bar-button[data-slot="button"]' / 原因(2):BUG-2258 标题栏按钮统一 + assert.match(cssDeclarations('.title-bar-button[data-slot="button"]', globalStyles), /height: var\(--chat-header-pill, 34px\)/); assert.match(cssDeclarations(".chat-profile-picker-trigger.is-chip", globalStyles), /height: var\(--chat-header-pill\)/); }); diff --git a/frontend/tests/chat-chart-panel-compact-20261102.test.ts b/frontend/tests/chat-chart-panel-compact-20261102.test.ts index 952bfb9ed..5b9e12e8b 100644 --- a/frontend/tests/chat-chart-panel-compact-20261102.test.ts +++ b/frontend/tests/chat-chart-panel-compact-20261102.test.ts @@ -14,7 +14,9 @@ test("top-bar pills draw at 34px inside the bar and keep a 44px touch target", ( assert.match(cssDeclarations(".chat-header", globals), /--chat-header-pill: 34px/); // The bar is 46px (52px on a phone): 34px leaves air above and below every pill. assert.match(cssDeclarations(".chat-panel", globals), /grid-template-rows: 46px/); - for (const selector of [".chat-profile-picker-trigger.is-chip", '.birth-sky-entry[data-slot="button"]', ".chat-header-actions button.chat-chart-toggle"]) { + // 原值:'.birth-sky-entry[data-slot="button"]' / 新值:'.title-bar-button[data-slot="button"]' + // 原因:BUG-2258「那一刻的天空」与报告标题栏的提问、导出共用一种无边框按钮 + for (const selector of [".chat-profile-picker-trigger.is-chip", '.title-bar-button[data-slot="button"]', ".chat-header-actions button.chat-chart-toggle"]) { assert.match(cssDeclarations(selector, globals), /(^|[;\s])height: var\(--chat-header-pill/, selector); } // 34px + 2 × 5px = 44px for the chip; 34px + 2 × 6px for the other actions. diff --git a/frontend/tests/chat-header-pills-and-quiet-cards-20261102.test.tsx b/frontend/tests/chat-header-pills-and-quiet-cards-20261102.test.tsx index fd76af1d0..a0322d2d1 100644 --- a/frontend/tests/chat-header-pills-and-quiet-cards-20261102.test.tsx +++ b/frontend/tests/chat-header-pills-and-quiet-cards-20261102.test.tsx @@ -109,7 +109,11 @@ test("the person chip takes the one top-bar height token, desktop and phone", () assert.doesNotMatch(globalStyles, /credit-balance/); assert.match(cssDeclarations(".chat-header-actions button::after", globalStyles), /inset: -6px/); assert.equal((globalStyles.match(/--chat-header-pill:/g) ?? []).length, 1); - assert.match(cssDeclarations('.birth-sky-entry[data-slot="button"]', globalStyles), /min-height:\s*var\(--chat-header-pill, 34px\)/); + // 原值(4):.birth-sky-entry[data-slot="button"] 取这个变量(陶土淡底胶囊,类名随之删掉) + // 新值(4):「那一刻的天空」和报告标题栏的提问、导出共用 .title-bar-button,仍取这个变量 + // 原因(4):BUG-2258 负责人要标题栏按钮统一成无边框一种样式 + assert.match(cssDeclarations('.title-bar-button[data-slot="button"]', globalStyles), /min-height:\s*var\(--chat-header-pill, 34px\)/); + assert.match(cssDeclarations('.report-language-switch', globalStyles), /height:\s*var\(--chat-header-pill, 34px\)/); const chip = ".chat-profile-picker-trigger.is-chip"; for (const selector of [chip]) { const body = cssDeclarations(selector, globalStyles); diff --git a/frontend/tests/language-switch-selected.test.tsx b/frontend/tests/language-switch-selected.test.tsx index 8e4330964..180258106 100644 --- a/frontend/tests/language-switch-selected.test.tsx +++ b/frontend/tests/language-switch-selected.test.tsx @@ -91,7 +91,13 @@ function matchesSelector(node: Node, selector: string): boolean { return true; } -function themeRules() { +// BUG-2258 (owner 2026-11-23, option A): the title bar's 中 | EN shows its selected edition as a +// white, bold segment on a grey track, not with the accent. 原值: 只认 --color-action(-strong) 的选中规则 / +// 新值: 报告语言认白底(--color-canvas)加粗的选中规则,另外两组仍认强调色 / 原因: 标题栏按钮统一样式。 +const ACCENT_BODY = /--color-action-strong|--color-action\b/; +const WHITE_SEGMENT_BODY = /background:\s*var\(--color-canvas\)[\s\S]*font-weight:\s*600/; + +function themeRules(body: RegExp = ACCENT_BODY) { const clean = css.replace(/\/\*[\s\S]*?\*\//g, " "); const rules: { selector: string; body: string }[] = []; for (const hit of clean.matchAll(/([^{}@]+)\{([^{}]*)\}/g)) { @@ -100,7 +106,7 @@ function themeRules() { rules.push({ selector, body: hit[2] }); } return rules.filter((rule) => /\[data-active\]|\[aria-selected="true"\]/.test(rule.selector) - && /--color-action-strong|--color-action\b/.test(rule.body)); + && body.test(rule.body)); } /** The pair report with a stand-in for the title bar's actions slot (BUG-2080). */ @@ -118,15 +124,15 @@ function PairReportWithBar() { ); } -function hitsTheme(node: Node): boolean { - return themeRules().some((rule) => splitTop(rule.selector).some((selector) => matchesSelector(node, selector.trim()))); +function hitsTheme(node: Node, body?: RegExp): boolean { + return themeRules(body).some((rule) => splitTop(rule.selector).some((selector) => matchesSelector(node, selector.trim()))); } function tabsIn(nodes: Node[], owner: Node) { return nodes.filter((node) => node.getAttribute("role") === "tab" && owner.contains(node)); } -function pair(nodes: Node[], owner: Node, label: string) { +function pair(nodes: Node[], owner: Node, label: string, body?: RegExp) { const tabs = tabsIn(nodes, owner); const selected = tabs.find((node) => node.getAttribute("aria-selected") === "true"); const unselected = tabs.find((node) => node.getAttribute("aria-selected") === "false"); @@ -139,8 +145,8 @@ function pair(nodes: Node[], owner: Node, label: string) { `${unselected.getAttribute("class")}|${unselected.getAttribute("aria-selected")}|${unselected.hasAttribute("data-active")}`, `${label} class or attribute`, ); - assert.equal(hitsTheme(selected), true, `${label} theme rule`); - assert.equal(hitsTheme(unselected), false, `${label} unselected theme rule`); + assert.equal(hitsTheme(selected, body), true, `${label} theme rule`); + assert.equal(hitsTheme(unselected, body), false, `${label} unselected theme rule`); } test("the three language switches and the export scope card show which one is selected", async () => { @@ -176,7 +182,7 @@ test("the three language switches and the export scope card show which one is se assert.ok(found, label); return found; }; - pair(nodes, list("报告语言"), "报告语言"); + pair(nodes, list("报告语言"), "报告语言", WHITE_SEGMENT_BODY); pair(nodes, list("导出语言"), "导出语言"); pair(nodes, list("导出范围"), "导出范围"); // 原值: 按 class synastry-lang 在报告正文里找 @@ -184,7 +190,7 @@ test("the three language switches and the export scope card show which one is se // 原因: BUG-2080 合盘的语言切换和导出移到标题栏 const synastry = nodes.find((node) => node.getAttribute("id") === "pair-report-actions"); assert.ok(synastry, "合盘语言"); - pair(nodes, synastry, "合盘语言"); + pair(nodes, synastry, "合盘语言", WHITE_SEGMENT_BODY); assert.equal(harness.errors.length, 0, harness.errors.map(String).join("\n")); } finally { await harness.close(); diff --git a/frontend/tests/personal-report-view.test.ts b/frontend/tests/personal-report-view.test.ts index b7479c0f0..8f3afedcf 100644 --- a/frontend/tests/personal-report-view.test.ts +++ b/frontend/tests/personal-report-view.test.ts @@ -172,17 +172,21 @@ test("ready reports expose only the back link and accessible export icon", () => // 新值:不再是图标按钮(doesNotMatch size="icon"),可见文字「导出」,描边样式 // 原因:TASK-report-reader-polish-20260929 §3-3——图标按钮太不显眼,产品要求做明显 assert.doesNotMatch(actionsSource, /size="icon"/); - assert.match(actionsSource, /variant="outline"/); + // 原值(2):variant="outline" / 新值(2):标题栏统一的无边框按钮(ghost + title-bar-button),宽屏仍有字「导出」 + // 原因(2):BUG-2258 负责人:标题栏三个按钮样式不一太丑,方案 A + assert.match(actionsSource, /variant="ghost"\s+className="title-bar-button title-bar-icon-on-phone"/); // 原值: 源码里是