Skip to content

refactor(summary): shared balance card and the combine math - #447

Merged
daggerok merged 1 commit into
mainfrom
refactor/balance-card
Dec 4, 2026
Merged

daggerok merged 1 commit into
mainfrom
refactor/balance-card

Conversation

@daggerok

@daggerok daggerok commented Dec 4, 2026

Copy link
Copy Markdown
Owner

What

  • src/viewer/ui/BalanceCard.tsx: the balance card (Card + BalanceHead + BalanceChart, the chart big in ⤢) out of Summary.tsx and AdpSummary.tsx; both use it, each with its own period pref, lines and facts, same look
  • src/viewer/app/series.ts + test: pointAt (the last known value carried), mergeSeries (several series as one line from the first day every series has a value, each day the sum of the last known values, with the parts and their dates), periodChange (per series its own start = the last point not after the period start, its own flows window; then summed: change, gain = change - money put in, gain % the Modified Dietz way; a transfer between shown accounts nets to zero), sumUsd (dollars added as cents)
  • src/viewer/app/combine.ts + test: combinedTotals (Total return % = Σ return ÷ Σ put in, Today % over balance - today), pnlByKind (interest, ordinary, qualified, the 401k's earnings, short and long term, unrealized; rows and columns add up), incomeReceived (taxable qualified and ordinary, tax-free, tax-deferred, 401k), slicesOf, cut (to the cent, the last part takes the rounding), taxTreatment. Pure, not used by the UI yet (the flip uses them)

Why

Step 5 of the scope tree plan: one Balance card for any scope and the math of a combined Summary, checked before any page shows it. Nothing the owner sees changes

Checks

  • bun test: 634 pass, 0 fail
  • parcel build --dist-dir ./.check/out + DIST=.check/out bun src/build/postbuild.ts
  • .claude/tools/etfs/tc/check.sh on the new and changed files: no output
  • git diff --check
  • Chrome on localhost:1237 with made-up data, main vs this branch: the whole HTML (head, lines, facts, period chips, chart SVG) and the box of the Fidelity and the ADP balance cards at full width and in a 390 px iframe, and of their ⤢ windows: identical

@daggerok
daggerok merged commit b6dcb85 into main Dec 4, 2026
1 check passed
@daggerok
daggerok deleted the refactor/balance-card branch December 4, 2026 01:05
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