From dfd23f63ba40a2afb0cb41bf742b0ae647a2b38c Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 22 Sep 2023 12:41:43 -0300 Subject: more ui --- .../demobank-ui/src/pages/admin/AccountList.tsx | 269 +++++++++------------ packages/demobank-ui/src/pages/admin/Home.tsx | 4 +- 2 files changed, 121 insertions(+), 152 deletions(-) (limited to 'packages/demobank-ui/src/pages/admin') diff --git a/packages/demobank-ui/src/pages/admin/AccountList.tsx b/packages/demobank-ui/src/pages/admin/AccountList.tsx index 56d9c45f9..eb5765533 100644 --- a/packages/demobank-ui/src/pages/admin/AccountList.tsx +++ b/packages/demobank-ui/src/pages/admin/AccountList.tsx @@ -6,163 +6,132 @@ import { Amounts } from "@gnu-taler/taler-util"; import { useTranslationContext } from "@gnu-taler/web-util/browser"; interface Props { - onAction: (type: AccountAction, account: string) => void; - account: string | undefined; - onRegister: () => void; - onCreateAccount: () => void; + onAction: (type: AccountAction, account: string) => void; + account: string | undefined; + onRegister: () => void; + onCreateAccount: () => void; } export function AccountList({ account, onAction, onCreateAccount, onRegister }: Props): VNode { - const result = useBusinessAccounts({ account }); - const { i18n } = useTranslationContext(); + const result = useBusinessAccounts({ account }); + const { i18n } = useTranslationContext(); - if (result.loading) return
; - if (!result.ok) { - return handleNotOkResult(i18n, onRegister)(result); - } + if (result.loading) return
; + if (!result.ok) { + return handleNotOkResult(i18n, onRegister)(result); + } - const { customers } = result.data; - return
-
-
-

- Accounts -

-

- A list of all business account in the bank. -

-
-
- -
-
-
-
-
- {!customers.length ? ( -
- ) : ( - - - - - - - - - - - {customers.map((item, idx) => { - const balance = !item.balance - ? undefined - : Amounts.parse(item.balance.amount); - const balanceIsDebit = - item.balance && - item.balance.credit_debit_indicator == "debit"; + const { customers } = result.data; + return
+
+
+

+ Accounts +

+

+ A list of all business account in the bank. +

+
+
+ +
+
+
+
+
+ {!customers.length ? ( +
+ ) : ( +
{i18n.str`Username`}{i18n.str`Name`}{i18n.str`Balance`} - {i18n.str`Actions`} -
+ + + + + + + + + + {customers.map((item, idx) => { + const balance = !item.balance + ? undefined + : Amounts.parse(item.balance.amount); + const balanceIsDebit = + item.balance && + item.balance.credit_debit_indicator == "debit"; - return - - - - - - })} + return + -
{i18n.str`Username`}{i18n.str`Name`}{i18n.str`Balance`} + {i18n.str`Actions`} +
- {item.username} - - {item.name} - - {!balance ? ( - i18n.str`unknown` - ) : ( - - {balanceIsDebit ? - : null} - {`${Amounts.stringifyValue( - balance, - )}`} -   - {`${balance.currency}`} - - )} - - { - e.preventDefault(); - onAction("update-password", item.username) - }} - > - change password - -
- { - e.preventDefault(); - onAction("show-cashout", item.username) - }} - > - cashouts - -
- { - e.preventDefault(); - onAction("remove-account", item.username) - }} - > - remove - -
+ { + e.preventDefault(); + onAction("show-details", item.username) + }} + > + {item.username} + - {/* */} -
- )} -
-
-
-
- // return
- //
- //

{i18n.str`Accounts:`}

- //
- // - // - // return ( - // - // - // - // - // + + + + + })} - // - // - // ); - // })} - // - //
- // { - // e.preventDefault(); - // onAction("show-details", item.username) - // }} - // > - // {item.username} - // - // {item.name} - // - // + + {item.name} + + {!balance ? ( + i18n.str`unknown` + ) : ( + + {balanceIsDebit ? - : null} + {`${Amounts.stringifyValue( + balance, + )}`} +   + {`${balance.currency}`} + + )} + + { + e.preventDefault(); + onAction("update-password", item.username) + }} + > + change password + +
+ { + e.preventDefault(); + onAction("show-cashout", item.username) + }} + > + cashouts + +
+ { + e.preventDefault(); + onAction("remove-account", item.username) + }} + > + remove + +
- //
- //
- // )} - //
+ + + )} +
+
+ + } \ No newline at end of file diff --git a/packages/demobank-ui/src/pages/admin/Home.tsx b/packages/demobank-ui/src/pages/admin/Home.tsx index 625a49d45..5033b7fdc 100644 --- a/packages/demobank-ui/src/pages/admin/Home.tsx +++ b/packages/demobank-ui/src/pages/admin/Home.tsx @@ -35,7 +35,7 @@ export function AdminHome({ onRegister }: Props): VNode { if (action) { switch (action.type) { - case "show-details": return { @@ -93,7 +93,7 @@ export function AdminHome({ onRegister }: Props): VNode { setAction(undefined); }} /> - case "show-cashouts-details": return { -- cgit v1.2.3