Skip to content

Commit b30f53c

Browse files
[Transifex] Updates for project ZEUS (#3578)
* [Transifex] Translate locales/en.json in de 76% of minimum 25% translated source file: 'locales/en.json' on 'de'. Sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format * [Transifex] Translate locales/en.json in de 77% of minimum 25% translated source file: 'locales/en.json' on 'de'. Sync of partially translated files: untranslated content is included with an empty translation or source language content depending on file format --------- Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
1 parent dd88a74 commit b30f53c

File tree

8 files changed

+187
-89
lines changed

8 files changed

+187
-89
lines changed

components/Conversion.tsx

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,13 @@ export default class Conversion extends React.Component<
6060
const { showRate } = this.state;
6161
const { units } = UnitsStore!;
6262
const { settings } = SettingsStore!;
63-
const { fiatEnabled } = settings;
63+
const { fiatEnabled, fiats, preferredFiatIndex, fiat } = settings;
64+
65+
// Get current fiat from multi-select array or fallback to single fiat
66+
const currentFiat = fiats?.[preferredFiatIndex] || fiat || 'USD';
6467

6568
const { getRate }: any = FiatStore;
69+
const { cycleFiat } = SettingsStore!;
6670

6771
let satAmount: string | number;
6872
if (sats) {
@@ -85,7 +89,7 @@ export default class Conversion extends React.Component<
8589
<Row align="flex-end">
8690
<Amount
8791
sats={satAmount}
88-
fixedUnits={units}
92+
fixedUnits={units === 'fiat' ? currentFiat : units}
8993
sensitive={sensitive}
9094
color="secondaryText"
9195
colorOverride={colorOverride}
@@ -99,7 +103,8 @@ export default class Conversion extends React.Component<
99103
}}
100104
>
101105
{` | ${getRate(
102-
this.props.UnitsStore?.units === 'sats'
106+
this.props.UnitsStore?.units === 'sats',
107+
currentFiat
103108
)}`}
104109
</Text>
105110
</>
@@ -117,7 +122,7 @@ export default class Conversion extends React.Component<
117122
<Row align="flex-end">
118123
<Amount
119124
sats={satAmount}
120-
fixedUnits={units}
125+
fixedUnits={units === 'fiat' ? currentFiat : units}
121126
sensitive={sensitive}
122127
color="secondaryText"
123128
colorOverride={colorOverride}
@@ -132,7 +137,7 @@ export default class Conversion extends React.Component<
132137
/>
133138
<Amount
134139
sats={satsPending}
135-
fixedUnits={units}
140+
fixedUnits={units === 'fiat' ? currentFiat : units}
136141
sensitive={sensitive}
137142
color="secondaryText"
138143
colorOverride={colorOverride}
@@ -146,7 +151,8 @@ export default class Conversion extends React.Component<
146151
}}
147152
>
148153
{` | ${getRate(
149-
this.props.UnitsStore?.units === 'sats'
154+
this.props.UnitsStore?.units === 'sats',
155+
currentFiat
150156
)}`}
151157
</Text>
152158
</>
@@ -178,7 +184,14 @@ export default class Conversion extends React.Component<
178184
)}
179185
{units !== 'fiat' && (
180186
<TouchableOpacity
181-
onPress={() => this.toggleShowRate()}
187+
onPress={() => {
188+
// Cycle through fiats when tapping conversion
189+
if (fiats && fiats.length > 1) {
190+
cycleFiat();
191+
} else {
192+
this.toggleShowRate();
193+
}
194+
}}
182195
disabled={FiatStore?.loading}
183196
>
184197
{satsPending ? (

components/UnitToggle.tsx

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,36 @@ interface UnitToggleProps {
1212
UnitsStore?: UnitsStore;
1313
SettingsStore?: SettingsStore;
1414
onToggle?: () => void;
15+
amount?: string;
1516
}
1617

1718
@inject('UnitsStore', 'SettingsStore')
1819
@observer
1920
export default class UnitToggle extends React.Component<UnitToggleProps, {}> {
2021
render() {
21-
const { UnitsStore, SettingsStore, onToggle } = this.props;
22+
const { UnitsStore, SettingsStore, onToggle, amount } = this.props;
2223
const { changeUnits, units } = UnitsStore!;
23-
const { settings } = SettingsStore!;
24-
const { fiat } = settings;
24+
const { settings, cycleFiat } = SettingsStore!;
25+
const { fiat, fiats } = settings;
26+
27+
// Check if amount is effectively zero
28+
const isAmountZero = !amount || amount === '0' || amount === '';
29+
30+
const handlePress = () => {
31+
// If amount > 0 AND in fiat mode AND multiple fiats: cycle fiats (keep amount)
32+
if (
33+
!isAmountZero &&
34+
units === 'fiat' &&
35+
fiats &&
36+
fiats.length > 1
37+
) {
38+
cycleFiat();
39+
} else {
40+
// Normal unit change: sats → BTC → fiat (clears amount)
41+
if (onToggle) onToggle();
42+
changeUnits();
43+
}
44+
};
2545

2646
return (
2747
<React.Fragment>
@@ -35,10 +55,7 @@ export default class UnitToggle extends React.Component<UnitToggleProps, {}> {
3555
adaptiveWidth
3656
quaternary
3757
noUppercase
38-
onPress={() => {
39-
if (onToggle) onToggle();
40-
changeUnits();
41-
}}
58+
onPress={handlePress}
4259
/>
4360
</React.Fragment>
4461
);

0 commit comments

Comments
 (0)