Skip to content

Commit

Permalink
feat: unit and visibility toggle on main wallet view (#806)
Browse files Browse the repository at this point in the history
  • Loading branch information
theborakompanioni authored Aug 6, 2024
1 parent 5c8f81e commit 09aa113
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions src/components/MainWalletView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,29 @@ export default function MainWalletView({ wallet }: MainWalletViewProps) {
<rb.Row>
<WalletHeaderRescanning walletName={wallet.displayName} isLoading={isLoading} />
</rb.Row>
) : !currentWalletInfo || isLoading ? (
<rb.Row>
<WalletHeaderPlaceholder />
</rb.Row>
) : (
<rb.Row onClick={() => settingsDispatch({ showBalance: !settings.showBalance })} className="cursor-pointer">
{!currentWalletInfo || isLoading ? (
<WalletHeaderPlaceholder />
) : (
<WalletHeader
walletName={wallet.displayName}
balance={currentWalletInfo.balanceSummary.calculatedTotalBalanceInSats}
unit={settings.unit}
showBalance={settings.showBalance}
/>
)}
<rb.Row
className="cursor-pointer"
onClick={() => {
if (!settings.showBalance) {
settingsDispatch({ unit: 'BTC', showBalance: true })
} else if (settings.unit === 'BTC') {
settingsDispatch({ unit: 'sats', showBalance: true })
} else {
settingsDispatch({ unit: 'BTC', showBalance: false })
}
}}
>
<WalletHeader
walletName={wallet.displayName}
balance={currentWalletInfo.balanceSummary.calculatedTotalBalanceInSats}
unit={settings.unit}
showBalance={settings.showBalance}
/>
</rb.Row>
)}
<div className={styles.walletBody}>
Expand Down

0 comments on commit 09aa113

Please sign in to comment.