From a70de2d9e084aa8a834bc96a4047301e3e03ec84 Mon Sep 17 00:00:00 2001 From: Joseph Wyman Date: Sat, 30 Nov 2024 12:14:07 -0500 Subject: [PATCH] improve tx display stepper --- src/app/components/BitcoinAddress.tsx | 43 +++++ .../components/TransactionDetailsModal.tsx | 150 +++++++++++++++++- src/app/components/privacy/txosTable.tsx | 2 +- 3 files changed, 188 insertions(+), 7 deletions(-) create mode 100644 src/app/components/BitcoinAddress.tsx diff --git a/src/app/components/BitcoinAddress.tsx b/src/app/components/BitcoinAddress.tsx new file mode 100644 index 00000000..b3a81f2f --- /dev/null +++ b/src/app/components/BitcoinAddress.tsx @@ -0,0 +1,43 @@ +import { CopyButton, rem, Tooltip, ActionIcon } from '@mantine/core'; + +import { IconCheck, IconCopy } from '@tabler/icons-react'; +type BitcoinAddressProps = { + address: string; + splitCount?: number; +}; +export const BitcoinAddress = ({ + address, + splitCount = 4, +}: BitcoinAddressProps) => { + const prefix = address.substring(0, splitCount); + const suffix = address.substring(address?.length - splitCount); + const abrv = `${prefix}....${suffix}`; + return ( +
+ +

{abrv}

+
+ + {({ copied, copy }) => ( + + + {copied ? ( + + ) : ( + + )} + + + )} + +
+ ); +}; diff --git a/src/app/components/TransactionDetailsModal.tsx b/src/app/components/TransactionDetailsModal.tsx index cdebdfa8..8d6c3a27 100644 --- a/src/app/components/TransactionDetailsModal.tsx +++ b/src/app/components/TransactionDetailsModal.tsx @@ -1,7 +1,15 @@ -import React from 'react'; -import { Modal } from '@mantine/core'; +import React, { useState } from 'react'; +import { + TextInput, + Modal, + Textarea, + Divider, + Switch, + Collapse, +} from '@mantine/core'; import { Transaction } from '../api/types'; import { BtcMetric } from '../types/btcSatHandler'; +import { BitcoinAddress } from './BitcoinAddress'; type TransactionDetailsModalProps = { opened: boolean; onClose: () => void; @@ -14,16 +22,146 @@ export const TransactionDetailsModal = ({ transactionDetails, btcMetric, }: TransactionDetailsModalProps) => { + const [showTxDiagram, setShowTxDiagram] = useState(true); return ( + Transaction ID:{' '} + {transactionDetails.txid} +

+ } > -
-

Transaction ID: {transactionDetails.txid}

+
+ +
+

Amounts

+ +
+ + + +
+
+ + +
+
+

Inputs & Outputs

+ + setShowTxDiagram(event.currentTarget.checked) + } + /> +
+ + +
+
+ {transactionDetails.inputs.map((input) => ( + + ))} +
+ + +
+
+

Inputs

+
+ +
+ Outputs +
+
+ + + +
+ {transactionDetails.outputs.map((output) => ( + + ))} +
+
+
+
+ + + +
+

Size

+
+ + + +
+
+ + + +
+

Details

+