Skip to content

feat(slice-014): currency selection with correct price display#15

Open
fredericomozzato wants to merge 4 commits into
mainfrom
feat/014-currency-selection-correct-price-display
Open

feat(slice-014): currency selection with correct price display#15
fredericomozzato wants to merge 4 commits into
mainfrom
feat/014-currency-selection-correct-price-display

Conversation

@fredericomozzato
Copy link
Copy Markdown
Owner

Summary

  • Implement currency selection in Settings tab, propagating the chosen currency across Markets and Portfolio tabs
  • Add multi-currency price fetching from CoinGecko — prices are now requested and displayed in the selected currency
  • Fix portfolio tab bugs: key leak, row alignment, left panel width, and currency ticker placement in table headers

Test Plan

  • Launch app, navigate to Settings tab, change currency — verify Markets and Portfolio tabs update prices accordingly
  • Confirm price formatting respects the selected currency (symbol, decimal places)
  • Verify portfolio holdings values reflect the selected currency
  • Check table layout is stable when switching currencies
  • make test passes with race detector clean

fredericomozzato and others added 4 commits April 18, 2026 16:42
- Add currency parameter to FmtPrice/FmtMoney for currency-aware formatting
- Update CoinGeckoClient interface with currency parameter for FetchMarkets/FetchPrices
- Add currency support to MarketsModel with dynamic price header and formatting
- Add currency support to PortfolioModel with proper value display
- Implement currencyChangedMsg propagation through AppModel
- Wire up Enter key in Settings picker to persist currency and trigger refresh
- Update all tests for new function signatures
- Add currency code helper for uppercase formatting
- F1 (BLOCKER): Implement Enter key handler in settingsPicking mode to select currency,
  persist to DB, and emit currencyChangedMsg
- F2 (HIGH): Replace TestSettingsPickEnterNoOp with TestSettingsPickEnterSelectsCurrency
  verifying real selection behavior
- I1 (MED): Add currency propagation tests: AppInitCurrencyDefault, AppInitCurrencyFromDB,
  CurrencyChangedPropagates, MarketsCurrencyChanged, MarketsViewShowsCurrencyHeader,
  PortfolioCurrencyChanged, PortfolioPricesUpdatedReloadsHoldings, PortfolioViewShowsCurrency

Closes findings F1, F2, I1 in docs/reviews/014-currency-selection-correct-price-display/revision-1.md
Cells now use FmtPriceValue/FmtMoneyValue (no currency prefix).
Headers show currency in parentheses: Price (BRL), Value (BRL).
Added FmtPriceValue and FmtMoneyValue to format package.
… width

- Route key messages only to the active tab (never broadcast) so that
  Enter pressed in the Settings currency picker no longer triggers the
  Portfolio edit dialog in the background.
- Narrow left panel from 30 to 22 chars so the right panel has enough
  room (≥ 77 chars) to display all 7 holdings columns without wrapping.
- Clip/pad the highlighted holdings row to the panel width before
  applying ANSI reverse styling, preventing mid-value line breaks caused
  by lipgloss word-wrapping ANSI-decorated strings differently.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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