feat(web): cart page uses cart line details (#40) #125

Merged
amiryahaya merged 2 commits from feat/40-cart-uses-line-details into main 2026-10-29 09:59:41 +01:00
Owner

What

The web cart page now reads names, labels, park, availability and the unit price straight from the cart response that PR #124 added, instead of asking every park for its products on every visit date. This removes the shortcut: in useCartLines.ts and the parks × dates request fan-out (a rate-limit risk behind shared IPs). Web only; no API change.

Changes

  • resolveLines.ts (pure, no requests) replaces useCartLines.ts. States: ok, unavailable, past. A line is ok only when the server says available and sent a name, park and price.
  • Unavailable and past lines still show whatever name/park the server sent; the generic "ticket of {date}" label is used only when none came (so same-date rows are distinguishable).
  • CartProvider exposes details (the server's lines) next to lines. PUT bodies still carry only the four CartLineInput keys (a test pins it; the API rejects extra keys).
  • Removed: the per-line "could not load" state, its message and retry. "Try again" now only retries a failed currencies load.
  • No arithmetic on money in the browser (noArithmetic.test.ts covers the new file); the fixed price note stays.

Checks

  • make cover: 91.3% total (minimum 80%; Go unchanged)
  • web: typecheck, 232 vitest tests, build; scripts/web-e2e.sh 114 passed, 46 skipped
  • Dual-pass review (complexity, correctness) done, fix round re-checked by Pass 1: Ship

Not verified

e2e-idp (real IdP + API) not run in this PR; the mocked e2e has no signed-in cart. A failed background currencies refetch can show "Try again" next to still-correct prices (unlikely, minor).

🤖 Generated with Claude Code

## What The web cart page now reads names, labels, park, availability and the unit price straight from the cart response that PR #124 added, instead of asking every park for its products on every visit date. This removes the `shortcut:` in `useCartLines.ts` and the parks × dates request fan-out (a rate-limit risk behind shared IPs). Web only; no API change. ## Changes - `resolveLines.ts` (pure, no requests) replaces `useCartLines.ts`. States: `ok`, `unavailable`, `past`. A line is `ok` only when the server says `available` and sent a name, park and price. - Unavailable and past lines still show whatever name/park the server sent; the generic "ticket of {date}" label is used only when none came (so same-date rows are distinguishable). - `CartProvider` exposes `details` (the server's lines) next to `lines`. PUT bodies still carry only the four `CartLineInput` keys (a test pins it; the API rejects extra keys). - Removed: the per-line "could not load" state, its message and retry. "Try again" now only retries a failed currencies load. - No arithmetic on money in the browser (`noArithmetic.test.ts` covers the new file); the fixed price note stays. ## Checks - `make cover`: **91.3%** total (minimum 80%; Go unchanged) - web: typecheck, 232 vitest tests, build; `scripts/web-e2e.sh` 114 passed, 46 skipped - Dual-pass review (complexity, correctness) done, fix round re-checked by Pass 1: Ship ## Not verified `e2e-idp` (real IdP + API) not run in this PR; the mocked e2e has no signed-in cart. A failed background currencies refetch can show "Try again" next to still-correct prices (unlikely, minor). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
fix(web): cart details review fixes (#40)
All checks were successful
ci / changes (pull_request) Successful in 12s
ci / clients (pull_request) Has been skipped
ci / api (pull_request) Has been skipped
ci / web (pull_request) Successful in 6m25s
ci / ci-gate (pull_request) Successful in 4s
d8cc1304bf
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
primatekuntech/kws!125
No description provided.