gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant-backoffice] 01/02: serve public histories from tabs


From: gnunet
Subject: [taler-merchant-backoffice] 01/02: serve public histories from tabs
Date: Sat, 19 Feb 2022 10:53:44 +0100

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository merchant-backoffice.

commit 56e0c024fab54143d206bc2097925caa2a1db3f2
Author: MS <ms@taler.net>
AuthorDate: Thu Feb 17 11:26:46 2022 +0100

    serve public histories from tabs
---
 packages/bank/src/pages/home/index.tsx | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/packages/bank/src/pages/home/index.tsx 
b/packages/bank/src/pages/home/index.tsx
index d56e1d2..7318cf3 100644
--- a/packages/bank/src/pages/home/index.tsx
+++ b/packages/bank/src/pages/home/index.tsx
@@ -1005,7 +1005,7 @@ function SWRWithoutCredentials(Props: any): VNode {
 /**
  * Show histories of public accounts.
  */
-function PublicHistories(): VNode {
+function PublicHistories(Props: any): VNode {
   const { data, error } = useSWR("access-api/public-accounts")
   if (typeof error !== "undefined") {
     console.log("account error", error);
@@ -1019,17 +1019,32 @@ function PublicHistories(): VNode {
     }
   }
   if (!data) return <p>Waiting public accounts list...</p>
-  var txs = [];
+  var txs = {};
+  var accountsBar = [];
   for (const account of data.publicAccounts) {
     console.log("Asking transactions for", account.accountLabel)
-    txs.push(
+    accountsBar.push(
+      <li>
+        <a onClick={() => <PublicAccounts showAccount={account.accountLabel} 
/>}>{account.accountLabel}</a>
+      </li>
+    );
+    txs[account.accountLabel] = 
       <div>{account.accountLabel} latest transactions:
         <Transactions accountLabel={account.accountLabel} pageNumber={0} />
       </div>
-    )
   }
+  /**
+   * Show the account specified in the props, or just one
+   * from the list if that's not given.
+   */
+  var showAccount = Props.showAccount
+  if (typeof showAccount === "undefined" && keys(txs).length > 0) {
+    showAccount = keys(txs).pop()
+  }
+
   return <Fragment>
-    {txs.length !== 0 ? txs : <p>No public transactions found.</p>}
+    <ul>{accountsBar}</ul>
+    {typeof showAccount !== "undefined" ? txs[showAccount] : <p>No public 
transactions found.</p>}
   </Fragment>;
 }
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]