Skip to content

Commit

Permalink
feat(ui): add total balance conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
pwltr committed Nov 7, 2024
1 parent 3927859 commit e140bab
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 26 deletions.
12 changes: 8 additions & 4 deletions src/components/ActivityHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
ViewStyle,
} from 'react-native';

import { Caption13Up } from '../styles/text';
import { EyeIcon } from '../styles/icons';
import Money from './Money';
import DetectSwipe from './DetectSwipe';
Expand All @@ -21,11 +20,9 @@ import {

const ActivityHeader = ({
balance,
label,
style,
}: {
balance: number;
label?: string;
style?: StyleProp<ViewStyle>;
}): ReactElement => {
const dispatch = useAppDispatch();
Expand All @@ -40,7 +37,14 @@ const ActivityHeader = ({
return (
<View style={style}>
<View style={styles.label}>
<Caption13Up color="secondary">{label}</Caption13Up>
<Money
sats={balance}
unitType="secondary"
color="secondary"
size="caption13Up"
enableHide={true}
symbol={true}
/>
</View>

<DetectSwipe
Expand Down
16 changes: 12 additions & 4 deletions src/components/BalanceHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,33 @@ const BalanceHeader = (): ReactElement => {
return (
<View style={styles.container}>
<View style={styles.label}>
{pendingPaymentsBalance ? (
<Money
sats={totalBalance}
unitType="secondary"
color="secondary"
size="caption13Up"
enableHide={true}
symbol={true}
/>

{pendingPaymentsBalance !== 0 && (
<Trans
t={t}
i18nKey="balance_total_pending"
components={{
text: <Caption13Up color="secondary" />,
pending: (
<Money
sats={pendingPaymentsBalance}
unitType="secondary"
color="secondary"
size="caption13Up"
sats={pendingPaymentsBalance}
enableHide={true}
symbol={false}
/>
),
}}
/>
) : (
<Caption13Up color="secondary">{t('balance_total')}</Caption13Up>
)}
</View>

Expand Down
5 changes: 1 addition & 4 deletions src/screens/Activity/ActivitySavings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,7 @@ const ActivitySavings = ({
</View>

<View style={styles.content}>
<ActivityHeader
label={t('activity_transfer_savings')}
balance={onchainBalance}
/>
<ActivityHeader balance={onchainBalance} />

{balanceInTransferToSavings !== 0 && (
<View style={styles.transfer}>
Expand Down
5 changes: 1 addition & 4 deletions src/screens/Activity/ActivitySpending.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ const ActivitySpending = ({
</View>

<View style={styles.content}>
<ActivityHeader
label={t('activity_transfer_spending')}
balance={lightningBalance}
/>
<ActivityHeader balance={lightningBalance} />

{balanceInTransferToSpending !== 0 && (
<View style={styles.transfer}>
Expand Down
11 changes: 1 addition & 10 deletions src/utils/i18n/locales/en/wallet.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
"receive": {
"string": "Receive"
},
"balance_total": {
"string": "Total balance"
},
"balance_total_pending": {
"string": "<text>Total balance (</text><pending/><text> pending)</text>"
"string": "<text> (</text><pending/><text> pending)</text>"
},
"create_wallet_error": {
"string": "Please reopen the app and try again."
Expand Down Expand Up @@ -380,12 +377,6 @@
"activity_transfer": {
"string": "Transfer"
},
"activity_transfer_spending": {
"string": "Spending Balance"
},
"activity_transfer_savings": {
"string": "Savings Balance"
},
"activity_transfer_savings_pending": {
"string": "From Spending (±{duration})"
},
Expand Down

0 comments on commit e140bab

Please sign in to comment.