From d84424202dca22fff22cb1d304286f627642187b Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Wed, 31 Aug 2022 00:20:35 -0300
Subject: p2p tx rendering

---
 .../src/components/TransactionItem.tsx             | 54 +++++++++++++++++++++-
 1 file changed, 52 insertions(+), 2 deletions(-)

(limited to 'packages/taler-wallet-webextension/src/components/TransactionItem.tsx')

diff --git a/packages/taler-wallet-webextension/src/components/TransactionItem.tsx b/packages/taler-wallet-webextension/src/components/TransactionItem.tsx
index 8033b3ee3..6dcee6eca 100644
--- a/packages/taler-wallet-webextension/src/components/TransactionItem.tsx
+++ b/packages/taler-wallet-webextension/src/components/TransactionItem.tsx
@@ -113,8 +113,58 @@ export function TransactionItem(props: { tx: Transaction }): VNode {
           pending={tx.pending}
         />
       );
-    default:
-      throw Error("unsupported transaction type");
+    case TransactionType.PeerPullCredit:
+      return (
+        <TransactionLayout
+          id={tx.transactionId}
+          amount={tx.amountEffective}
+          debitCreditIndicator={"credit"}
+          title={"Invoice credit"}
+          timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)}
+          iconPath={"I"}
+          pending={tx.pending}
+        />
+      );
+    case TransactionType.PeerPullDebit:
+      return (
+        <TransactionLayout
+          id={tx.transactionId}
+          amount={tx.amountEffective}
+          debitCreditIndicator={"debit"}
+          title={"Invoice debit"}
+          timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)}
+          iconPath={"I"}
+          pending={tx.pending}
+        />
+      );
+    case TransactionType.PeerPushCredit:
+      return (
+        <TransactionLayout
+          id={tx.transactionId}
+          amount={tx.amountEffective}
+          debitCreditIndicator={"credit"}
+          title={"Transfer credit"}
+          timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)}
+          iconPath={"T"}
+          pending={tx.pending}
+        />
+      );
+    case TransactionType.PeerPushDebit:
+      return (
+        <TransactionLayout
+          id={tx.transactionId}
+          amount={tx.amountEffective}
+          debitCreditIndicator={"debit"}
+          title={"Transfer debit"}
+          timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)}
+          iconPath={"T"}
+          pending={tx.pending}
+        />
+      );
+    default: {
+      const pe: never = tx;
+      throw Error(`unsupported transaction type ${pe}`);
+    }
   }
 }
 
-- 
cgit v1.2.3

