Wallet redesign: split buy/spend, compact balance, exchange confirm + insufficient-chips fix #242
Reference in New Issue
Block a user
Delete Branch "feature/wallet-redesign"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Reworks the Wallet screen to be compact and to separate "get chips" from "spend chips", and fixes
a reported bug. Design agreed in the session.
Bug fix
Buying a value with too few chips showed the generic "Something went wrong" toast. The backend's
insufficient_chips(409) code was propagated correctly, but had no i18n mapping, soerrorKeyfell back to
error.generic. Addederror.insufficient_chips/error.product_not_found. Also, avalue's Exchange button is now disabled up front when the spendable balance cannot cover it (the
server stays authoritative and still rejects it).
Redesign
other-platform chips behind that platform's logo, monospaced digits. Inside a VK/TG store only that
store's own segment shows; on the web the direct segment leads and linked vk/tg follow.
(hints + ad-free end date) and hides when nothing is active.
row at the top) and Spend chips (values). Default: Buy chips.
instant, with no provider window to stand in for a confirmation. The existing cross-platform
store-compliance warning folds into that same dialog when the spend would draw VK/TG chips
(agreed: one dialog, not two).
Model (verified, unchanged)
The money → chips → values model is untouched. Confirmed against the code +
PAYMENTS_DECISIONS_ru:real money buys only chip packs; values are chips-only — a "no-ads for money" product is
structurally impossible (the shape validator forbids a money-priced benefit), which is why creating
one in the admin console failed. No wire or backend change here.
Tests & docs
wallet.spec.tsrewritten for the split storefront, the balance, the Exchange-confirm dialog(with/without the cross-platform warning) and the GP stub — chromium + webkit green.
pnpm check,pnpm test:unit(584),pnpm build, bundle gate,pnpm test:e2e(both engines); plus a portrait visual pass on the mock (balance / toggle / Active/ Exchange / confirm dialog).
FUNCTIONAL.md(+_ru) wallet story rewritten.Reworks the Wallet screen to be more compact and to separate the two flows, and fixes a reported bug. Bug: buying a value with too few chips showed the generic "Something went wrong" toast — the backend's `insufficient_chips` (409) code was propagated correctly but had no i18n mapping, so `errorKey` fell back to `error.generic`. Add `error.insufficient_chips` / `error.product_not_found`. Also disable a value's Exchange button up front when the spendable balance cannot cover it (the server stays authoritative). Redesign: - a compact **balance** row leads the screen — the context's own chips (🪙 N) then any linked other-platform chips behind that platform's logo (monospaced digits); inside a VK/TG store only that store's own segment shows; - the benefits section is renamed **Active**, moved above the store, shows one inline line (hints + ad-free) and hides when nothing is active; - the **store** splits by a two-way toggle into **Buy chips** (money packs + the watch-an-ad row at the top) and **Spend chips** (values, exchanged for chips); - a value's action reads **Exchange** and opens a single confirmation dialog (chip spends are instant, with no provider window to confirm them); the existing cross-platform store-compliance warning folds into that same dialog when the spend would draw VK/TG chips. No payments-model or wire change; the money→chips→values model is unchanged (verified: money buys only chip packs, values are chips-only — "no-ads for money" is structurally impossible). Tests: wallet e2e updated for the new layout (chromium + webkit green). Docs: FUNCTIONAL (+_ru) wallet story rewritten. App bundle budget 126 → 127 KB (always-loaded settings hub).