From 14cd0fd636345be75c73ad69a40d76addb7bc0b0 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 23 Nov 2026 14:32:33 +0800 Subject: [PATCH] =?UTF-8?q?fix(annual):=20the=20page=20after=20the=20start?= =?UTF-8?q?=20overlay=20shows=20the=20written=20year=20as=20a=20row=20to?= =?UTF-8?q?=20open=20and=20=E3=80=8C=E5=86=8D=E5=86=99=E4=B8=80=E4=BB=BD?= =?UTF-8?q?=E3=80=8D=20with=20its=20price,=20or=20what=20the=20year=20cove?= =?UTF-8?q?rs;=20no=20=E3=80=8C=E5=B7=B2=E7=BB=8F=E5=86=99=E8=BF=87?= =?UTF-8?q?=E4=B8=80=E4=BB=BD=E3=80=8D=20line=20anywhere=20(BUG-2254)?= 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_01DbBXp2U3BH1SxwAGyhhbe1 --- docs/BUG_HISTORY.md | 9 ++++ frontend/src/app/annual-report.css | 5 ++- .../components/annual/annual-report-page.tsx | 43 +++++++++++-------- frontend/tests/annual-new-run-1637.test.tsx | 11 +++-- .../tests/annual-overlay-polish-2052.test.tsx | 12 +++--- frontend/tests/annual-two-step-2047.test.tsx | 4 +- 6 files changed, 50 insertions(+), 34 deletions(-) diff --git a/docs/BUG_HISTORY.md b/docs/BUG_HISTORY.md index a9bddf4e9..5decea9c1 100644 --- a/docs/BUG_HISTORY.md +++ b/docs/BUG_HISTORY.md @@ -30289,3 +30289,12 @@ - 修复:侧栏展开时,账户栏右端显示「N 点」(小号、浅色、等宽数字),读屏读「余额 N 点」;侧栏收起时不显示。菜单里原来那一行保留。 - 验证:类型检查与侧栏相关测试。 - 修复版本:`claude/ui-items-2250`。 + +## BUG-2254 | 年运页关掉开始弹窗后只有一行「已经写过一份」和一个按钮 + +- 状态:fixed-pending-verify。 +- 现象:产品负责人 2026-11-23 手机截图:年运页(开始弹窗关掉后)标题下是「这一年已经写过一份,再写一份会另扣 50 点。看上次那份」和一个「开始写年运」按钮,下面整屏空白,要求优化。 +- 修复:写过的,上一份做成报告中心「年运」那样的一行入口(图标、「这一年的年运」、「已经写好」和日期、「打开」),「再写一份」是次要按钮,价格句在按钮下;没写过的,「这一年的年运还没有写」下列出这份年运写什么(开始弹窗同一组说明),再是「开始写年运」和价格句。开始弹窗第二步也删去「已经写过一份…看上次那份」(同 BUG-2252 的规则),`againLine` 删除。 +- 验证与防复发:`annual-overlay-polish-2052`(写过:入口行、「再写一份」、价格句,无「已经写过一份 / 看上次那份」)、`annual-two-step-2047`、`annual-new-run-1637`。 +- 关联记录:BUG-2052、BUG-2252、BUG-1637。 +- 修复版本:`claude/ui-items-2250`。 diff --git a/frontend/src/app/annual-report.css b/frontend/src/app/annual-report.css index 42bcc89eb..4e7f92335 100644 --- a/frontend/src/app/annual-report.css +++ b/frontend/src/app/annual-report.css @@ -264,8 +264,9 @@ .annual-veil-actions .annual-start-button { min-width: 168px; } /* BUG-2052: the page with the overlay put away — range, title, one line, the button at its normal size. */ .annual-empty { gap: var(--space-4); } -.annual-empty-actions { display: flex; } -.annual-empty a { color: var(--color-action); } +/* BUG-2254: the button with its price line under it, left-aligned. */ +.annual-empty-actions { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); } +.annual-empty a:not(.report-center-annual) { color: var(--color-action); } /* Option B (2026-11-05): the range is three single-choice cards. */ .annual-kind-field { display: flex; flex-direction: column; gap: var(--space-2); } .annual-kind-legend { color: var(--color-ink-secondary); font-size: 13px; } diff --git a/frontend/src/components/annual/annual-report-page.tsx b/frontend/src/components/annual/annual-report-page.tsx index 879d9b58f..b6be74f0f 100644 --- a/frontend/src/components/annual/annual-report-page.tsx +++ b/frontend/src/components/annual/annual-report-page.tsx @@ -12,7 +12,7 @@ */ import { useCallback, useEffect, useRef, useState, type ReactNode, type RefObject } from "react"; -import { X } from "lucide-react"; +import { ChevronRight, FileText, X } from "lucide-react"; import { AppLink } from "@/components/app-link"; import { BirthPlacePicker } from "@/components/birth-place-picker"; @@ -301,10 +301,6 @@ export function birthNotice(subject: AnnualOverview["subject"]): { text: string } /** A finished report for this range exists: a new run is another charge (BUG-1637). */ -export function againLine(creditCost: number | null): string { - return creditCost === null ? "这一年已经写过一份,再写一份会另外计费。" : `这一年已经写过一份,再写一份会另扣 ${creditCost} 点。`; -} - /** One wording for every start card (BUG-2046): lib/report-start-copy.ts. */ export function priceLine(creditCost: number | null): string { return reportPriceLine(creditCost); @@ -545,12 +541,7 @@ export function AnnualOverlay(props: Readonly<{ {props.error.billing ? <> 去补点数 : null}

) :

