Skip to content

feat: 续费一栏显示任意付款周期(5 年、18 个月) - #27

Merged
jacob-bytes merged 1 commit into
mainfrom
feat/arbitrary-cycles
Sep 30, 2026
Merged

jacob-bytes merged 1 commit into
mainfrom
feat/arbitrary-cycles

Conversation

@jacob-bytes

Copy link
Copy Markdown
Collaborator

hub 现在把没有名字的付款周期存成 <n>m(monitor-probe/monitor#71),而主题只认 monthly…triennial 六个名字,于是 18 个月会原样显示成「18m」。改成先解析成月数、再按同一个风格写出来:5 年、18 个月。

实测:预览环境里把某个节点的周期设成 60m → 公开页显示 128.00 TWD / 5 年;再用面板改成 3 年(保存后 hub 归一成具名 triennial)→ 显示 128.00 TWD / 三年。

与上游 #17 的差异

上游把措辞从「/ 月」改成了「/ 月付」,我们保留纯周期的写法(/ 月、/ 年、/ 三年):

Billing cycles as the page writes them. The period alone, because every caller
prints it after a slash -- `$39.90 / 年` is per year, and the "付" that used to
follow it was the difference between the price fitting its column and being cut
off with an ellipsis.

那两行注释是我们主题里既有的取舍(「付」字会把价格挤到省略号),改回去等于撤销它。已命名的长度一个字都不变(两年、三年 仍在表里),只有新长度用新写法。

另外上游 #17 只改了详情页,我们的卡片与表格也渲染周期,三处一起改。

校验

npm run lint 0 warning 0 error · npm test 全通过(format 里补了一条:同一个长度的名字写法与 <n>m 写法读出一样,认不出的周期原样显示)· npm run build 通过。

hub 现在把没有名字的周期存成 `<n>m`,而主题只会认 `monthly`…`triennial`
那六个名字,于是 18 个月会原样显示成「18m」。改成先按名字或 `<n>m` 解析成
月数,再按同一个风格写出来:`5 年`、`18 个月`。

措辞保持我们原来的**纯周期**风格(`/ 年`、`/ 月`,不带「付」),没有采用上游
主题的「年付/月付」:那两行注释写着「付」字正是价格放不下被省略号截掉的原因。
已命名的长度一个字都不变(`两年`、`三年` 仍在表里),只有新长度是新写法。

三处调用(卡片、表格、详情页)一起改;上游只改了详情页,我们的卡片和表格也
渲染周期。测试补一条:同一个长度的名字写法与 `<n>m` 写法读出来一致,认不出的
周期原样显示、不吞掉。
@jacob-bytes
jacob-bytes merged commit b95fc8c into main Sep 30, 2026
2 checks passed
@jacob-bytes
jacob-bytes deleted the feat/arbitrary-cycles branch September 30, 2026 01:28
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