merchant-backoffice

ZZZ: Inactive/Deprecated
Log | Files | Refs | Submodules | README

commit 56e0c024fab54143d206bc2097925caa2a1db3f2
parent 93541e11d9d19ff578c89e8ffcf66bfd5ec91562
Author: MS <ms@taler.net>
Date:   Thu, 17 Feb 2022 11:26:46 +0100

serve public histories from tabs

Diffstat:
Mpackages/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 @@ -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>; }