diff options
author | Sebastian <sebasjm@gmail.com> | 2023-11-06 11:55:15 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-11-06 11:55:15 -0300 |
commit | fa11663ceeb7d9bec470bbc881274c07086f8a92 (patch) | |
tree | 7f9c515d1a47d95a4b58000dbef05656597c88fe /packages/demobank-ui | |
parent | 4ee903eb5e639fa0e122a689cc431e8f18ca1197 (diff) |
refactor bank to use components from web utils
Diffstat (limited to 'packages/demobank-ui')
14 files changed, 79 insertions, 281 deletions
diff --git a/packages/demobank-ui/src/pages/BankFrame.tsx b/packages/demobank-ui/src/pages/BankFrame.tsx index 5561d7b42..f54b049e8 100644 --- a/packages/demobank-ui/src/pages/BankFrame.tsx +++ b/packages/demobank-ui/src/pages/BankFrame.tsx @@ -15,10 +15,9 @@ */ import { Amounts, TalerError, TranslatedString } from "@gnu-taler/taler-util"; -import { Attention, LangSelector, Loading, notifyError, notifyException, useNotifications, useTranslationContext } from "@gnu-taler/web-util/browser"; +import { Footer, GlobalNotificationsBanner, Header, Loading, notifyError, notifyException, useTranslationContext } from "@gnu-taler/web-util/browser"; import { ComponentChildren, Fragment, VNode, h } from "preact"; -import { useEffect, useErrorBoundary, useState } from "preact/hooks"; -import logo from "../assets/logo-2021.svg"; +import { useEffect, useErrorBoundary } from "preact/hooks"; import { useAccountDetails } from "../hooks/access.js"; import { useBackendState } from "../hooks/backend.js"; import { getAllBooleanSettings, getLabelForSetting, useSettings } from "../hooks/settings.js"; @@ -28,14 +27,6 @@ import { RenderAmount } from "./PaytoWireTransferForm.js"; const GIT_HASH = typeof __GIT_HASH__ !== "undefined" ? __GIT_HASH__ : undefined; const VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : undefined; -const versionText = VERSION - ? GIT_HASH - ? <a href={`https://git.taler.net/wallet-core.git/tree/?id=${GIT_HASH}`} target="_blank" rel="noreferrer noopener"> - Version {VERSION} ({GIT_HASH.substring(0, 8)}) - </a> - : VERSION - : ""; - export function BankFrame({ children, @@ -47,7 +38,6 @@ export function BankFrame({ const { i18n } = useTranslationContext(); const backend = useBackendState(); const [settings, updateSettings] = useSettings(); - const [open, setOpen] = useState(false) const [error, resetError] = useErrorBoundary(); @@ -63,188 +53,60 @@ export function BankFrame({ } }, [error]) - const demo_sites = []; - if (bankUiSettings.demoSites) { - for (const i in bankUiSettings.demoSites) - demo_sites.push( - <a href={bankUiSettings.demoSites[i][1]}> - {bankUiSettings.demoSites[i][0]} - </a>, - ); - } + return (<div class="min-h-full flex flex-col m-0 bg-slate-200" style="min-height: 100vh;"> - return (<div class="min-h-full flex flex-col m-0" style="min-height: 100vh;"> <div class="bg-indigo-600 pb-32"> - <nav class=""> - <div class="mx-auto max-w-7xl px-2 "> - <div class="relative flex h-16 items-center justify-between "> - <div class="flex items-center px-2"> - <div class="flex-shrink-0 bg-white rounded-lg"> - <a href={bankUiSettings.iconLinkURL ?? "#"}> - <img - class="h-8 w-auto" - src={logo} - alt="Taler" - style={{ height: "1.5rem", margin: ".5rem" }} - /> - </a> - </div> - {bankUiSettings.demoSites && - <div class="hidden sm:block ml-6 "> - <div class="flex space-x-4"> - {/* <!-- Current: "bg-indigo-700 text-white", Default: "text-white hover:bg-indigo-500 hover:bg-opacity-75" --> */} - {bankUiSettings.demoSites.map(([name, url]) => { - return <a href={url} class="text-white hover:bg-indigo-500 hover:bg-opacity-75 rounded-md py-2 px-3 text-sm font-medium">{name}</a> - })} - </div> - </div> - } - </div> - - <div class="flex"> - <button type="button" class="relative inline-flex items-center justify-center rounded-md bg-indigo-600 p-1 text-indigo-200 hover:bg-indigo-500 hover:bg-opacity-75 hover:text-white focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-indigo-600" aria-controls="mobile-menu" aria-expanded="false" - onClick={(e) => { - setOpen(!open) - }}> - <span class="absolute -inset-0.5"></span> - <span class="sr-only">Open settings</span> - <svg class="block h-10 w-10" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"> - <path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5" /> - </svg> - </button> - </div> + <Header + title="Bank" + iconLinkURL={bankUiSettings.iconLinkURL ?? "#"} + onLogout={backend.state.status !== "loggedIn" ? undefined : () => { + backend.logOut() + updateSettings("currentWithdrawalOperationId", undefined); + }} + sites={bankUiSettings.demoSites ?? []} + supportedLangs={["en", "es", "de"]} + > + <li> + <div class="text-xs font-semibold leading-6 text-gray-400"> + <i18n.Translate>Preferences</i18n.Translate> </div> - </div> - - {open && - <div class="relative z-10" aria-labelledby="slide-over-title" role="dialog" aria-modal="true" - onClick={() => { - setOpen(false) - }}> - <div class="fixed inset-0"></div> - - <div class="fixed inset-0 overflow-hidden"> - <div class="absolute inset-0 overflow-hidden"> - <div class="pointer-events-none fixed inset-y-0 right-0 flex max-w-full pl-10"> - <div class="pointer-events-auto w-screen max-w-md" > - <div class="flex h-full flex-col overflow-y-scroll bg-white py-6 shadow-xl" onClick={(e) => { - //do not trigger close if clicking inside the sidebar - e.stopPropagation(); - }}> - <div class="px-4 sm:px-6" > - <div class="flex items-start justify-between" > - <h2 class="text-base font-semibold leading-6 text-gray-900" id="slide-over-title"> - <i18n.Translate>Menu</i18n.Translate> - </h2> - <div class="ml-3 flex h-7 items-center"> - <button type="button" class="relative rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2" - onClick={(e) => { - setOpen(false) - }} - - > - <span class="absolute -inset-2.5"></span> - <span class="sr-only"> - <i18n.Translate>Close panel</i18n.Translate> - </span> - <svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true"> - <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" /> - </svg> - </button> - </div> - </div> - </div> - <div class="relative mt-6 flex-1 px-4 sm:px-6"> - <nav class="flex flex-1 flex-col" aria-label="Sidebar"> - <ul role="list" class="flex flex-1 flex-col gap-y-7"> - {backend.state.status === "loggedIn" ? - <li> - <a href="#" - class="text-gray-700 hover:text-indigo-600 hover:bg-gray-100 group flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold" - onClick={() => { - backend.logOut(); - setOpen(false) - updateSettings("currentWithdrawalOperationId", undefined); - }} - > - <svg class="h-6 w-6 shrink-0 text-indigo-600" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true"> - <path stroke-linecap="round" stroke-linejoin="round" d="M2.25 12l8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25" /> - </svg> - <i18n.Translate>Log out</i18n.Translate> - </a> - </li> - : undefined} - <li> - <LangSelector supportedLangs={["en", "es", "de"]} /> - </li> - <li> - <div class="text-xs font-semibold leading-6 text-gray-400"> - <i18n.Translate>Preferences</i18n.Translate> - </div> - <ul role="list" class="space-y-1"> - {getAllBooleanSettings().map(set => { - const isOn: boolean = !!settings[set] - return <li class="mt-2 pl-2"> - <div class="flex items-center justify-between"> - <span class="flex flex-grow flex-col"> - <span class="text-sm text-black font-medium leading-6 " id="availability-label"> - {getLabelForSetting(set, i18n)} - </span> - </span> - <button type="button" data-enabled={isOn} class="bg-indigo-600 data-[enabled=false]:bg-gray-200 relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2" role="switch" aria-checked="false" aria-labelledby="availability-label" aria-describedby="availability-description" - - onClick={() => { updateSettings(set, !isOn); }}> - <span aria-hidden="true" data-enabled={isOn} class="translate-x-5 data-[enabled=false]:translate-x-0 pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out"></span> - </button> - </div> - </li> - })} - </ul> - </li> - {bankUiSettings.demoSites && - <li class="sm:hidden"> - <div class="text-xs font-semibold leading-6 text-gray-400"> - <i18n.Translate>Sites</i18n.Translate> - </div> - <ul role="list" class="space-y-1"> - {bankUiSettings.demoSites.map(([name, url]) => { - return <li> - <a href={url} target="_blank" rel="noopener noreferrer" class="text-gray-700 hover:text-indigo-600 hover:bg-gray-100 group flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold"> - <span class="flex h-6 w-6 shrink-0 items-center justify-center rounded-lg border text-[0.625rem] font-medium bg-white text-gray-400 border-gray-200 group-hover:border-indigo-600 group-hover:text-indigo-600">></span> - <span class="truncate">{name}</span> - </a> - </li> - })} - </ul> - </li> - } - </ul> - </nav> - </div> - </div> - </div> + <ul role="list" class="space-y-1"> + {getAllBooleanSettings().map(set => { + const isOn: boolean = !!settings[set] + return <li class="mt-2 pl-2"> + <div class="flex items-center justify-between"> + <span class="flex flex-grow flex-col"> + <span class="text-sm text-black font-medium leading-6 " id="availability-label"> + {getLabelForSetting(set, i18n)} + </span> + </span> + <button type="button" data-enabled={isOn} class="bg-indigo-600 data-[enabled=false]:bg-gray-200 relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2" role="switch" aria-checked="false" aria-labelledby="availability-label" aria-describedby="availability-description" + + onClick={() => { updateSettings(set, !isOn); }}> + <span aria-hidden="true" data-enabled={isOn} class="translate-x-5 data-[enabled=false]:translate-x-0 pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out"></span> + </button> </div> - </div> - </div> - </div> - } - </nav > + </li> + })} + </ul> + </li> + </Header> + </div > + <GlobalNotificationsBanner /> + + <main class="-mt-32 flex-1"> {account && - <header class="py-5 border-t border-indigo-300 border-opacity-25 bg-indigo-600 lg:border-t lg:border-indigo-400 lg:border-opacity-25"> + <header class="py-5 bg-indigo-600 "> <div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8"> - <div class=" flex flex-wrap items-center justify-between sm:flex-nowrap"> - <h3 class="text-2xl font-bold tracking-tight text-white"><WelcomeAccount account={account} /></h3> - <h3 class="text-2xl font-bold tracking-tight text-white"><AccountBalance account={account} /></h3> - </div> + <h1 class=" flex flex-wrap items-center justify-between sm:flex-nowrap"> + <span class="text-2xl font-bold tracking-tight text-white"><WelcomeAccount account={account} /></span> + <span class="text-2xl font-bold tracking-tight text-white"><AccountBalance account={account} /></span> + </h1> </div> - </header> } - </div > - <StatusBanner /> - <main class="-mt-32 flex-1"> <div class="mx-auto max-w-7xl px-4 pb-12 sm:px-6 lg:px-8"> <div class="rounded-lg bg-white px-5 py-6 shadow sm:px-6"> {children} @@ -252,7 +114,12 @@ export function BankFrame({ </div> </main> - <Footer /> + <Footer + testingUrl={localStorage.getItem("bank-base-url") ?? undefined} + GIT_HASH={GIT_HASH} + VERSION={VERSION} + /> + </div > ); @@ -269,75 +136,6 @@ function MaybeShowDebugInfo({ info }: { info: any }): VNode { } -function StatusBanner(): VNode { - const notifs = useNotifications() - if (notifs.length === 0) return <Fragment /> - return <div class="fixed z-20 w-full p-4"> { - notifs.map(n => { - switch (n.message.type) { - case "error": - return <Attention type="danger" title={n.message.title} onClose={() => { - n.remove() - }}> - {n.message.description && - <div class="mt-2 text-sm text-red-700"> - {n.message.description} - </div> - } - <MaybeShowDebugInfo info={n.message.debug} /> - </Attention> - case "info": - return <Attention type="success" title={n.message.title} onClose={() => { - n.remove(); - }} /> - } - })} - </div> - -} - -function TestingTag(): VNode { - const testingUrl = localStorage.getItem("bank-base-url"); - if (!testingUrl) return <Fragment />; - return ( - <p class="text-xs leading-5 text-gray-300"> - Testing with {testingUrl}{" "} - <a - href="" - onClick={(e) => { - e.preventDefault(); - localStorage.removeItem("bank-base-url"); - window.location.reload(); - }} - > - stop testing - </a> - </p> - ); -} - -function Footer() { - const { i18n } = useTranslationContext() - return ( - <footer class="bottom-4 mb-4"> - <div class="mt-8 mx-8 md:order-1 md:mt-0"> - <div> - <p class="text-xs leading-5 text-gray-400"> - <i18n.Translate> - Learn more about <a target="_blank" rel="noreferrer noopener" class="font-semibold text-gray-500 hover:text-gray-400" href="https://taler.net">GNU Taler</a> - </i18n.Translate> - </p> - </div> - <div style="flex-grow:1" /> - <p class="text-xs leading-5 text-gray-400"> - Copyright © 2014—2023 Taler Systems SA. {versionText}{" "} - <TestingTag /> - </p> - </div> - </footer> - ); -} - function WelcomeAccount({ account: accountName }: { account: string }): VNode { const { i18n } = useTranslationContext(); return <a href="#/my-profile" class="underline underline-offset-2"> diff --git a/packages/demobank-ui/src/pages/LoginForm.tsx b/packages/demobank-ui/src/pages/LoginForm.tsx index 707c1e688..57b0b41c5 100644 --- a/packages/demobank-ui/src/pages/LoginForm.tsx +++ b/packages/demobank-ui/src/pages/LoginForm.tsx @@ -26,7 +26,7 @@ import { undefinedIfEmpty, withRuntimeErrorHandling } from "../utils.js"; import { assertUnreachable } from "./WithdrawalOperationPage.js"; import { doAutoFocus } from "./PaytoWireTransferForm.js"; import { Attention } from "@gnu-taler/web-util/browser"; -import { ShowLocalNotification } from "@gnu-taler/web-util/browser"; +import { LocalNotificationBanner } from "@gnu-taler/web-util/browser"; /** @@ -109,8 +109,8 @@ export function LoginForm({ reason, onRegister }: { reason?: "not-found" | "forb } return ( - <div class="flex min-h-full flex-col justify-center"> - <ShowLocalNotification notification={notification} /> + <div class="flex min-h-full flex-col justify-center "> + <LocalNotificationBanner notification={notification} /> <div class="mt-10 sm:mx-auto sm:w-full sm:max-w-sm"> <form class="space-y-6" noValidate onSubmit={(e) => { diff --git a/packages/demobank-ui/src/pages/OperationState/views.tsx b/packages/demobank-ui/src/pages/OperationState/views.tsx index 2c4019de2..916a2bd98 100644 --- a/packages/demobank-ui/src/pages/OperationState/views.tsx +++ b/packages/demobank-ui/src/pages/OperationState/views.tsx @@ -23,7 +23,7 @@ import { ShowInputErrorLabel } from "@gnu-taler/web-util/browser"; import { useSettings } from "../../hooks/settings.js"; import { undefinedIfEmpty } from "../../utils.js"; import { State } from "./index.js"; -import { ShowLocalNotification } from "@gnu-taler/web-util/browser"; +import { LocalNotificationBanner } from "@gnu-taler/web-util/browser"; import { ErrorLoading } from "@gnu-taler/web-util/browser"; import { Attention } from "@gnu-taler/web-util/browser"; import { assertUnreachable } from "../WithdrawalOperationPage.js"; @@ -142,7 +142,7 @@ export function NeedConfirmationView({ error, onAbort: doAbort, onConfirm: doCon return ( <div class="bg-white shadow sm:rounded-lg"> - <ShowLocalNotification notification={notification} /> + <LocalNotificationBanner notification={notification} /> <div class="px-4 py-5 sm:p-6"> <h3 class="text-base font-semibold text-gray-900"> <i18n.Translate>Confirm the withdrawal operation</i18n.Translate> @@ -463,7 +463,7 @@ export function ReadyView({ uri, onClose: doClose }: State.Ready): VNode<{}> { } return <Fragment> - <ShowLocalNotification notification={notification} /> + <LocalNotificationBanner notification={notification} /> <div class="flex justify-end mt-4"> <button type="button" diff --git a/packages/demobank-ui/src/pages/PaytoWireTransferForm.tsx b/packages/demobank-ui/src/pages/PaytoWireTransferForm.tsx index 55eba423c..4f7b25f6d 100644 --- a/packages/demobank-ui/src/pages/PaytoWireTransferForm.tsx +++ b/packages/demobank-ui/src/pages/PaytoWireTransferForm.tsx @@ -41,7 +41,7 @@ import { withRuntimeErrorHandling } from "../utils.js"; import { assertUnreachable } from "./WithdrawalOperationPage.js"; -import { ShowLocalNotification } from "@gnu-taler/web-util/browser"; +import { LocalNotificationBanner } from "@gnu-taler/web-util/browser"; const logger = new Logger("PaytoWireTransferForm"); @@ -390,7 +390,7 @@ export function PaytoWireTransferForm({ <i18n.Translate>Send</i18n.Translate> </button> </div> - <ShowLocalNotification notification={notification} /> + <LocalNotificationBanner notification={notification} /> </form> </div > ) diff --git a/packages/demobank-ui/src/pages/QrCodeSection.tsx b/packages/demobank-ui/src/pages/QrCodeSection.tsx index e8c1a0e6e..f1394b3f6 100644 --- a/packages/demobank-ui/src/pages/QrCodeSection.tsx +++ b/packages/demobank-ui/src/pages/QrCodeSection.tsx @@ -29,7 +29,7 @@ import { QR } from "../components/QR.js"; import { useBankCoreApiContext } from "../context/config.js"; import { withRuntimeErrorHandling } from "../utils.js"; import { assertUnreachable } from "./WithdrawalOperationPage.js"; -import { ShowLocalNotification } from "@gnu-taler/web-util/browser"; +import { LocalNotificationBanner } from "@gnu-taler/web-util/browser"; export function QrCodeSection({ withdrawUri, @@ -89,7 +89,7 @@ export function QrCodeSection({ return ( <Fragment> - <ShowLocalNotification notification={notification} /> + <LocalNotificationBanner notification={notification} /> <div class="bg-white shadow-xl sm:rounded-lg"> <div class="px-4 py-5 sm:p-6"> <h3 class="text-base font-semibold leading-6 text-gray-900"> diff --git a/packages/demobank-ui/src/pages/RegistrationPage.tsx b/packages/demobank-ui/src/pages/RegistrationPage.tsx index e8969afb9..cade4a277 100644 --- a/packages/demobank-ui/src/pages/RegistrationPage.tsx +++ b/packages/demobank-ui/src/pages/RegistrationPage.tsx @@ -26,7 +26,7 @@ import { useBackendState } from "../hooks/backend.js"; import { bankUiSettings } from "../settings.js"; import { undefinedIfEmpty, withRuntimeErrorHandling } from "../utils.js"; import { getRandomPassword, getRandomUsername } from "./rnd.js"; -import { ShowLocalNotification } from "@gnu-taler/web-util/browser"; +import { LocalNotificationBanner } from "@gnu-taler/web-util/browser"; const logger = new Logger("RegistrationPage"); @@ -185,7 +185,7 @@ function RegistrationForm({ onComplete, onCancel }: { onComplete: () => void, on return ( <Fragment> - <ShowLocalNotification notification={notification} /> + <LocalNotificationBanner notification={notification} /> <div class="flex min-h-full flex-col justify-center"> <div class="sm:mx-auto sm:w-full sm:max-w-sm"> diff --git a/packages/demobank-ui/src/pages/ShowAccountDetails.tsx b/packages/demobank-ui/src/pages/ShowAccountDetails.tsx index 43fd39205..2e00fdbba 100644 --- a/packages/demobank-ui/src/pages/ShowAccountDetails.tsx +++ b/packages/demobank-ui/src/pages/ShowAccountDetails.tsx @@ -12,7 +12,7 @@ import { LoginForm } from "./LoginForm.js"; import { ProfileNavigation } from "./ProfileNavigation.js"; import { assertUnreachable } from "./WithdrawalOperationPage.js"; import { AccountForm } from "./admin/AccountForm.js"; -import { ShowLocalNotification } from "@gnu-taler/web-util/browser"; +import { LocalNotificationBanner } from "@gnu-taler/web-util/browser"; export function ShowAccountDetails({ account, @@ -94,7 +94,7 @@ export function ShowAccountDetails({ return ( <Fragment> - <ShowLocalNotification notification={notification} /> + <LocalNotificationBanner notification={notification} /> {accountIsTheCurrentUser ? <ProfileNavigation current="details" /> : diff --git a/packages/demobank-ui/src/pages/UpdateAccountPassword.tsx b/packages/demobank-ui/src/pages/UpdateAccountPassword.tsx index 759182997..47f8a5750 100644 --- a/packages/demobank-ui/src/pages/UpdateAccountPassword.tsx +++ b/packages/demobank-ui/src/pages/UpdateAccountPassword.tsx @@ -8,7 +8,7 @@ import { undefinedIfEmpty, withRuntimeErrorHandling } from "../utils.js"; import { doAutoFocus } from "./PaytoWireTransferForm.js"; import { ProfileNavigation } from "./ProfileNavigation.js"; import { assertUnreachable } from "./WithdrawalOperationPage.js"; -import { ShowLocalNotification } from "@gnu-taler/web-util/browser"; +import { LocalNotificationBanner } from "@gnu-taler/web-util/browser"; export function UpdateAccountPassword({ account: accountName, @@ -79,7 +79,7 @@ export function UpdateAccountPassword({ return ( <Fragment> - <ShowLocalNotification notification={notification} /> + <LocalNotificationBanner notification={notification} /> {accountIsTheCurrentUser ? <ProfileNavigation current="credentials" /> : <h1 class="text-base font-semibold leading-6 text-gray-900"> diff --git a/packages/demobank-ui/src/pages/WalletWithdrawForm.tsx b/packages/demobank-ui/src/pages/WalletWithdrawForm.tsx index 9a45e6285..a9a661c25 100644 --- a/packages/demobank-ui/src/pages/WalletWithdrawForm.tsx +++ b/packages/demobank-ui/src/pages/WalletWithdrawForm.tsx @@ -37,7 +37,7 @@ import { undefinedIfEmpty, withRuntimeErrorHandling } from "../utils.js"; import { OperationState } from "./OperationState/index.js"; import { InputAmount, doAutoFocus } from "./PaytoWireTransferForm.js"; import { assertUnreachable } from "./WithdrawalOperationPage.js"; -import { ShowLocalNotification } from "@gnu-taler/web-util/browser"; +import { LocalNotificationBanner } from "@gnu-taler/web-util/browser"; const logger = new Logger("WalletWithdrawForm"); const RefAmount = forwardRef(InputAmount); @@ -144,7 +144,7 @@ function OldWithdrawalForm({ goToConfirmOperation, limit, onCancel, focus }: { e.preventDefault() }} > - <ShowLocalNotification notification={notification} /> + <LocalNotificationBanner notification={notification} /> <div class="px-4 py-6 "> <div class="grid max-w-xs grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6"> diff --git a/packages/demobank-ui/src/pages/WithdrawalConfirmationQuestion.tsx b/packages/demobank-ui/src/pages/WithdrawalConfirmationQuestion.tsx index f34e8a919..0b339030e 100644 --- a/packages/demobank-ui/src/pages/WithdrawalConfirmationQuestion.tsx +++ b/packages/demobank-ui/src/pages/WithdrawalConfirmationQuestion.tsx @@ -37,7 +37,7 @@ import { useSettings } from "../hooks/settings.js"; import { undefinedIfEmpty, withRuntimeErrorHandling } from "../utils.js"; import { RenderAmount } from "./PaytoWireTransferForm.js"; import { assertUnreachable } from "./WithdrawalOperationPage.js"; -import { ShowLocalNotification } from "@gnu-taler/web-util/browser"; +import { LocalNotificationBanner } from "@gnu-taler/web-util/browser"; const logger = new Logger("WithdrawalConfirmationQuestion"); @@ -167,7 +167,7 @@ export function WithdrawalConfirmationQuestion({ return ( <Fragment> - <ShowLocalNotification notification={notification} /> + <LocalNotificationBanner notification={notification} /> <div class="bg-white shadow sm:rounded-lg"> <div class="px-4 py-5 sm:p-6"> diff --git a/packages/demobank-ui/src/pages/admin/CreateNewAccount.tsx b/packages/demobank-ui/src/pages/admin/CreateNewAccount.tsx index 0369a6283..bdec2a2a9 100644 --- a/packages/demobank-ui/src/pages/admin/CreateNewAccount.tsx +++ b/packages/demobank-ui/src/pages/admin/CreateNewAccount.tsx @@ -10,7 +10,7 @@ import { withRuntimeErrorHandling } from "../../utils.js"; import { assertUnreachable } from "../WithdrawalOperationPage.js"; import { getRandomPassword } from "../rnd.js"; import { AccountForm, AccountFormData } from "./AccountForm.js"; -import { ShowLocalNotification } from "@gnu-taler/web-util/browser"; +import { LocalNotificationBanner } from "@gnu-taler/web-util/browser"; export function CreateNewAccount({ onCancel, @@ -99,7 +99,7 @@ export function CreateNewAccount({ return ( <div class="grid grid-cols-1 gap-x-8 gap-y-8 pt-10 md:grid-cols-3 bg-gray-100 my-4 px-4 pb-4 rounded-lg"> - <ShowLocalNotification notification={notification} /> + <LocalNotificationBanner notification={notification} /> <div class="px-4 sm:px-0"> <h2 class="text-base font-semibold leading-7 text-gray-900"> diff --git a/packages/demobank-ui/src/pages/admin/RemoveAccount.tsx b/packages/demobank-ui/src/pages/admin/RemoveAccount.tsx index 01136fdaf..0519d085a 100644 --- a/packages/demobank-ui/src/pages/admin/RemoveAccount.tsx +++ b/packages/demobank-ui/src/pages/admin/RemoveAccount.tsx @@ -13,7 +13,7 @@ import { undefinedIfEmpty } from "../../utils.js"; import { LoginForm } from "../LoginForm.js"; import { doAutoFocus } from "../PaytoWireTransferForm.js"; import { assertUnreachable } from "../WithdrawalOperationPage.js"; -import { ShowLocalNotification } from "@gnu-taler/web-util/browser"; +import { LocalNotificationBanner } from "@gnu-taler/web-util/browser"; export function RemoveAccount({ account, @@ -112,7 +112,7 @@ export function RemoveAccount({ return ( <div> - <ShowLocalNotification notification={notification} /> + <LocalNotificationBanner notification={notification} /> <Attention type="warning" title={i18n.str`You are going to remove the account`}> <i18n.Translate>This step can't be undone.</i18n.Translate> diff --git a/packages/demobank-ui/src/pages/business/CreateCashout.tsx b/packages/demobank-ui/src/pages/business/CreateCashout.tsx index 735d84847..10be5ec11 100644 --- a/packages/demobank-ui/src/pages/business/CreateCashout.tsx +++ b/packages/demobank-ui/src/pages/business/CreateCashout.tsx @@ -43,7 +43,7 @@ import { import { LoginForm } from "../LoginForm.js"; import { InputAmount } from "../PaytoWireTransferForm.js"; import { assertUnreachable } from "../WithdrawalOperationPage.js"; -import { ShowLocalNotification } from "@gnu-taler/web-util/browser"; +import { LocalNotificationBanner } from "@gnu-taler/web-util/browser"; interface Props { account: string; @@ -177,7 +177,7 @@ export function CreateCashout({ return ( <div> - <ShowLocalNotification notification={notification} /> + <LocalNotificationBanner notification={notification} /> <h1>New cashout</h1> <form class="pure-form"> <fieldset> diff --git a/packages/demobank-ui/src/pages/business/ShowCashoutDetails.tsx b/packages/demobank-ui/src/pages/business/ShowCashoutDetails.tsx index 80e585cf5..4646e9220 100644 --- a/packages/demobank-ui/src/pages/business/ShowCashoutDetails.tsx +++ b/packages/demobank-ui/src/pages/business/ShowCashoutDetails.tsx @@ -39,7 +39,7 @@ import { withRuntimeErrorHandling } from "../../utils.js"; import { assertUnreachable } from "../WithdrawalOperationPage.js"; -import { ShowLocalNotification } from "@gnu-taler/web-util/browser"; +import { LocalNotificationBanner } from "@gnu-taler/web-util/browser"; interface Props { id: string; @@ -78,7 +78,7 @@ export function ShowCashoutDetails({ const isPending = String(result.body.status).toUpperCase() === "PENDING"; return ( <div> - <ShowLocalNotification notification={notification} /> + <LocalNotificationBanner notification={notification} /> <h1>Cashout details {id}</h1> <form class="pure-form"> <fieldset> |