{priceLine(overview.creditCost)}

} - {overview.existing?.status === "ready" ? ( -

- {againLine(overview.creditCost)} - {" "}看上次那份 -

- ) : null} + {/* BUG-2254 (产品负责人 2026-11-23,同 BUG-2252): 原值「这一年已经写过一份,再写一份会另扣 N 点。看上次那份」. */} )} @@ -959,25 +950,39 @@ export const ANNUAL_EMPTY_LINE = "这一年的年运还没有写。"; * BUG-2052: the page after the start overlay is put away. It used to be the loading * skeleton with a large solid button floating above it, which read as a page that had * not finished loading. Skeleton bars are for loading and writing only. + * + * BUG-2254 (产品负责人 2026-11-23 手机截图): 原值是标题下一行「这一年已经写过一份,再写一份会另扣 N 点。看上次那份」 + * 加一个按钮,下面大片空白。现在:写过的,上一份是报告中心那样的一行入口(点开就看),「再写一份」退为次要按钮; + * 没写过的,列出这份年运写什么,再是开始按钮。价格在按钮下面,和开始弹窗同一句。 */ export function AnnualEmpty({ overview, onStart }: Readonly<{ overview: AnnualOverview; onStart: () => void }>) { - const written = overview.existing?.status === "ready"; + const written = overview.existing?.status === "ready" ? overview.existing : null; return (

{overview.range.start} 到 {overview.range.end}

{overview.subject.name}的这一年

- {written && overview.existing ? ( -

- {againLine(overview.creditCost)} - {" "}看上次那份 -

+ {written ? ( + + + + 这一年的年运 + 已经写好,{overview.range.start} 到 {overview.range.end} + + + ) : ( -

{ANNUAL_EMPTY_LINE}

+ <> +

{ANNUAL_EMPTY_LINE}

+ {overview.notes.length ? ( +
    {overview.notes.map((note) =>
  • {note}
  • )}
+ ) : null} + )}
- + +

{priceLine(overview.creditCost)}

); diff --git a/frontend/tests/annual-new-run-1637.test.tsx b/frontend/tests/annual-new-run-1637.test.tsx index 5d5dedb46..629a2d776 100644 --- a/frontend/tests/annual-new-run-1637.test.tsx +++ b/frontend/tests/annual-new-run-1637.test.tsx @@ -2,7 +2,6 @@ import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; import test from "node:test"; -import { againLine } from "../src/components/annual/annual-report-page.tsx"; // BUG-1637(2026-11-05 产品:「这个年运点击的话是新生成,历史的从过往里看,不应该点击之后直接返回上一个已生成的」)。 @@ -14,13 +13,13 @@ test("年运 opens on a new run; only a run still being written opens by itself" assert.doesNotMatch(page, /setReportId\(next\.existing\?\.id \?\? null\)/); }); -test("a finished year does not block a new run, and the start card says it costs again", () => { +// BUG-2254: 原值: 开始卡多一行「这一年已经写过一份,再写一份会另扣 N 点。看上次那份」;新值: 不写这一行, +// 关掉开始卡后的页面里上一份是一行入口;原因: 产品负责人 2026-11-23(同 BUG-2252)。 +test("a finished year does not block a new run; the last one is a row to open, not an extra price line", () => { const server = read("../src/lib/annual-report-server.ts"); assert.match(server, /if \(existing\?\.status === "generating"\) \{/); assert.doesNotMatch(server, /if \(existing\) \{\n\s+\/\/ An already written/); - assert.equal(againLine(20), "这一年已经写过一份,再写一份会另扣 20 点。"); - assert.equal(againLine(null), "这一年已经写过一份,再写一份会另外计费。"); const page = read("../src/components/annual/annual-report-page.tsx"); - assert.match(page, /\{overview\.existing\?\.status === "ready" \? \(/); - assert.match(page, /看上次那份<\/AppLink>/); + assert.doesNotMatch(page, />看上次那份<|againLine\(/, "the 原值 comments may still name the old line"); + assert.match(page, /]*>点数不够。/); assert.match(failed, /去补点数/); assert.ok(!failed.includes(priceLine(50)), "the error stands where the price line stood"); - assert.ok(failed.includes(againLine(50))); assert.match(css, /\.annual-veil-foot \.annual-error \{ font-size: var\(--type-caption\); \}/); }); @@ -136,8 +134,12 @@ test("with the overlay put away the page is a calm empty state, not a skeleton u assert.doesNotMatch(fresh, /annual-shimmer|is-skeleton/); const again = renderToStaticMarkup(createElement(AnnualEmpty, { overview: overview(true), onStart: noop })); - assert.ok(again.includes(againLine(50))); - assert.match(again, /看上次那份/); + // BUG-2254: the last year is a row to open, and a new run is the quieter button with its price under it. + assert.match(again, /class="report-center-annual"[^>]*href="\/reports\/annual\?report=|href="\/reports\/annual\?report=[^"]*"[^>]*class="report-center-annual"/); + assert.match(again, />这一年的年运再写一份<\/button>/); + assert.ok(again.includes(priceLine(50))); + assert.doesNotMatch(again, /已经写过一份|看上次那份/); assert.ok(!again.includes(ANNUAL_EMPTY_LINE)); // The page shows it in place of the skeleton; the reopen strip is gone. diff --git a/frontend/tests/annual-two-step-2047.test.tsx b/frontend/tests/annual-two-step-2047.test.tsx index 06edfb195..e8f4ad2bc 100644 --- a/frontend/tests/annual-two-step-2047.test.tsx +++ b/frontend/tests/annual-two-step-2047.test.tsx @@ -222,8 +222,8 @@ test("without onClose and onSkip the overlay offers neither (the old one-way ove assert.doesNotMatch(second, /]*>点数不够。/); assert.doesNotMatch(renderToStaticMarkup(createElement(AnnualOverlay, { ...props, error: { message: "点数不够。", billing: true } })), /点数不够/);