fix(ephemeris,report): month switch moves the selected day; phone report body clears the floating buttons (BUG-2196, BUG-2197)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
This commit is contained in:
@@ -29630,3 +29630,29 @@
|
||||
- 尚未处理:拿到原因码后修具体泄漏;个人报告英文版单独重试入口。
|
||||
- 关联记录:BUG-2109、BUG-2115。
|
||||
- 修复版本:`claude/acceptance-fixes-b`。
|
||||
|
||||
## BUG-2196 | 星历切换月份后,下方详情和「带这天去提问」仍停在原来那天,「今天」按钮也不出现
|
||||
|
||||
- 状态:fixed-pending-verify。
|
||||
- 首次发现 / 最近更新:2026-11-22 / 2026-11-22(负责人 AI 验收 T-08)。
|
||||
- 现象:今天 11 月 22 日,在 `/ephemeris` 点「下个月」,月历显示 12 月,但下方日期详情和「带这天去提问」仍是 11 月 22 日,上方不显示「今天」按钮;要另点 12 月某一天才同步。
|
||||
- 触发条件:用上个月 / 下个月箭头换月。
|
||||
- 根因:`frontend/src/components/ephemeris/ephemeris-month.tsx` 的两个箭头只调用 `onMonth` 换月历,不改选中日期;「今天」按钮只在「选中日期不是今天」时出现,换月后选中的仍是今天,所以不出现。
|
||||
- 修复:箭头改为 `goToMonth`:换月的同时选中那个月的一天(含今天的月份选今天,否则选 1 号),详情和提问草稿随之更新;「今天」按钮在「选中的不是今天,或显示的不是今天所在月」时都出现。
|
||||
- 验证:`tests/ephemeris-month.test.tsx` 新增一项(两个箭头都走 `goToMonth`、选日规则、显示 12 月而选中仍是今天时出现「今天」),星历三个测试文件 32 项通过;tsc 0。
|
||||
- 防复发:上面的测试。
|
||||
- 关联记录:星历个人日历(2026-11-07 上线)。
|
||||
- 修复版本:`claude/acceptance-fixes-c`。
|
||||
|
||||
## BUG-2197 | 手机上个人报告底部的「目录」「到底部」浮动按钮压住正文最后一行
|
||||
|
||||
- 状态:fixed-pending-verify。
|
||||
- 首次发现 / 最近更新:2026-11-22 / 2026-11-22(负责人 AI 验收 T-12)。
|
||||
- 现象:390×844 下,个人报告底部左右两颗浮动按钮(44px 高,离底 16–24px)盖在正文上,最后一行要多滚一次才能读。
|
||||
- 触发条件:宽度 ≤ 860px 打开带目录的个人报告(Markdown 阅读器)。
|
||||
- 根因:`.personal-report-reader-body` 在窄屏只留 48px 底部空白,小于浮动按钮占的高度。
|
||||
- 修复:`globals.css` 在 ≤ 860px 时,给含阅读布局的 `.personal-report-reader-body` 底部留「按钮高度 44px + 离底 24px + 间隔 32px + 安全区」;用 `:has()` 提高优先级,不受后面手机 padding 简写影响。桌面不变。年运和合盘页没有底部浮动按钮,不受影响。
|
||||
- 验证:新增 `tests/report-phone-float-space-2197.test.ts`;tsc 0。未做本地截图。
|
||||
- 防复发:上面的测试。
|
||||
- 关联记录:BUG-2093、BUG-2096(目录折叠)。
|
||||
- 修复版本:`claude/acceptance-fixes-c`。
|
||||
|
||||
@@ -6249,6 +6249,13 @@ button.report-ask-clear:hover { color: var(--color-ink); }
|
||||
color: var(--color-ink-tertiary);
|
||||
font-size: var(--type-caption);
|
||||
}
|
||||
/* BUG-2197 原值:窄屏正文底部只留 48px,「目录」「到底部」两颗浮动按钮(44px 高、离底 16–24px)压住最后一行;
|
||||
新值:有这两颗按钮时,正文底部留出按钮高度 + 离底距离 + 一行间隔 + 安全区;原因:最后一行要多滚一次才能读。桌面不变。 */
|
||||
@media (max-width: 860px) {
|
||||
.personal-report-reader-body:has(.personal-report-md-layout) {
|
||||
padding-bottom: calc(44px + var(--space-6) + var(--space-8) + env(safe-area-inset-bottom, 0px));
|
||||
}
|
||||
}
|
||||
.personal-report-footer span:last-child { overflow-wrap: anywhere; text-align: right; }
|
||||
.personal-report-avoid-break { break-inside: avoid-page; }
|
||||
.personal-report-avoid-break-row { break-inside: avoid; }
|
||||
|
||||
@@ -183,12 +183,19 @@ export function EphemerisMonthCalendar(props: {
|
||||
});
|
||||
}
|
||||
|
||||
// BUG-2196 原值:上个月 / 下个月只换月历,下方详情和「带这天去提问」仍停在原来那天;
|
||||
// 新值:换月时同时选中那个月的一天(含今天的月份选今天,否则选 1 号);原因:月历和详情说的不是同一天。
|
||||
const goToMonth = (next: string) => {
|
||||
props.onMonth(next);
|
||||
props.onSelect(monthOf(props.today) === next ? props.today : `${next}-01`);
|
||||
};
|
||||
|
||||
return (
|
||||
<section className="ephemeris-month" aria-labelledby="ephemeris-month-heading">
|
||||
<div className="ephemeris-month-head">
|
||||
<h1 id="ephemeris-month-heading">{year}年{mon}月</h1>
|
||||
<div className="ephemeris-month-nav">
|
||||
{props.selected === props.today ? null : (
|
||||
{props.selected === props.today && props.month === monthOf(props.today) ? null : (
|
||||
<Button type="button" variant="ghost" className="ephemeris-today" onClick={() => {
|
||||
props.onMonth(monthOf(props.today));
|
||||
props.onSelect(props.today);
|
||||
@@ -196,10 +203,10 @@ export function EphemerisMonthCalendar(props: {
|
||||
{EPHEMERIS_MONTH_COPY.today}
|
||||
</Button>
|
||||
)}
|
||||
<Button type="button" variant="ghost" size="icon" className="ephemeris-date-button" aria-label={EPHEMERIS_MONTH_COPY.previousMonth} onClick={() => props.onMonth(shiftMonth(props.month, -1))}>
|
||||
<Button type="button" variant="ghost" size="icon" className="ephemeris-date-button" aria-label={EPHEMERIS_MONTH_COPY.previousMonth} onClick={() => goToMonth(shiftMonth(props.month, -1))}>
|
||||
<ChevronLeft aria-hidden="true" />
|
||||
</Button>
|
||||
<Button type="button" variant="ghost" size="icon" className="ephemeris-date-button" aria-label={EPHEMERIS_MONTH_COPY.nextMonth} onClick={() => props.onMonth(shiftMonth(props.month, 1))}>
|
||||
<Button type="button" variant="ghost" size="icon" className="ephemeris-date-button" aria-label={EPHEMERIS_MONTH_COPY.nextMonth} onClick={() => goToMonth(shiftMonth(props.month, 1))}>
|
||||
<ChevronRight aria-hidden="true" />
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -193,3 +193,23 @@ test("回看 storage: server-side only, past days only, kept with the birth decl
|
||||
assert.match(migration, /chart_choice_declaration\(p_user_id, p_chart_profile_id\)/);
|
||||
assert.match(migration, /grant execute on function public\.ephemeris_day_check_save_v1\([^)]*\) to service_role/);
|
||||
});
|
||||
|
||||
test("BUG-2196: switching month selects a day in that month, and 今天 shows whenever the view is not today", () => {
|
||||
const source = readFileSync(new URL("../src/components/ephemeris/ephemeris-month.tsx", import.meta.url), "utf8");
|
||||
// Both month arrows go through goToMonth, which moves the selection with the month.
|
||||
assert.equal([...source.matchAll(/onClick=\{\(\) => goToMonth\(shiftMonth\(props\.month, -?1\)\)\}/g)].length, 2);
|
||||
assert.match(source, /props\.onSelect\(monthOf\(props\.today\) === next \? props\.today : `\$\{next\}-01`\)/);
|
||||
// Shown month differs from today's month while the selection is still today: 今天 is offered.
|
||||
const markup = renderToStaticMarkup(
|
||||
<EphemerisMonthCalendar
|
||||
month="2026-12"
|
||||
selected="2026-11-06"
|
||||
today="2026-11-06"
|
||||
state={{ phase: "pending", month: "2026-12" }}
|
||||
onSelect={() => undefined}
|
||||
onMonth={() => undefined}
|
||||
onRetry={() => undefined}
|
||||
/>,
|
||||
);
|
||||
assert.match(markup, />今天</);
|
||||
});
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import test from "node:test";
|
||||
|
||||
const css = readFileSync(new URL("../src/app/globals.css", import.meta.url), "utf8");
|
||||
|
||||
test("BUG-2197: on narrow screens the report body leaves room under the floating 目录 / 到底部 buttons", () => {
|
||||
const block = css.match(/@media \(max-width: 860px\) \{\s*\.personal-report-reader-body:has\(\.personal-report-md-layout\) \{\s*padding-bottom: ([^;]+);/);
|
||||
assert.ok(block, "the reserved space rule exists");
|
||||
// Button height + distance from the bottom + one gap + the phone's safe area.
|
||||
assert.match(block[1], /44px/);
|
||||
assert.match(block[1], /env\(safe-area-inset-bottom/);
|
||||
// The rule beats the phone padding shorthand by specificity (:has adds a class), so order does not matter.
|
||||
assert.match(css, /\.personal-report-reader-body \{ padding: 0 var\(--space-4\) var\(--space-12\); \}/);
|
||||
// The floating controls themselves are unchanged: 44px pills at the bottom corners.
|
||||
assert.match(css, /\.report-edge-jump__button \{\s*min-height: 44px;/);
|
||||
});
|
||||
Reference in New Issue
Block a user