From e50e46958a1e1ada375d61fb1a6fb24669412871 Mon Sep 17 00:00:00 2001 From: Patrick Dinh Date: Wed, 10 Apr 2024 16:10:52 +1000 Subject: [PATCH 1/2] chore: display transaction to self --- .../components/transaction-view-visual.tsx | 70 +++++++++++++------ 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/src/features/transactions/components/transaction-view-visual.tsx b/src/features/transactions/components/transaction-view-visual.tsx index a48c9ecc5..c776496d8 100644 --- a/src/features/transactions/components/transaction-view-visual.tsx +++ b/src/features/transactions/components/transaction-view-visual.tsx @@ -143,13 +143,49 @@ const DisplayArrow = fixedForwardRef( } ) -const DisplaySelfTransaction = fixedForwardRef((props: object, ref?: React.LegacyRef) => { - return ( -
- -
- ) -}) +const DisplaySelfTransaction = fixedForwardRef( + ({ transaction, arrow, ...rest }: { transaction: TransactionModel; arrow: Arrow }, ref?: React.LegacyRef) => { + const color = graphConfig.paymentTransactionColor + + return ( +
+ +
+ +
+
+
+ {transaction.type === TransactionType.Payment && ( + + )} +
+
+ ) + } +) function PaymentTransactionToolTipContent({ transaction }: { transaction: TransactionModel }) { const items = useMemo( @@ -221,22 +257,15 @@ function TransactionRow({ {accounts.map((_, index) => { if (index < arrow.from || index > arrow.to) return
- if (index === arrow.from && index === arrow.to) - return ( - - - - - - {transaction.type === TransactionType.Payment && } - - - ) if (index === arrow.from) return ( - + {index === arrow.to ? ( + + ) : ( + + )} {transaction.type === TransactionType.Payment && } @@ -305,7 +334,7 @@ export function TransactionViewVisual({ transaction }: Props) {
@@ -315,6 +344,7 @@ export function TransactionViewVisual({ transaction }: Props) {
))} +
{/* The last header cell is empty to support transactions with same sender and receiver */}
{/* The below div is for drawing the background dash lines */}
From 44c63d4a635498262374bf25922d468524759d29 Mon Sep 17 00:00:00 2001 From: Patrick Dinh Date: Wed, 10 Apr 2024 16:14:36 +1000 Subject: [PATCH 2/2] chore: clean up --- .../transactions/components/transaction-view-visual.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/features/transactions/components/transaction-view-visual.tsx b/src/features/transactions/components/transaction-view-visual.tsx index c776496d8..5a7e22842 100644 --- a/src/features/transactions/components/transaction-view-visual.tsx +++ b/src/features/transactions/components/transaction-view-visual.tsx @@ -329,12 +329,13 @@ export function TransactionViewVisual({ transaction }: Props) { ]) ) const maxNestingLevel = Math.max(...flattenedTransactions.map((t) => t.nestingLevel)) + const gridAccountColumns = accounts.length + 1 // +1 is to support transactions with the same sender and receiver return (
@@ -344,7 +345,7 @@ export function TransactionViewVisual({ transaction }: Props) {
))} -
{/* The last header cell is empty to support transactions with same sender and receiver */}
+
{/* The last header cell is empty to support transactions with the same sender and receiver */}
{/* The below div is for drawing the background dash lines */}