Repository navigation
fix wallet balance in fiat - #165
Conversation
WalkthroughBalance.tsx now supports multiple currency display modes by importing CurrencyDisplay, computing main/other balances and units based on configuration, and conditionally rendering a second row when CurrencyDisplay is Both. The primary display switched from a hardcoded SATS label to dynamic units, without changing public interfaces. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User
participant B as Balance Component
participant CFG as Config
participant T as CurrencyDisplay
U->>B: Render()
B->>CFG: Read fiat currency
B->>T: Read display mode
alt display = Fiat
B->>B: mainBalance = fiat<br/>mainUnit = fiat code
else display = Sats
B->>B: mainBalance = sats<br/>mainUnit = SATS
else display = Both
B->>B: mainBalance = primary<br/>otherBalance = secondary<br/>mainUnit/otherUnit set
end
B-->>U: Render primary row (mainBalance, mainUnit)
opt display = Both
B-->>U: Render secondary row (otherBalance, otherUnit)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying wallet-signet with
|
| Latest commit: |
79ded1e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0ffcf2ee.wallet-23u.pages.dev |
| Branch Preview URL: | https://hide-balance-fiat.wallet-23u.pages.dev |
Deploying wallet-mutinynet with
|
| Latest commit: |
79ded1e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://5285cfd0.arkade-wallet.pages.dev |
| Branch Preview URL: | https://hide-balance-fiat.arkade-wallet.pages.dev |
Deploying wallet-bitcoin-v8 with
|
| Latest commit: |
79ded1e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f8c6b921.wallet-v8.pages.dev |
| Branch Preview URL: | https://hide-balance-fiat.wallet-v8.pages.dev |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/components/Balance.tsx (1)
46-51: Consider using && operator for conditional rendering.The conditional rendering logic is correct. For a more idiomatic React style, you could use the
&&operator instead of a ternary withnull:- {showBoth ? ( - <FlexRow> + {showBoth && ( + <FlexRow> <Text color='dark80'>{otherBalance}</Text> <Text small>{otherUnit}</Text> </FlexRow> - ) : null} + )}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/components/Balance.tsx(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/components/Balance.tsx (3)
src/components/Text.tsx (1)
Text(25-79)src/icons/Eye.tsx (1)
EyeIcon(1-11)src/components/FlexRow.tsx (1)
FlexRow(16-45)
🔇 Additional comments (2)
src/components/Balance.tsx (2)
38-40: LGTM!The display correctly uses the computed
mainBalanceandmainUnitvalues, making the component dynamic and responsive to the currency display mode.
24-28: Approve currency display logic The code correctly switches between fiat and sats based oncurrencyDisplay; theCurrencyDisplayandFiatsenums guarantee valid, defined values.
Summary by CodeRabbit
New Features
UI