diff options
| author | Adam Soltys <[email protected]> | 2026-11-16 08:44:16 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-11-16 08:44:16 -0700 |
| commit | 550776ed795f1da392ea39a7de5850630f02b16f (patch) | |
| tree | c716be7e1b650d9b6dca3f3eea9f0aa11409ce52 /src/app.js | |
| parent | 5d6e0919ae3d17674c2b5753a7230dabad81120a (diff) | |
| download | coinosv3-550776ed795f1da392ea39a7de5850630f02b16f.tar.gz coinosv3-550776ed795f1da392ea39a7de5850630f02b16f.zip | |
The balance breakdown folds away under the total. "let's hide the breakdown by default but give some way to expand to see it" (Adam, 2026-11-16). On the one balance card, the Ark / On-chain split and the Gifts line now sit behind a small "Breakdown ▾" under the total (only when there is a breakdown to show); "Hide breakdown ▴" folds it again, and the choice is remembered per device. Lines about money on its way (Pending, Moving) still always show. The desktop side panel follows the same choice. signup-quick-test (folded by default, opens to the Gifts line, remembered), unified-balance and features-smoke pass.HEADmaster
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VMan6SwkivduFDDkMmnXjZ
Diffstat (limited to 'src/app.js')
| -rw-r--r-- | src/app.js | 33 |
1 files changed, 26 insertions, 7 deletions
@@ -5186,6 +5186,15 @@ function separateBalances() { function setSeparateBalances(on) { try { on ? localStorage.setItem(SEPARATE_KEY, '1') : localStorage.removeItem(SEPARATE_KEY); } catch {} } +// The one balance's breakdown (Ark / On-chain / Gifts) folds away under its +// total by default (Adam, 2026-11-16); opening it is remembered per device. +const BREAKDOWN_KEY = 'btc-wallet-balance-breakdown'; +function breakdownOpen() { + try { return localStorage.getItem(BREAKDOWN_KEY) === '1'; } catch { return false; } +} +function setBreakdownOpen(on) { + try { on ? localStorage.setItem(BREAKDOWN_KEY, '1') : localStorage.removeItem(BREAKDOWN_KEY); } catch {} +} function unifiedOn(a = activeAccount()) { return !!a && !a.kind && a.type === 'full' && !separateBalances() && spendingActive(); } @@ -5332,8 +5341,8 @@ function walletSide() { h('button', { type: 'button', class: 'wallet-side-total', onClick: () => toWallet('history') }, h('span', { class: 'small muted' }, t('balance')), h('span', { class: 'wallet-side-amount' }, wallet.loaded ? fmtAmount(spending + saving) + ' ' + unitLabel() : '…')), - spendingActive() && (!unified || (spending > 0 && saving > 0)) ? line(unified ? t('balInstant') : t('spendingLabel'), spending) : null, - spendingActive() && (!unified || (spending > 0 && saving > 0)) ? line(unified ? t('balOnchain') : t('savingLabel'), saving) : null, + spendingActive() && (!unified || (spending > 0 && saving > 0 && breakdownOpen())) ? line(unified ? t('balInstant') : t('spendingLabel'), spending) : null, + spendingActive() && (!unified || (spending > 0 && saving > 0 && breakdownOpen())) ? line(unified ? t('balOnchain') : t('savingLabel'), saving) : null, h('div', { class: 'row gap6' }, h('button', { type: 'button', class: 'btn-primary grow', onClick: () => toWallet('receive') }, t('tabReceive')), h('button', { type: 'button', class: 'btn-primary grow', onClick: () => toWallet('send') }, t('tabSend')))), @@ -5473,11 +5482,20 @@ function balanceCard() { // when it's in both places (instant Ark coins, on-chain coins) — and every // line under the figure (pending, moving, locked in gifts) belongs to it. if (unifiedOn()) { - const split = spending > 0 && saving > 0 - ? [{ label: t('balInstant'), sat: spending }, { label: t('balOnchain'), sat: saving }] : []; - const lines = split + // the breakdown (where it sits, what gifts hold) folds away behind a + // toggle; what's on its way (pending, moving) always shows + const split = (spending > 0 && saving > 0 + ? [{ label: t('balInstant'), sat: spending }, { label: t('balOnchain'), sat: saving }] : []) + .concat(featLines.filter((l) => l.part)); + const open = breakdownOpen(); + const lines = (open ? split : []) .concat(pending > 0 ? [{ label: t('pending'), sat: pending, cls: 'v pending' }] : []) - .concat(featLines); + .concat(featLines.filter((l) => !l.part)); + const toggle = split.length + ? h('button', { type: 'button', class: 'linklike small breakdown-toggle', 'aria-expanded': open ? 'true' : 'false', + onClick: () => { setBreakdownOpen(!open); render(); } }, + open ? t('hideBreakdown') + ' ▴' : t('showBreakdown') + ' ▾') + : null; _accDir = null; return h('div', { class: 'card balance balance-one' }, h('div', { class: 'balance-face' }, @@ -5492,7 +5510,8 @@ function balanceCard() { lines.length ? h('div', { class: 'split' }, ...lines.map((l) => h('div', {}, h('div', { class: 'k' }, l.label), h('div', { class: l.cls || 'v' }, fmtAmount(l.sat), ' ', unitTag())))) - : null), + : null, + toggle), ...cardExtras('spending')); } const carouselMode = hasSpending && !kindLocked; |
