Repository navigation
Bump coin count on gain, dim hint button when unaffordable, note replays give no coins - #89
Conversation
…ays give no coins Four small UI patches: - Top-bar coin number plays a bump animation when coins increase (not on spend) - .screen caps at 480px and centers on desktop/tablet, where the wheel's 330px cap otherwise leaves a lot of empty space on wide viewports - Hint button bulb + price dim together when coins < hint cost, so affordability is visible before pressing, not just via shake-on-press - Replaying a completed level flashes "重玩不再獲得金幣" once on entry Also gives the hint button a proper aria-label (hintLabel, price included) since aria-label was overriding the visible "−25" with just "提示". Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
PR Summary by QodoImprove coin, hint, and replay feedback
AI Description
Diagram
High-Level Assessment
Files changed (8)
|
Code Review by Qodo
1. Replay notice contradicts rewards
|
| // 播一次動畫 class,播完就拆掉:留著的話切到關卡選擇(screen 用 hidden → display:none) | ||
| // 再切回來會讓 CSS 動畫整個重播,看起來像按鈕自己動了一下。 | ||
| // 先移除→強制回流→加回,否則同一個 class 還在時動畫不會重播。 | ||
| const animating = new WeakMap(); // el → 上一次播放的 { cls, ac }(見下) |
There was a problem hiding this comment.
1. Added comments are non-english 📘 Rule violation ⚙ Maintainability
New comments in index.html, src/main.js, src/strings.js, and src/style.css contain Chinese natural-language explanations. Source comments must be written in English under the compliance rule.
Agent Prompt
## Issue description
Translate all natural-language comments added or modified by this PR from Chinese into English without changing runtime behavior.
## Issue Context
PR Compliance ID 2366288 requires source-code comments to be written in English. Preserve code identifiers, selectors, and technical meaning while translating the comments.
## Fix Focus Areas
- index.html[96-96]
- src/main.js[18-32]
- src/main.js[41-56]
- src/main.js[142-143]
- src/main.js[255-267]
- src/main.js[360-365]
- src/strings.js[12-13]
- src/style.css[139-148]
- src/style.css[211-216]
- src/style.css[313-313]
- src/style.css[409-415]
- src/style.css[906-906]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| // +冷卻中的「3:59」已經逼到極限),不該為只在破關那一刻才有後果的訊息花那個位置。 | ||
| // 要在 showScreen 之後——#preview 所屬的 screen 還 hidden 時 900ms 就走完了,等於沒播。 | ||
| // 代價:中途切走再回來的人看不到。可接受——是他自己從關卡選擇點進來的,而過關卡片會再說一次。 | ||
| if (replay) flashPreview(strings.replayNote, 'dup'); |
There was a problem hiding this comment.
2. Replay notice contradicts rewards 🐞 Bug ≡ Correctness
The new replay notice says replays award no coins, but an uncollected bonus word still increases save.coins during a replay. Players can therefore receive persistent coins immediately after being told that replaying cannot earn them.
Agent Prompt
## Issue description
The replay notice promises that replaying awards no coins, but completed levels can retain uncollected bonus words and the replay bonus path still credits those coins. Align the notice with the established one-time bonus behavior, or explicitly prevent every replay coin payout if that is the intended contract; add regression coverage for a completed level with an unclaimed bonus.
## Issue Context
Winning requires only target words. A replay restores previously claimed bonus words, so an unclaimed bonus remains rewardable and `onSubmit` credits it without checking `replay`.
## Fix Focus Areas
- src/main.js[347-350]
- src/main.js[366-366]
- src/main.js[437-442]
- src/strings.js[30-30]
- tests/game.test.mjs[91-97]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| // +冷卻中的「3:59」已經逼到極限),不該為只在破關那一刻才有後果的訊息花那個位置。 | ||
| // 要在 showScreen 之後——#preview 所屬的 screen 還 hidden 時 900ms 就走完了,等於沒播。 | ||
| // 代價:中途切走再回來的人看不到。可接受——是他自己從關卡選擇點進來的,而過關卡片會再說一次。 | ||
| if (replay) flashPreview(strings.replayNote, 'dup'); |
There was a problem hiding this comment.
3. Replay status remains stale 🐞 Bug ≡ Correctness
Starting a wheel gesture during the replay flash cancels its cleanup timer but leaves #status containing the replay message indefinitely. Re-entering the same replay then writes an unchanged live-region value, so assistive technology may not announce the notice again.
Agent Prompt
## Issue description
When wheel interaction supersedes the replay flash, clear both its visual preview state and live-region status. Ensure entering the same replay again produces a fresh status mutation that assistive technology can announce.
## Issue Context
`flashPreview` relies on `previewTimer` to clear both elements. `showPreview` cancels that timer on the wheel's pointerdown-driven `onChange`, but currently updates only `#preview`.
## Fix Focus Areas
- src/main.js[273-294]
- src/main.js[366-366]
- src/wheel.js[161-172]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Summary
bumpanimation when coins increase (bonus/claim), not on spend (hint) —updateCoinscompares against the last rendered value..screencaps at 480px and centers on desktop/tablet — the wheel is capped at 330px so wide viewports otherwise leave the layout lopsided; no effect on mobile widths..hint-btn.poor) once coins drop below hint cost, so affordability reads before pressing, not only via the existing shake-on-press.aria-label(hintLabel, price included) instead of a bare "提示" that silently overrode the visible "−25".Docs updated: design doc §7/§8/§16/§17, UI doc §2/§3/copy table, CLAUDE.md,
.serena/memories/project-overview.md.Test plan
mise run check(lint + 48 unit tests) passes