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 { useExtendedNavigation } from '../../hooks/useExtendedNavigation';
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import { LightningTransaction } from '../../class/wallets/types';
|
import { LightningTransaction } from '../../class/wallets/types';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
type LNDViewInvoiceRouteParams = {
|
type LNDViewInvoiceRouteParams = {
|
||||||
walletID: string;
|
walletID: string;
|
||||||
|
@ -74,7 +75,6 @@ const LNDViewInvoice = () => {
|
||||||
},
|
},
|
||||||
gestureEnabled: false,
|
gestureEnabled: false,
|
||||||
headerBackVisible: false,
|
headerBackVisible: false,
|
||||||
|
|
||||||
// eslint-disable-next-line react/no-unstable-nested-components
|
// eslint-disable-next-line react/no-unstable-nested-components
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
|
@ -102,7 +102,9 @@ const LNDViewInvoice = () => {
|
||||||
}, [colors, isModal]);
|
}, [colors, isModal]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (wallet) {
|
if (!wallet) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
setSelectedWalletID(walletID);
|
setSelectedWalletID(walletID);
|
||||||
console.log('LNDViewInvoice - useEffect');
|
console.log('LNDViewInvoice - useEffect');
|
||||||
if (!invoice.ispaid) {
|
if (!invoice.ispaid) {
|
||||||
|
@ -151,7 +153,6 @@ const LNDViewInvoice = () => {
|
||||||
clearInterval(fetchInvoiceInterval.current);
|
clearInterval(fetchInvoiceInterval.current);
|
||||||
fetchInvoiceInterval.current = undefined;
|
fetchInvoiceInterval.current = undefined;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// 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;
|
const invoiceExpiration = invoice?.timestamp && invoice?.expire_time ? invoice.timestamp + invoice.expire_time : undefined;
|
||||||
if (invoice.ispaid || invoice.type === 'paid_invoice') {
|
if (invoice.ispaid || invoice.type === 'paid_invoice') {
|
||||||
let amount = 0;
|
let amount = 0;
|
||||||
let transactionDate;
|
|
||||||
let description;
|
let description;
|
||||||
|
let invoiceDate;
|
||||||
if (invoice.type === 'paid_invoice' && invoice?.value) {
|
if (invoice.type === 'paid_invoice' && invoice?.value) {
|
||||||
amount = invoice.value;
|
amount = invoice.value;
|
||||||
} else if (invoice.type === 'user_invoice' && invoice.amt) {
|
} else if (invoice.type === 'user_invoice' && invoice.amt) {
|
||||||
|
@ -220,7 +221,7 @@ const LNDViewInvoice = () => {
|
||||||
description = invoice.memo;
|
description = invoice.memo;
|
||||||
}
|
}
|
||||||
if (invoice.timestamp) {
|
if (invoice.timestamp) {
|
||||||
transactionDate = new Date(invoice.timestamp * 1000).toLocaleString();
|
invoiceDate = dayjs(invoice.timestamp * (String(invoice.timestamp).length === 10 ? 1000 : 1)).format('LLL');
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<View style={styles.root}>
|
<View style={styles.root}>
|
||||||
|
@ -232,11 +233,9 @@ const LNDViewInvoice = () => {
|
||||||
shouldAnimate={false}
|
shouldAnimate={false}
|
||||||
/>
|
/>
|
||||||
<View style={styles.detailsRoot}>
|
<View style={styles.detailsRoot}>
|
||||||
{transactionDate && (
|
|
||||||
<Text style={[styles.detailsText, stylesHook.detailsText]}>
|
<Text style={[styles.detailsText, stylesHook.detailsText]}>
|
||||||
{loc.lndViewInvoice.date_time}: {transactionDate}
|
{loc.lndViewInvoice.date_time}: {invoiceDate}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
|
||||||
{invoice.payment_preimage && typeof invoice.payment_preimage === 'string' ? (
|
{invoice.payment_preimage && typeof invoice.payment_preimage === 'string' ? (
|
||||||
<TouchableOpacity accessibilityRole="button" style={styles.detailsTouch} onPress={navigateToPreImageScreen}>
|
<TouchableOpacity accessibilityRole="button" style={styles.detailsTouch} onPress={navigateToPreImageScreen}>
|
||||||
<Text style={[styles.detailsText, stylesHook.detailsText]}>{loc.send.create_details}</Text>
|
<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.
|
// Invoice has not expired, nor has it been paid for.
|
||||||
|
if (invoice.payment_request) {
|
||||||
return (
|
return (
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<View style={[styles.activeRoot, stylesHook.root]}>
|
<View style={[styles.activeRoot, stylesHook.root]}>
|
||||||
<View style={styles.activeQrcode}>
|
<View style={styles.activeQrcode}>
|
||||||
<QRCodeComponent value={invoice.payment_request ?? 'not found'} size={qrCodeSize} />
|
<QRCodeComponent value={invoice.payment_request} size={qrCodeSize} />
|
||||||
</View>
|
</View>
|
||||||
<BlueSpacing20 />
|
<BlueSpacing20 />
|
||||||
<BlueText>
|
<BlueText>
|
||||||
|
@ -278,9 +278,8 @@ const LNDViewInvoice = () => {
|
||||||
{loc.lndViewInvoice.for} {invoice.description ?? ''}
|
{loc.lndViewInvoice.for} {invoice.description ?? ''}
|
||||||
</BlueText>
|
</BlueText>
|
||||||
)}
|
)}
|
||||||
<CopyTextToClipboard truncated text={invoice.payment_request ?? 'not found'} />
|
<CopyTextToClipboard truncated text={invoice.payment_request} />
|
||||||
<Button onPress={handleOnSharePressed} title={loc.receive.details_share} />
|
<Button onPress={handleOnSharePressed} title={loc.receive.details_share} />
|
||||||
|
|
||||||
<BlueSpacing20 />
|
<BlueSpacing20 />
|
||||||
<Button
|
<Button
|
||||||
style={stylesHook.additionalInfo}
|
style={stylesHook.additionalInfo}
|
||||||
|
@ -291,6 +290,7 @@ const LNDViewInvoice = () => {
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return <SafeArea onLayout={onLayout}>{render()}</SafeArea>;
|
return <SafeArea onLayout={onLayout}>{render()}</SafeArea>;
|
||||||
|
|
Loading…
Add table
Reference in a new issue