Skip to content

Commit 0cb2b39

Browse files
Merge pull request #273 from SwissBitcoinPay/fix-sats-notations-grey
Fix sats notation success colors
2 parents f2b0d9b + 519a1d9 commit 0cb2b39

File tree

4 files changed

+99
-90
lines changed

4 files changed

+99
-90
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
APP_VERSION=2.5.8
22

3-
APP_BUILD_NUMBER=435
3+
APP_BUILD_NUMBER=436
File renamed without changes.
File renamed without changes.

src/screens/Invoice/Invoice.tsx

Lines changed: 98 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -310,97 +310,106 @@ export const Invoice = () => {
310310
);
311311
}, [invoiceCurrency]);
312312

313-
const fiatSatAmountComponent = useMemo(() => {
314-
const elements = formatDecimalComponents((amount || 0) / 1000).reduce(
315-
(result, v) => {
316-
const currentIsEnabled =
317-
result[result.length - 1]?.isEnabled ||
318-
(typeof v === "number" && v !== 0);
319-
return [
320-
...result,
321-
{
322-
value: v,
323-
isEnabled: currentIsEnabled
324-
}
325-
];
326-
},
327-
[] as { value: string | number; isEnabled: boolean }[]
328-
);
329-
330-
const isSatBtcInvoice =
331-
invoiceCurrency && ["sat", "BTC"].includes(invoiceCurrency);
313+
const getFiatSatAmountComponent = useCallback(
314+
(isSuccessScreen = false) => {
315+
const elements = formatDecimalComponents((amount || 0) / 1000).reduce(
316+
(result, v) => {
317+
const currentIsEnabled =
318+
result[result.length - 1]?.isEnabled ||
319+
(typeof v === "number" && v !== 0);
320+
return [
321+
...result,
322+
{
323+
value: v,
324+
isEnabled: currentIsEnabled
325+
}
326+
];
327+
},
328+
[] as { value: string | number; isEnabled: boolean }[]
329+
);
332330

333-
return (
334-
<>
335-
<S.AmountText>
336-
{!isSatBtcInvoice &&
337-
getFormattedUnit(
338-
invoiceFiatAmount,
339-
invoiceCurrency || "",
340-
unitDecimals
341-
)}
342-
</S.AmountText>
343-
{isAlive && (
344-
<S.BtcSatsContainer
345-
style={{ transform: [{ scale: isSatBtcInvoice ? 1.5 : 1 }] }}
346-
gapSize={8}
347-
direction="horizontal"
348-
>
349-
<BitcoinIcon size={20} />
350-
<>
351-
{elements.map((element) => (
352-
<Text
353-
weight={700}
354-
h4
355-
color={element.isEnabled ? colors.white : colors.grey}
356-
>
357-
{element.value}
358-
</Text>
359-
))}
360-
</>
361-
<S.AmountText subAmount>sats</S.AmountText>
362-
</S.BtcSatsContainer>
363-
)}
364-
{isExternalInvoice &&
365-
createdAt &&
366-
delay &&
367-
isAlive &&
368-
delay > rateUpdateDelay && (
369-
<ComponentStack
331+
const isSatBtcInvoice =
332+
invoiceCurrency && ["sat", "BTC"].includes(invoiceCurrency);
333+
334+
return (
335+
<>
336+
<S.AmountText>
337+
{!isSatBtcInvoice &&
338+
getFormattedUnit(
339+
invoiceFiatAmount,
340+
invoiceCurrency || "",
341+
unitDecimals
342+
)}
343+
</S.AmountText>
344+
{isAlive && (
345+
<S.BtcSatsContainer
346+
style={{ transform: [{ scale: isSatBtcInvoice ? 1.5 : 1 }] }}
347+
gapSize={8}
370348
direction="horizontal"
371-
gapSize={4}
372-
style={{ marginTop: 6 }}
373349
>
374-
<Text color={colors.grey} h6 weight={600}>
375-
{t("rateUpdatedIn")} {formatSecondsToMMSS(updateRateTime)}
376-
</Text>
377-
<Pie
378-
useNativeDriver
379-
progress={updateRateTime / rateUpdateDelay}
380-
color={colors.primaryLight}
381-
size={14}
382-
unfilledColor="transparent"
383-
animationType="spring"
384-
style={{ position: "relative", top: -1 }}
385-
/>
386-
</ComponentStack>
350+
<BitcoinIcon size={20} />
351+
<>
352+
{elements.map((element) => (
353+
<Text
354+
weight={700}
355+
h4
356+
color={
357+
element.isEnabled
358+
? colors.white
359+
: isSuccessScreen
360+
? colors.successLight
361+
: colors.grey
362+
}
363+
>
364+
{element.value}
365+
</Text>
366+
))}
367+
</>
368+
<S.AmountText subAmount>sats</S.AmountText>
369+
</S.BtcSatsContainer>
387370
)}
388-
</>
389-
);
390-
}, [
391-
invoiceFiatAmount,
392-
invoiceCurrency,
393-
unitDecimals,
394-
amount,
395-
isExternalInvoice,
396-
createdAt,
397-
delay,
398-
isAlive,
399-
colors.grey,
400-
colors.primaryLight,
401-
t,
402-
updateRateTime
403-
]);
371+
{isExternalInvoice &&
372+
createdAt &&
373+
delay &&
374+
isAlive &&
375+
delay > rateUpdateDelay && (
376+
<ComponentStack
377+
direction="horizontal"
378+
gapSize={4}
379+
style={{ marginTop: 6 }}
380+
>
381+
<Text color={colors.grey} h6 weight={600}>
382+
{t("rateUpdatedIn")} {formatSecondsToMMSS(updateRateTime)}
383+
</Text>
384+
<Pie
385+
useNativeDriver
386+
progress={updateRateTime / rateUpdateDelay}
387+
color={colors.primaryLight}
388+
size={14}
389+
unfilledColor="transparent"
390+
animationType="spring"
391+
style={{ position: "relative", top: -1 }}
392+
/>
393+
</ComponentStack>
394+
)}
395+
</>
396+
);
397+
},
398+
[
399+
invoiceFiatAmount,
400+
invoiceCurrency,
401+
unitDecimals,
402+
amount,
403+
isExternalInvoice,
404+
createdAt,
405+
delay,
406+
isAlive,
407+
colors.grey,
408+
colors.primaryLight,
409+
t,
410+
updateRateTime
411+
]
412+
);
404413

405414
const successLottieRef = useRef<LottieView>(null);
406415

@@ -908,7 +917,7 @@ export const Invoice = () => {
908917
{!isWithdraw ? t("invoicePaid") : t("withdrawSuccess")}
909918
</Text>
910919
</S.MainContentStack>
911-
{fiatSatAmountComponent}
920+
{getFiatSatAmountComponent(true)}
912921
</S.Section>
913922
</S.SectionsContainer>
914923
</S.InvoicePageContainer>
@@ -1154,7 +1163,7 @@ export const Invoice = () => {
11541163
</S.AskButton>
11551164
</S.NFCWrapper>
11561165
)}
1157-
{fiatSatAmountComponent}
1166+
{getFiatSatAmountComponent()}
11581167
{alreadyPaidAmount > 0 && status === "underpaid" && (
11591168
<>
11601169
<S.BitcoinSlotText subAmount color={colors.warning}>

0 commit comments

Comments
 (0)