fix(annual): the page after the start overlay shows the written year as a row to open and 「再写一份」 with its price, or what the year covers; no 「已经写过一份」 line anywhere (BUG-2254)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXp2U3BH1SxwAGyhhbe1
This commit is contained in:
@@ -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`。
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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 ? <> <BillingDialogLink>去补点数</BillingDialogLink></> : null}
|
||||
</p>
|
||||
) : <p className="annual-price">{priceLine(overview.creditCost)}</p>}
|
||||
{overview.existing?.status === "ready" ? (
|
||||
<p className="annual-price">
|
||||
{againLine(overview.creditCost)}
|
||||
{" "}<AppLink href={`/reports/annual?report=${encodeURIComponent(overview.existing.id)}`}>看上次那份</AppLink>
|
||||
</p>
|
||||
) : null}
|
||||
{/* BUG-2254 (产品负责人 2026-11-23,同 BUG-2252): 原值「这一年已经写过一份,再写一份会另扣 N 点。看上次那份」. */}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -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 (
|
||||
<section className="annual-report annual-empty" aria-labelledby="annual-empty-title">
|
||||
<header className="annual-report-head">
|
||||
<p className="annual-range">{overview.range.start} 到 {overview.range.end}</p>
|
||||
<h2 id="annual-empty-title">{overview.subject.name}的这一年</h2>
|
||||
</header>
|
||||
{written && overview.existing ? (
|
||||
<p className="annual-quiet">
|
||||
{againLine(overview.creditCost)}
|
||||
{" "}<AppLink href={`/reports/annual?report=${encodeURIComponent(overview.existing.id)}`}>看上次那份</AppLink>
|
||||
</p>
|
||||
{written ? (
|
||||
<AppLink href={`/reports/annual?report=${encodeURIComponent(written.id)}`} className="report-center-annual" aria-label="打开这一年的年运">
|
||||
<span className="report-center-entry-icon" aria-hidden="true"><FileText /></span>
|
||||
<span className="report-center-entry-text">
|
||||
<span className="report-center-annual-title">这一年的年运</span>
|
||||
<span className="report-center-annual-line">已经写好,{overview.range.start} 到 {overview.range.end}</span>
|
||||
</span>
|
||||
<span className="report-center-annual-go" aria-hidden="true">打开<ChevronRight /></span>
|
||||
</AppLink>
|
||||
) : (
|
||||
<p className="annual-quiet">{ANNUAL_EMPTY_LINE}</p>
|
||||
<>
|
||||
<p className="annual-quiet">{ANNUAL_EMPTY_LINE}</p>
|
||||
{overview.notes.length ? (
|
||||
<ul className="annual-notes">{overview.notes.map((note) => <li key={note}>{note}</li>)}</ul>
|
||||
) : null}
|
||||
</>
|
||||
)}
|
||||
<div className="annual-empty-actions">
|
||||
<Button type="button" onClick={onStart}>开始写年运</Button>
|
||||
<Button type="button" variant={written ? "outline" : "default"} onClick={onStart}>{written ? "再写一份" : "开始写年运"}</Button>
|
||||
<p className="annual-price">{priceLine(overview.creditCost)}</p>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
|
||||
@@ -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 href=\{`\/reports\/annual\?report=\$\{encodeURIComponent\(overview\.existing\.id\)\}`\}>看上次那份<\/AppLink>/);
|
||||
assert.doesNotMatch(page, />看上次那份<|againLine\(/, "the 原值 comments may still name the old line");
|
||||
assert.match(page, /<AppLink href=\{`\/reports\/annual\?report=\$\{encodeURIComponent\(written\.id\)\}`\} className="report-center-annual"/);
|
||||
});
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
AnnualOverlay,
|
||||
AnnualProgress,
|
||||
SituationForm,
|
||||
againLine,
|
||||
annualProgressCount,
|
||||
priceLine,
|
||||
type AnnualOverview,
|
||||
@@ -117,12 +116,11 @@ test("both steps fit an 800px window: less room round the card, tighter rhythm,
|
||||
};
|
||||
const calm = renderToStaticMarkup(createElement(AnnualOverlay, { ...props, error: null }));
|
||||
assert.ok(calm.includes(priceLine(50)));
|
||||
assert.ok(calm.includes(againLine(50)));
|
||||
assert.ok(!calm.includes("已经写过一份"), "BUG-2254: no 「已经写过一份」 line");
|
||||
const failed = renderToStaticMarkup(createElement(AnnualOverlay, { ...props, error: { message: "点数不够。", billing: true } }));
|
||||
assert.match(failed, /role="alert"[^>]*>点数不够。/);
|
||||
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, />这一年的年运</);
|
||||
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.
|
||||
|
||||
@@ -222,8 +222,8 @@ test("without onClose and onSkip the overlay offers neither (the old one-way ove
|
||||
assert.doesNotMatch(second, /<details|<summary|补充现在的情况/);
|
||||
// The price lines sit under the start button on the second step.
|
||||
assert.match(second, /本次消耗 50 点,写到一半断掉不扣/);
|
||||
assert.match(second, /这一年已经写过一份,再写一份会另扣 50 点。/);
|
||||
assert.match(second, /看上次那份/);
|
||||
// BUG-2254: 原值还要求「这一年已经写过一份,再写一份会另扣 50 点。看上次那份」。
|
||||
assert.doesNotMatch(second, /已经写过一份|看上次那份/);
|
||||
const withError = renderToStaticMarkup(createElement(AnnualOverlay, { ...props, initialStep: 2, error: { message: "点数不够。", billing: true } }));
|
||||
assert.match(withError, /role="alert"[^>]*>点数不够。/);
|
||||
assert.doesNotMatch(renderToStaticMarkup(createElement(AnnualOverlay, { ...props, error: { message: "点数不够。", billing: true } })), /点数不够/);
|
||||
|
||||
Reference in New Issue
Block a user