merchant-backoffice

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

commit 54457bc6bdfe9ee61c3678012729f7199abf2a81
parent bba1e67eacbb7fd6ccba60d10a9b8c2deef3af70
Author: ms <ms@taler.net>
Date:   Thu,  7 Apr 2022 11:56:42 +0200

copying pybank's look - fix public accounts bar.  WIP

Diffstat:
Mpackages/bank/src/pages/home/index.tsx | 44++++++++++++++++++++++++++------------------
1 file changed, 26 insertions(+), 18 deletions(-)

diff --git a/packages/bank/src/pages/home/index.tsx b/packages/bank/src/pages/home/index.tsx @@ -1453,33 +1453,36 @@ function PublicHistories(Props: any): VNode { * Show the account specified in the props, or just one * from the list if that's not given. */ - if (typeof showAccount === "undefined" && Object.keys(txs).length > 0) - setShowAccount(Object.keys(txs).pop()); + if (typeof showAccount === "undefined" && data.publicAccounts.length > 0) + setShowAccount(data.publicAccounts[1].accountLabel); console.log(`Public history tab: ${showAccount}`); // Ask first story of all the public accounts. for (const account of data.publicAccounts) { console.log("Asking transactions for", account.accountLabel) + const isSelected = account.accountLabel == showAccount; accountsBar.push( - <li> - <a - class={(account.accountLabel == showAccount) ? "pure-menu-item pure-menu" : "pure-menu-item pure-menu-selected"} - onClick={() => setShowAccount(account.accountLabel)}>{account.accountLabel}</a> + <li class={isSelected ? "pure-menu-selected pure-menu-item" : "pure-menu-item pure-menu"}> + <a href="#" + class="pure-menu-link" + onClick={() => setShowAccount(account.accountLabel)}>{account.accountLabel}</a> </li> ); txs[account.accountLabel] = <Transactions accountLabel={account.accountLabel} pageNumber={0} /> } - return <Fragment> + return (<Fragment> <h1 class="nav">{i18n`History of public accounts`}</h1> <section id="main"> - <div name="accountMenu" class="pure-menu pure-menu-horizontal"> - <ul class="pure-menu-list">{accountsBar}</ul> - {typeof showAccount !== "undefined" ? txs[showAccount] : <p>No public transactions found.</p>} - {Props.children} - </div> + <article> + <div class="pure-menu pure-menu-horizontal" name="accountMenu"> + <ul class="pure-menu-list">{accountsBar}</ul> + {typeof showAccount !== "undefined" ? txs[showAccount] : <p>No public transactions found.</p>} + {Props.children} + </div> + </article> </section> - </Fragment>; + </Fragment>); } /** @@ -1495,11 +1498,16 @@ export function BankHome(): VNode { if (pageState.showPublicHistories) { return (<SWRWithoutCredentials baseUrl={getRootPath()}> - <PublicHistories pageStateSetter={pageStateSetter}> - <a onClick={() => { - pageStateSetter((prevState: PageStateType) => - ({...prevState, showPublicHistories: false}))}}>Go back</a> - </PublicHistories> + <PageContext.Provider value={[pageState, pageStateSetter]}> + <BankFrame> + <PublicHistories pageStateSetter={pageStateSetter}> + <br /> + <a class="pure-button" onClick={() => { + pageStateSetter((prevState: PageStateType) => + ({...prevState, showPublicHistories: false}))}}>Go back</a> + </PublicHistories> + </BankFrame> + </PageContext.Provider> </SWRWithoutCredentials>); }