mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-15 11:59:21 +01:00
REF: Implement Suggestions
This commit is contained in:
parent
841f49ceb9
commit
28d9fa1d53
1 changed files with 102 additions and 102 deletions
|
@ -18,6 +18,7 @@ import { useStorage } from '../../hooks/context/useStorage';
|
|||
import { useExtendedNavigation } from '../../hooks/useExtendedNavigation';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { LightningTransaction } from '../../class/wallets/types';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
type LNDViewInvoiceRouteParams = {
|
||||
walletID: string;
|
||||
|
@ -74,7 +75,6 @@ const LNDViewInvoice = () => {
|
|||
},
|
||||
gestureEnabled: false,
|
||||
headerBackVisible: false,
|
||||
|
||||
// eslint-disable-next-line react/no-unstable-nested-components
|
||||
headerRight: () => (
|
||||
<TouchableOpacity
|
||||
|
@ -102,7 +102,9 @@ const LNDViewInvoice = () => {
|
|||
}, [colors, isModal]);
|
||||
|
||||
useEffect(() => {
|
||||
if (wallet) {
|
||||
if (!wallet) {
|
||||
return;
|
||||
}
|
||||
setSelectedWalletID(walletID);
|
||||
console.log('LNDViewInvoice - useEffect');
|
||||
if (!invoice.ispaid) {
|
||||
|
@ -151,7 +153,6 @@ const LNDViewInvoice = () => {
|
|||
clearInterval(fetchInvoiceInterval.current);
|
||||
fetchInvoiceInterval.current = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
@ -207,8 +208,8 @@ const LNDViewInvoice = () => {
|
|||
const invoiceExpiration = invoice?.timestamp && invoice?.expire_time ? invoice.timestamp + invoice.expire_time : undefined;
|
||||
if (invoice.ispaid || invoice.type === 'paid_invoice') {
|
||||
let amount = 0;
|
||||
let transactionDate;
|
||||
let description;
|
||||
let invoiceDate;
|
||||
if (invoice.type === 'paid_invoice' && invoice?.value) {
|
||||
amount = invoice.value;
|
||||
} else if (invoice.type === 'user_invoice' && invoice.amt) {
|
||||
|
@ -220,7 +221,7 @@ const LNDViewInvoice = () => {
|
|||
description = invoice.memo;
|
||||
}
|
||||
if (invoice.timestamp) {
|
||||
transactionDate = new Date(invoice.timestamp * 1000).toLocaleString();
|
||||
invoiceDate = dayjs(invoice.timestamp * (String(invoice.timestamp).length === 10 ? 1000 : 1)).format('LLL');
|
||||
}
|
||||
return (
|
||||
<View style={styles.root}>
|
||||
|
@ -232,11 +233,9 @@ const LNDViewInvoice = () => {
|
|||
shouldAnimate={false}
|
||||
/>
|
||||
<View style={styles.detailsRoot}>
|
||||
{transactionDate && (
|
||||
<Text style={[styles.detailsText, stylesHook.detailsText]}>
|
||||
{loc.lndViewInvoice.date_time}: {transactionDate}
|
||||
{loc.lndViewInvoice.date_time}: {invoiceDate}
|
||||
</Text>
|
||||
)}
|
||||
{invoice.payment_preimage && typeof invoice.payment_preimage === 'string' ? (
|
||||
<TouchableOpacity accessibilityRole="button" style={styles.detailsTouch} onPress={navigateToPreImageScreen}>
|
||||
<Text style={[styles.detailsText, stylesHook.detailsText]}>{loc.send.create_details}</Text>
|
||||
|
@ -263,11 +262,12 @@ const LNDViewInvoice = () => {
|
|||
);
|
||||
}
|
||||
// Invoice has not expired, nor has it been paid for.
|
||||
if (invoice.payment_request) {
|
||||
return (
|
||||
<ScrollView>
|
||||
<View style={[styles.activeRoot, stylesHook.root]}>
|
||||
<View style={styles.activeQrcode}>
|
||||
<QRCodeComponent value={invoice.payment_request ?? 'not found'} size={qrCodeSize} />
|
||||
<QRCodeComponent value={invoice.payment_request} size={qrCodeSize} />
|
||||
</View>
|
||||
<BlueSpacing20 />
|
||||
<BlueText>
|
||||
|
@ -278,9 +278,8 @@ const LNDViewInvoice = () => {
|
|||
{loc.lndViewInvoice.for} {invoice.description ?? ''}
|
||||
</BlueText>
|
||||
)}
|
||||
<CopyTextToClipboard truncated text={invoice.payment_request ?? 'not found'} />
|
||||
<CopyTextToClipboard truncated text={invoice.payment_request} />
|
||||
<Button onPress={handleOnSharePressed} title={loc.receive.details_share} />
|
||||
|
||||
<BlueSpacing20 />
|
||||
<Button
|
||||
style={stylesHook.additionalInfo}
|
||||
|
@ -291,6 +290,7 @@ const LNDViewInvoice = () => {
|
|||
</ScrollView>
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return <SafeArea onLayout={onLayout}>{render()}</SafeArea>;
|
||||
|
|
Loading…
Add table
Reference in a new issue