aboutsummaryrefslogtreecommitdiff
path: root/packages/demobank-ui/src/pages/admin
diff options
context:
space:
mode:
Diffstat (limited to 'packages/demobank-ui/src/pages/admin')
-rw-r--r--packages/demobank-ui/src/pages/admin/Account.tsx3
-rw-r--r--packages/demobank-ui/src/pages/admin/AccountList.tsx5
-rw-r--r--packages/demobank-ui/src/pages/admin/AdminHome.tsx41
-rw-r--r--packages/demobank-ui/src/pages/admin/CreateNewAccount.tsx28
-rw-r--r--packages/demobank-ui/src/pages/admin/RemoveAccount.tsx5
5 files changed, 47 insertions, 35 deletions
diff --git a/packages/demobank-ui/src/pages/admin/Account.tsx b/packages/demobank-ui/src/pages/admin/Account.tsx
index 7109b082f..19189bec4 100644
--- a/packages/demobank-ui/src/pages/admin/Account.tsx
+++ b/packages/demobank-ui/src/pages/admin/Account.tsx
@@ -23,9 +23,8 @@ export function WireTransfer({ toAccount, onRegister, onCancel, onSuccess }: { o
}
if (result.type === "fail") {
switch (result.case) {
- case "unauthorized": return <LoginForm reason="forbidden" />
+ case "unauthorized": return <LoginForm reason="forbidden" />
case "not-found": return <LoginForm reason="not-found" />
- case "no-rights": return <LoginForm reason="not-found" />
default: assertUnreachable(result)
}
}
diff --git a/packages/demobank-ui/src/pages/admin/AccountList.tsx b/packages/demobank-ui/src/pages/admin/AccountList.tsx
index 056035750..be5194e6d 100644
--- a/packages/demobank-ui/src/pages/admin/AccountList.tsx
+++ b/packages/demobank-ui/src/pages/admin/AccountList.tsx
@@ -30,9 +30,8 @@ export function AccountList({ onRemoveAccount, onShowAccountDetails, onUpdateAcc
}
if (result.data.type === "fail") {
switch (result.data.case) {
- case "unauthorized": return <Fragment/>
- case "no-rights": return <Fragment/>
- default: assertUnreachable(result.data)
+ case "unauthorized": return <Fragment />
+ default: assertUnreachable(result.data.case)
}
}
diff --git a/packages/demobank-ui/src/pages/admin/AdminHome.tsx b/packages/demobank-ui/src/pages/admin/AdminHome.tsx
index 1e3d3d748..a30cae547 100644
--- a/packages/demobank-ui/src/pages/admin/AdminHome.tsx
+++ b/packages/demobank-ui/src/pages/admin/AdminHome.tsx
@@ -124,25 +124,28 @@ function Metrics(): VNode {
</div>
<dl class="mt-5 grid grid-cols-1 divide-y divide-gray-200 overflow-hidden rounded-lg bg-white shadow-lg md:grid-cols-3 md:divide-x md:divide-y-0">
- <div class="px-4 py-5 sm:p-6">
- <dt class="text-base font-normal text-gray-900">
- <i18n.Translate>Cashin</i18n.Translate>
- </dt>
- <MetricValue
- current={resp.current.body.cashinExternalVolume}
- previous={resp.previous.body.cashinExternalVolume}
- />
- </div>
-
- <div class="px-4 py-5 sm:p-6">
- <dt class="text-base font-normal text-gray-900">
- <i18n.Translate>Cashout</i18n.Translate>
- </dt>
- <MetricValue
- current={resp.current.body.cashoutExternalVolume}
- previous={resp.previous.body.cashoutExternalVolume}
- />
- </div>
+ {resp.current.body.type !== "with-cashout" || resp.previous.body.type !== "with-cashout" ? undefined :
+ <Fragment>
+ <div class="px-4 py-5 sm:p-6">
+ <dt class="text-base font-normal text-gray-900">
+ <i18n.Translate>Cashin</i18n.Translate>
+ </dt>
+ <MetricValue
+ current={resp.current.body.cashinExternalVolume}
+ previous={resp.previous.body.cashinExternalVolume}
+ />
+ </div>
+ <div class="px-4 py-5 sm:p-6">
+ <dt class="text-base font-normal text-gray-900">
+ <i18n.Translate>Cashout</i18n.Translate>
+ </dt>
+ <MetricValue
+ current={resp.current.body.cashoutExternalVolume}
+ previous={resp.previous.body.cashoutExternalVolume}
+ />
+ </div>
+ </Fragment>
+ }
<div class="px-4 py-5 sm:p-6">
<dt class="text-base font-normal text-gray-900">
<i18n.Translate>Payout</i18n.Translate>
diff --git a/packages/demobank-ui/src/pages/admin/CreateNewAccount.tsx b/packages/demobank-ui/src/pages/admin/CreateNewAccount.tsx
index f2c1d5456..3f4364c16 100644
--- a/packages/demobank-ui/src/pages/admin/CreateNewAccount.tsx
+++ b/packages/demobank-ui/src/pages/admin/CreateNewAccount.tsx
@@ -49,27 +49,39 @@ export function CreateNewAccount({
onCreateSuccess();
} else {
switch (resp.case) {
- case "invalid-input": return notify({
+ case "invalid-phone-or-email": return notify({
type: "error",
- title: i18n.str`Server replied that input data was invalid`,
+ title: i18n.str`Server replied with invalid phone or email`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
})
- case "unable-to-create": return notify({
+ case "unauthorized": return notify({
type: "error",
- title: i18n.str`The account name is registered.`,
+ title: i18n.str`The rights to perform the operation are not sufficient`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
})
- case "unauthorized": return notify({
+ case "username-already-exists": return notify({
type: "error",
- title: i18n.str`The rights to perform the operation are not sufficient`,
+ title: i18n.str`Account username is already taken`,
+ description: resp.detail.hint as TranslatedString,
+ debug: resp.detail,
+ })
+ case "payto-already-exists": return notify({
+ type: "error",
+ title: i18n.str`Account id is already taken`,
+ description: resp.detail.hint as TranslatedString,
+ debug: resp.detail,
+ })
+ case "insufficient-funds": return notify({
+ type: "error",
+ title: i18n.str`Bank ran out of bonus credit.`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
})
- case "already-exist": return notify({
+ case "username-reserved": return notify({
type: "error",
- title: i18n.str`Account name is already taken`,
+ title: i18n.str`Account username can't be used because is reserved`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
})
diff --git a/packages/demobank-ui/src/pages/admin/RemoveAccount.tsx b/packages/demobank-ui/src/pages/admin/RemoveAccount.tsx
index 1a5255595..fa9693941 100644
--- a/packages/demobank-ui/src/pages/admin/RemoveAccount.tsx
+++ b/packages/demobank-ui/src/pages/admin/RemoveAccount.tsx
@@ -45,7 +45,6 @@ export function RemoveAccount({
switch (result.case) {
case "unauthorized": return <LoginForm reason="forbidden" />
case "not-found": return <LoginForm reason="not-found" />
- case "no-rights": return <LoginForm reason="not-found" />
default: assertUnreachable(result)
}
}
@@ -82,9 +81,9 @@ export function RemoveAccount({
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
})
- case "unable-to-delete": return notify({
+ case "username-reserved": return notify({
type: "error",
- title: i18n.str`The administrator specified a institutional username.`,
+ title: i18n.str`Can't delete a reserved username.`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
})