Repository navigation
refactor(summary): shared balance card and the combine math - #447
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 looksrc/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 failparcel build --dist-dir ./.check/out+DIST=.check/out bun src/build/postbuild.ts.claude/tools/etfs/tc/check.shon the new and changed files: no outputgit diff --check