Skip to content

feat(plan-calendar): replace day dots with informative banners#79

Merged
nocoo merged 3 commits into
mainfrom
agent/sde-02/8adba4e5
Jun 12, 2026
Merged

feat(plan-calendar): replace day dots with informative banners#79
nocoo merged 3 commits into
mainfrom
agent/sde-02/8adba4e5

Conversation

@nocoo

@nocoo nocoo commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Summary

资金计划日历页面把每天的小圆点改造成更明显的彩色信息条 banner,每条显示规则名 + 紧凑金额,颜色用分类的 chart-N token。点击 banner 直接打开既有编辑弹窗;当日条目超过 3 条用 +N 折叠,点击或点单元格空白处仍弹出 DayDetailPopover

视觉做了两轮 review 调整:banner 改成「彩色 3px 左条 + bg-muted/70 中性底 + text-foreground 文本」,所有颜色都走主题 token,light/dark 都满足 WCAG AA。键盘聚焦 banner 后按 Enter/Space 只触发编辑,不会同时打开 day-detail(通过 e.target === e.currentTarget 守卫)。

Closes STU-524.

Changes

  • src/components/plan/plan-calendar.tsx — dots → banners,cell 改为 min-h-[7rem] flex 列;新增 onOpenRule prop
  • src/app/plan/calendar/calendar-client.tsx — wire onOpenRule 到 edit dialog(沿用既有 RecurringExpenseForm
  • src/lib/recurring-expense/format.ts — 新增 formatAmountCompact(≥10000 用「万」)
  • 单测:plan-calendar 新增 banner 渲染 / 点击 / 键盘 / overflow 共 7 个用例;format 新增 formatAmountCompact 单测

Test plan

  • bun run typecheck
  • bun run lint
  • bun run test(957/957)
  • 手动 bun run dev/plan/calendar 验证 banner 颜色、点击编辑、+N 折叠(合并前由人验证)

nocoo added 3 commits June 13, 2026 06:53
Each occurrence renders a full-width banner showing the rule name plus a
compact amount (e.g. ¥2,500 / ¥1.2万) tinted by the category's chart-N
token. Clicking a banner opens the existing edit dialog directly; the
day-detail popover still opens by clicking the empty area of a cell or
the +N overflow row.

Adds formatAmountCompact for legible banner amounts (万 suffix past
10,000 yuan) and covers it plus the new interaction wiring with
additional unit tests.
- Gate the gridcell onKeyDown on e.target === e.currentTarget so
  Enter/Space on a focused banner only opens the edit dialog and no
  longer also opens the day-detail popover. Mouse clicks already
  stopPropagation; the keyboard path needed an explicit guard because
  React's synthetic keydown still bubbles through stopPropagation()'d
  click handlers.
- Render the category color as a left accent stripe over a neutral
  muted background instead of using the chart-N token as the banner
  background. White-on-chart-N was below WCAG AA at 10px in both
  light and dark themes (chart-6 ~ 1.98, chart-20 ~ 2.01 light;
  chart-6 ~ 1.71, chart-20 ~ 1.62 dark). The neutral surface + theme
  foreground tokens inherit the project's verified contrast.
- Add two keyboard-interaction tests: banner Enter/Space only fires
  onOpenRule (not onSelectDay); cell-level Enter still opens the day
  detail.
Amount was rendered with text-muted-foreground on bg-muted/70, which
measures ~4.01:1 in light theme and ~3.93:1 in dark — below the 4.5:1
floor 10px text needs. The amount is core information (not a hint),
so it gets the same foreground token as the rule name.
@nocoo nocoo force-pushed the agent/sde-02/8adba4e5 branch from fcf97b1 to 577061d Compare June 12, 2026 22:54
@nocoo nocoo merged commit 6d6ce89 into main Jun 12, 2026
4 checks passed
@nocoo nocoo deleted the agent/sde-02/8adba4e5 branch June 12, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant