Skip to content

Commit b8bdf17

Browse files
authored
feat(ui): add total balance conversion (#2337)
1 parent 293f52a commit b8bdf17

File tree

5 files changed

+23
-26
lines changed

5 files changed

+23
-26
lines changed

src/components/ActivityHeader.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
ViewStyle,
88
} from 'react-native';
99

10-
import { Caption13Up } from '../styles/text';
1110
import { EyeIcon } from '../styles/icons';
1211
import Money from './Money';
1312
import DetectSwipe from './DetectSwipe';
@@ -21,11 +20,9 @@ import {
2120

2221
const ActivityHeader = ({
2322
balance,
24-
label,
2523
style,
2624
}: {
2725
balance: number;
28-
label?: string;
2926
style?: StyleProp<ViewStyle>;
3027
}): ReactElement => {
3128
const dispatch = useAppDispatch();
@@ -40,7 +37,14 @@ const ActivityHeader = ({
4037
return (
4138
<View style={style}>
4239
<View style={styles.label}>
43-
<Caption13Up color="secondary">{label}</Caption13Up>
40+
<Money
41+
sats={balance}
42+
unitType="secondary"
43+
color="secondary"
44+
size="caption13Up"
45+
enableHide={true}
46+
symbol={true}
47+
/>
4448
</View>
4549

4650
<DetectSwipe

src/components/BalanceHeader.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,33 @@ const BalanceHeader = (): ReactElement => {
2727
return (
2828
<View style={styles.container}>
2929
<View style={styles.label}>
30-
{pendingPaymentsBalance ? (
30+
<Money
31+
sats={totalBalance}
32+
unitType="secondary"
33+
color="secondary"
34+
size="caption13Up"
35+
enableHide={true}
36+
symbol={true}
37+
/>
38+
39+
{pendingPaymentsBalance !== 0 && (
3140
<Trans
3241
t={t}
3342
i18nKey="balance_total_pending"
3443
components={{
3544
text: <Caption13Up color="secondary" />,
3645
pending: (
3746
<Money
47+
sats={pendingPaymentsBalance}
48+
unitType="secondary"
3849
color="secondary"
3950
size="caption13Up"
40-
sats={pendingPaymentsBalance}
4151
enableHide={true}
4252
symbol={false}
4353
/>
4454
),
4555
}}
4656
/>
47-
) : (
48-
<Caption13Up color="secondary">{t('balance_total')}</Caption13Up>
4957
)}
5058
</View>
5159

src/screens/Activity/ActivitySavings.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,7 @@ const ActivitySavings = ({
7171
</View>
7272

7373
<View style={styles.content}>
74-
<ActivityHeader
75-
label={t('activity_transfer_savings')}
76-
balance={onchainBalance}
77-
/>
74+
<ActivityHeader balance={onchainBalance} />
7875

7976
{balanceInTransferToSavings !== 0 && (
8077
<View style={styles.transfer}>

src/screens/Activity/ActivitySpending.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ const ActivitySpending = ({
5959
</View>
6060

6161
<View style={styles.content}>
62-
<ActivityHeader
63-
label={t('activity_transfer_spending')}
64-
balance={lightningBalance}
65-
/>
62+
<ActivityHeader balance={lightningBalance} />
6663

6764
{balanceInTransferToSpending !== 0 && (
6865
<View style={styles.transfer}>

src/utils/i18n/locales/en/wallet.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@
55
"receive": {
66
"string": "Receive"
77
},
8-
"balance_total": {
9-
"string": "Total balance"
10-
},
118
"balance_total_pending": {
12-
"string": "<text>Total balance (</text><pending/><text> pending)</text>"
9+
"string": "<text> (</text><pending/><text> pending)</text>"
1310
},
1411
"create_wallet_error": {
1512
"string": "Please reopen the app and try again."
@@ -380,12 +377,6 @@
380377
"activity_transfer": {
381378
"string": "Transfer"
382379
},
383-
"activity_transfer_spending": {
384-
"string": "Spending Balance"
385-
},
386-
"activity_transfer_savings": {
387-
"string": "Savings Balance"
388-
},
389380
"activity_transfer_savings_pending": {
390381
"string": "From Spending (±{duration})"
391382
},

0 commit comments

Comments
 (0)