From f68585db5f9ba0f760e22dada474fd7ec2847796 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 5 Feb 2024 14:59:02 -0300 Subject: pretty --- packages/demobank-ui/src/Routing.tsx | 88 ++++++++++++++++------ .../src/components/Transactions/state.ts | 54 ++++++------- .../src/components/Transactions/views.tsx | 4 +- packages/demobank-ui/src/context/navigation.ts | 39 ++++++---- .../demobank-ui/src/context/wallet-integration.ts | 43 +++++------ packages/demobank-ui/src/index.html | 42 +++++------ packages/demobank-ui/src/pages/BankFrame.tsx | 23 ++++-- packages/demobank-ui/src/pages/DownloadStats.tsx | 19 +++-- packages/demobank-ui/src/pages/LoginForm.tsx | 4 +- .../demobank-ui/src/pages/OperationState/views.tsx | 4 +- packages/demobank-ui/src/pages/PaymentOptions.tsx | 58 +++++++++----- .../src/pages/PaytoWireTransferForm.tsx | 14 ++-- .../demobank-ui/src/pages/ProfileNavigation.tsx | 2 +- packages/demobank-ui/src/pages/QrCodeSection.tsx | 6 +- .../demobank-ui/src/pages/RegistrationPage.tsx | 4 +- .../demobank-ui/src/pages/SolveChallengePage.tsx | 12 ++- .../demobank-ui/src/pages/WalletWithdrawForm.tsx | 16 ++-- .../demobank-ui/src/pages/WithdrawalQRCode.tsx | 13 +++- .../src/pages/account/ShowAccountDetails.tsx | 9 ++- .../demobank-ui/src/pages/admin/AccountForm.tsx | 16 ++-- packages/demobank-ui/src/pages/admin/AdminHome.tsx | 8 +- .../src/pages/business/CreateCashout.tsx | 15 ++-- packages/demobank-ui/src/route.ts | 6 +- packages/demobank-ui/src/utils.ts | 3 +- 24 files changed, 299 insertions(+), 203 deletions(-) diff --git a/packages/demobank-ui/src/Routing.tsx b/packages/demobank-ui/src/Routing.tsx index afc13636a..409d4ec2d 100644 --- a/packages/demobank-ui/src/Routing.tsx +++ b/packages/demobank-ui/src/Routing.tsx @@ -92,15 +92,15 @@ function PublicRounting({ const settings = useSettingsContext(); const { i18n } = useTranslationContext(); const location = useCurrentLocation(publicPages); - const { navigateTo } = useNavigationContext() + const { navigateTo } = useNavigationContext(); const { api } = useBankCoreApiContext(); const [notification, notify, handleError] = useLocalNotification(); useEffect(() => { if (location === undefined) { - navigateTo(publicPages.login.url({})) + navigateTo(publicPages.login.url({})); } - }, [location]) + }, [location]); if (location === undefined) { return ; @@ -166,7 +166,9 @@ function PublicRounting({ operationId={wopid} onOperationAborted={() => navigateTo(publicPages.login.url({}))} routeClose={publicPages.login} - onAuthorizationRequired={() => navigateTo(publicPages.solveSecondFactor.url({}))} + onAuthorizationRequired={() => + navigateTo(publicPages.solveSecondFactor.url({})) + } /> ); } @@ -253,13 +255,13 @@ function PrivateRouting({ username: string; isAdmin: boolean; }): VNode { - const { navigateTo } = useNavigationContext() + const { navigateTo } = useNavigationContext(); const location = useCurrentLocation(privatePages); useEffect(() => { if (location === undefined) { - navigateTo(privatePages.home.url({})) + navigateTo(privatePages.home.url({})); } - }, [location]) + }, [location]); if (location === undefined) { return ; @@ -277,7 +279,9 @@ function PrivateRouting({ operationId={wopid} onOperationAborted={() => navigateTo(privatePages.home.url({}))} routeClose={privatePages.home} - onAuthorizationRequired={() => navigateTo(privatePages.solveSecondFactor.url({}))} + onAuthorizationRequired={() => + navigateTo(privatePages.solveSecondFactor.url({})) + } /> ); } @@ -312,7 +316,9 @@ function PrivateRouting({ navigateTo(privatePages.home.url({}))} - onAuthorizationRequired={() => navigateTo(privatePages.solveSecondFactor.url({}))} + onAuthorizationRequired={() => + navigateTo(privatePages.solveSecondFactor.url({})) + } routeClose={privatePages.home} /> ); @@ -327,7 +333,9 @@ function PrivateRouting({ focus account={account} onUpdateSuccess={() => navigateTo(privatePages.home.url({}))} - onAuthorizationRequired={() => navigateTo(privatePages.solveSecondFactor.url({}))} + onAuthorizationRequired={() => + navigateTo(privatePages.solveSecondFactor.url({})) + } routeClose={privatePages.home} /> ); @@ -341,7 +349,9 @@ function PrivateRouting({ navigateTo(privatePages.home.url({}))} - onAuthorizationRequired={() => navigateTo(privatePages.solveSecondFactor.url({}))} + onAuthorizationRequired={() => + navigateTo(privatePages.solveSecondFactor.url({})) + } routeCancel={privatePages.home} /> ); @@ -356,7 +366,9 @@ function PrivateRouting({ account={account} routeCashoutDetails={privatePages.cashoutDetails} routeClose={privatePages.home} - onAuthorizationRequired={() => navigateTo(privatePages.solveSecondFactor.url({}))} + onAuthorizationRequired={() => + navigateTo(privatePages.solveSecondFactor.url({})) + } /> ); } @@ -365,7 +377,9 @@ function PrivateRouting({ navigateTo(privatePages.home.url({}))} - onAuthorizationRequired={() => navigateTo(privatePages.solveSecondFactor.url({}))} + onAuthorizationRequired={() => + navigateTo(privatePages.solveSecondFactor.url({})) + } routeCancel={privatePages.home} /> ); @@ -375,7 +389,9 @@ function PrivateRouting({ navigateTo(privatePages.home.url({}))} - onAuthorizationRequired={() => navigateTo(privatePages.solveSecondFactor.url({}))} + onAuthorizationRequired={() => + navigateTo(privatePages.solveSecondFactor.url({})) + } routeClose={privatePages.home} /> ); @@ -386,7 +402,9 @@ function PrivateRouting({ focus account={username} onUpdateSuccess={() => navigateTo(privatePages.home.url({}))} - onAuthorizationRequired={() => navigateTo(privatePages.solveSecondFactor.url({}))} + onAuthorizationRequired={() => + navigateTo(privatePages.solveSecondFactor.url({})) + } routeClose={privatePages.home} /> ); @@ -396,7 +414,9 @@ function PrivateRouting({ navigateTo(privatePages.solveSecondFactor.url({}))} + onAuthorizationRequired={() => + navigateTo(privatePages.solveSecondFactor.url({})) + } routeClose={privatePages.home} /> ); @@ -405,7 +425,9 @@ function PrivateRouting({ if (isAdmin) { return ( navigateTo(privatePages.solveSecondFactor.url({}))} + onAuthorizationRequired={() => + navigateTo(privatePages.solveSecondFactor.url({})) + } routeCreate={privatePages.accountCreate} routeRemoveAccount={privatePages.accountDelete} routeShowAccount={privatePages.accountDetails} @@ -422,8 +444,12 @@ function PrivateRouting({ routeWireTransfer={privatePages.homeWireTransfer} routeClose={privatePages.home} onClose={() => navigateTo(privatePages.home.url({}))} - onAuthorizationRequired={() => navigateTo(privatePages.solveSecondFactor.url({}))} - onOperationCreated={(wopid) => navigateTo(privatePages.operationDetails.url({ wopid }))} + onAuthorizationRequired={() => + navigateTo(privatePages.solveSecondFactor.url({})) + } + onOperationCreated={(wopid) => + navigateTo(privatePages.operationDetails.url({ wopid })) + } /> ); } @@ -431,7 +457,9 @@ function PrivateRouting({ return ( navigateTo(privatePages.solveSecondFactor.url({}))} + onAuthorizationRequired={() => + navigateTo(privatePages.solveSecondFactor.url({})) + } routeClose={privatePages.home} /> ); @@ -456,7 +484,9 @@ function PrivateRouting({ return ( navigateTo(privatePages.solveSecondFactor.url({}))} + onAuthorizationRequired={() => + navigateTo(privatePages.solveSecondFactor.url({})) + } routeCancel={privatePages.home} onSuccess={() => navigateTo(privatePages.home.url({}))} /> @@ -471,8 +501,12 @@ function PrivateRouting({ routeWireTransfer={privatePages.homeWireTransfer} routeClose={privatePages.home} onClose={() => navigateTo(privatePages.home.url({}))} - onAuthorizationRequired={() => navigateTo(privatePages.solveSecondFactor.url({}))} - onOperationCreated={(wopid) => navigateTo(privatePages.operationDetails.url({ wopid }))} + onAuthorizationRequired={() => + navigateTo(privatePages.solveSecondFactor.url({})) + } + onOperationCreated={(wopid) => + navigateTo(privatePages.operationDetails.url({ wopid })) + } /> ); } @@ -485,8 +519,12 @@ function PrivateRouting({ routeWireTransfer={privatePages.homeWireTransfer} routeClose={privatePages.home} onClose={() => navigateTo(privatePages.home.url({}))} - onAuthorizationRequired={() => navigateTo(privatePages.solveSecondFactor.url({}))} - onOperationCreated={(wopid) => navigateTo(privatePages.operationDetails.url({ wopid }))} + onAuthorizationRequired={() => + navigateTo(privatePages.solveSecondFactor.url({})) + } + onOperationCreated={(wopid) => + navigateTo(privatePages.operationDetails.url({ wopid })) + } /> ); } diff --git a/packages/demobank-ui/src/components/Transactions/state.ts b/packages/demobank-ui/src/components/Transactions/state.ts index 4109c88b2..74e6b0d36 100644 --- a/packages/demobank-ui/src/components/Transactions/state.ts +++ b/packages/demobank-ui/src/components/Transactions/state.ts @@ -42,34 +42,34 @@ export function useComponentState({ account }: Props): State { result.data.type === "fail" ? [] : result.data.body.transactions - .map((tx) => { - const negative = tx.direction === "debit"; - const cp = parsePaytoUri( - negative ? tx.creditor_payto_uri : tx.debtor_payto_uri, - ); - const counterpart = - (cp === undefined || !cp.isKnown - ? undefined - : cp.targetType === "iban" - ? cp.iban - : cp.targetType === "x-taler-bank" - ? cp.account - : cp.targetType === "bitcoin" - ? `${cp.targetPath.substring(0, 6)}...` - : undefined) ?? "unknown"; + .map((tx) => { + const negative = tx.direction === "debit"; + const cp = parsePaytoUri( + negative ? tx.creditor_payto_uri : tx.debtor_payto_uri, + ); + const counterpart = + (cp === undefined || !cp.isKnown + ? undefined + : cp.targetType === "iban" + ? cp.iban + : cp.targetType === "x-taler-bank" + ? cp.account + : cp.targetType === "bitcoin" + ? `${cp.targetPath.substring(0, 6)}...` + : undefined) ?? "unknown"; - const when = AbsoluteTime.fromProtocolTimestamp(tx.date); - const amount = Amounts.parse(tx.amount); - const subject = tx.subject; - return { - negative, - counterpart, - when, - amount, - subject, - }; - }) - .filter((x): x is Transaction => x !== undefined); + const when = AbsoluteTime.fromProtocolTimestamp(tx.date); + const amount = Amounts.parse(tx.amount); + const subject = tx.subject; + return { + negative, + counterpart, + when, + amount, + subject, + }; + }) + .filter((x): x is Transaction => x !== undefined); return { status: "ready", diff --git a/packages/demobank-ui/src/components/Transactions/views.tsx b/packages/demobank-ui/src/components/Transactions/views.tsx index f4f6f66ba..51fb90b61 100644 --- a/packages/demobank-ui/src/components/Transactions/views.tsx +++ b/packages/demobank-ui/src/components/Transactions/views.tsx @@ -93,8 +93,8 @@ export function ReadyView({ item.when.t_ms === "never" ? "" : format(item.when.t_ms, "HH:mm:ss", { - locale: dateLocale, - }); + locale: dateLocale, + }); return ( (undefined); export const useNavigationContext = (): Type => useContext(Context); function getPathAndParamsFromWindow() { - const path = typeof window !== "undefined" ? window.location.hash.substring(1) : "/"; - const params: Record = {} + const path = + typeof window !== "undefined" ? window.location.hash.substring(1) : "/"; + const params: Record = {}; if (typeof window !== "undefined") { for (const [key, value] of new URLSearchParams(window.location.search)) { params[key] = value; } } - return { path, params } + return { path, params }; } -const { path: initialPath, params: initialParams } = getPathAndParamsFromWindow() +const { path: initialPath, params: initialParams } = + getPathAndParamsFromWindow(); // there is a posibility that if the browser does a redirection // (which doesn't go through navigatTo function) and that exectued @@ -53,26 +55,35 @@ const { path: initialPath, params: initialParams } = getPathAndParamsFromWindow( // into account const PopStateEventType = "popstate"; -export const BrowserHashNavigationProvider = ({ children }: { children: ComponentChildren }): VNode => { - const [{ path, params }, setState] = useState({ path: initialPath, params: initialParams }) +export const BrowserHashNavigationProvider = ({ + children, +}: { + children: ComponentChildren; +}): VNode => { + const [{ path, params }, setState] = useState({ + path: initialPath, + params: initialParams, + }); if (typeof window === "undefined") { - throw Error("Can't use BrowserHashNavigationProvider if there is no window object") + throw Error( + "Can't use BrowserHashNavigationProvider if there is no window object", + ); } function navigateTo(path: string) { - const { params } = getPathAndParamsFromWindow() - setState({ path, params }) - window.location.href = path + const { params } = getPathAndParamsFromWindow(); + setState({ path, params }); + window.location.href = path; } useEffect(() => { function eventListener() { - setState(getPathAndParamsFromWindow()) + setState(getPathAndParamsFromWindow()); } window.addEventListener(PopStateEventType, eventListener); return () => { - window.removeEventListener(PopStateEventType, eventListener) - } - }, []) + window.removeEventListener(PopStateEventType, eventListener); + }; + }, []); return h(Context.Provider, { value: { path, params, navigateTo }, children, diff --git a/packages/demobank-ui/src/context/wallet-integration.ts b/packages/demobank-ui/src/context/wallet-integration.ts index 47bdc90ec..e14988ed1 100644 --- a/packages/demobank-ui/src/context/wallet-integration.ts +++ b/packages/demobank-ui/src/context/wallet-integration.ts @@ -14,47 +14,38 @@ GNU Taler; see the file COPYING. If not, see */ -import { - stringifyTalerUri, - TalerUri -} from "@gnu-taler/taler-util"; -import { - ComponentChildren, - createContext, - h, - VNode -} from "preact"; +import { stringifyTalerUri, TalerUri } from "@gnu-taler/taler-util"; +import { ComponentChildren, createContext, h, VNode } from "preact"; import { useContext } from "preact/hooks"; /** * https://docs.taler.net/design-documents/039-taler-browser-integration.html - * - * @param uri + * + * @param uri */ function createHeadMetaTag(uri: TalerUri, onNotFound?: () => void) { - const meta = document.createElement("meta"); meta.setAttribute("name", "taler-uri"); meta.setAttribute("content", stringifyTalerUri(uri)); document.head.appendChild(meta); - let walletFound = false + let walletFound = false; window.addEventListener("beforeunload", () => { - walletFound = true - }) + walletFound = true; + }); setTimeout(() => { if (!walletFound && onNotFound) { - onNotFound() + onNotFound(); } - }, 10)//very short timeout + }, 10); //very short timeout } interface Type { /** * Tell the active wallet that an action is found - * - * @param uri - * @returns + * + * @param uri + * @returns */ publishTalerAction: (uri: TalerUri, onNotFound?: () => void) => void; } @@ -64,9 +55,13 @@ const Context = createContext(undefined); export const useTalerWalletIntegrationAPI = (): Type => useContext(Context); -export const TalerWalletIntegrationBrowserProvider = ({ children }: { children: ComponentChildren }): VNode => { +export const TalerWalletIntegrationBrowserProvider = ({ + children, +}: { + children: ComponentChildren; +}): VNode => { const value: Type = { - publishTalerAction: createHeadMetaTag + publishTalerAction: createHeadMetaTag, }; return h(Context.Provider, { value, @@ -74,7 +69,6 @@ export const TalerWalletIntegrationBrowserProvider = ({ children }: { children: }); }; - export const TalerWalletIntegrationTestingProvider = ({ children, value, @@ -82,7 +76,6 @@ export const TalerWalletIntegrationTestingProvider = ({ children: ComponentChildren; value: Type; }): VNode => { - return h(Context.Provider, { value, children, diff --git a/packages/demobank-ui/src/index.html b/packages/demobank-ui/src/index.html index 6e0638e3f..0789ecf89 100644 --- a/packages/demobank-ui/src/index.html +++ b/packages/demobank-ui/src/index.html @@ -17,25 +17,25 @@ --> + + + + + + + + + + Bank + + + + - - - - - - - - - - Bank - - - - - - -
- - - \ No newline at end of file + +
+ + diff --git a/packages/demobank-ui/src/pages/BankFrame.tsx b/packages/demobank-ui/src/pages/BankFrame.tsx index 35cb30065..d6ab882f1 100644 --- a/packages/demobank-ui/src/pages/BankFrame.tsx +++ b/packages/demobank-ui/src/pages/BankFrame.tsx @@ -86,9 +86,9 @@ export function BankFrame({ backend.state.status !== "loggedIn" ? undefined : () => { - backend.logOut(); - resetBankState(); - } + backend.logOut(); + resetBankState(); + } } sites={ !settings.topNavSites ? [] : Object.entries(settings.topNavSites) @@ -176,7 +176,7 @@ export function BankFrame({ function WelcomeAccount({ account }: { account: string }): VNode { const { i18n } = useTranslationContext(); - const result = useAccountDetails(account) + const result = useAccountDetails(account); if (!result) { return ; } @@ -184,16 +184,23 @@ function WelcomeAccount({ account }: { account: string }): VNode { return
; } if (result.type === "fail") { - return - Welcome - ; + return ( + + Welcome + + ); } return ( - Welcome, {result.body.name} + + Welcome, {result.body.name} + ); } diff --git a/packages/demobank-ui/src/pages/DownloadStats.tsx b/packages/demobank-ui/src/pages/DownloadStats.tsx index 2a876d233..e53f1f4e2 100644 --- a/packages/demobank-ui/src/pages/DownloadStats.tsx +++ b/packages/demobank-ui/src/pages/DownloadStats.tsx @@ -269,7 +269,9 @@ export function DownloadStats({ routeCancel }: Props): VNode { class="text-sm text-black font-medium leading-6 " id="availability-label" > - Add previous metric for compare + + Add previous metric for compare +
@@ -392,7 +397,9 @@ export function DownloadStats({ routeCancel }: Props): VNode { download={"bank-stats.csv"} > - Click here to save the file in your computer. + + Click here to save the file in your computer. + )} @@ -443,9 +450,9 @@ async function fetchAllStatus( // await delay() const previous = options.compareWithPrevious ? await api.getMonitor(token, { - timeframe: frame.timeframe, - which: frame.moment.previous, - }) + timeframe: frame.timeframe, + which: frame.moment.previous, + }) : undefined; if (previous && previous.type === "fail" && options.endOnFirstFail) { diff --git a/packages/demobank-ui/src/pages/LoginForm.tsx b/packages/demobank-ui/src/pages/LoginForm.tsx index 9816972ac..8acc79cfc 100644 --- a/packages/demobank-ui/src/pages/LoginForm.tsx +++ b/packages/demobank-ui/src/pages/LoginForm.tsx @@ -70,8 +70,8 @@ export function LoginForm({ username: !username ? i18n.str`Missing username` : // : !USERNAME_REGEX.test(username) - // ? i18n.str`Use letters and numbers only, and start with a lowercase letter` - undefined, + // ? i18n.str`Use letters and numbers only, and start with a lowercase letter` + undefined, password: !password ? i18n.str`Missing password` : undefined, }) ?? busy; diff --git a/packages/demobank-ui/src/pages/OperationState/views.tsx b/packages/demobank-ui/src/pages/OperationState/views.tsx index 4d193505e..dbd8e9b77 100644 --- a/packages/demobank-ui/src/pages/OperationState/views.tsx +++ b/packages/demobank-ui/src/pages/OperationState/views.tsx @@ -329,12 +329,12 @@ export function ReadyView({ onAbort: doAbort, }: State.Ready): VNode> { const { i18n } = useTranslationContext(); - const walletInegrationApi = useTalerWalletIntegrationAPI() + const walletInegrationApi = useTalerWalletIntegrationAPI(); const [notification, notify, errorHandler] = useLocalNotification(); const talerWithdrawUri = stringifyWithdrawUri(uri); useEffect(() => { - walletInegrationApi.publishTalerAction(uri) + walletInegrationApi.publishTalerAction(uri); }, []); async function onAbort() { diff --git a/packages/demobank-ui/src/pages/PaymentOptions.tsx b/packages/demobank-ui/src/pages/PaymentOptions.tsx index 9fa30cc41..eb21f637a 100644 --- a/packages/demobank-ui/src/pages/PaymentOptions.tsx +++ b/packages/demobank-ui/src/pages/PaymentOptions.tsx @@ -24,32 +24,42 @@ import { useTranslationContext } from "@gnu-taler/web-util/browser"; import { useWithdrawalDetails } from "../hooks/access.js"; import { useEffect } from "preact/hooks"; -function ShowOperationPendingTag({ woid, onOperationAlreadyCompleted }: { woid: string, onOperationAlreadyCompleted?: () => void }): VNode { +function ShowOperationPendingTag({ + woid, + onOperationAlreadyCompleted, +}: { + woid: string; + onOperationAlreadyCompleted?: () => void; +}): VNode { const { i18n } = useTranslationContext(); const result = useWithdrawalDetails(woid); - const error = !result || result instanceof TalerError || result.type === "fail" - const completed = !error && (result.body.status === "aborted" || result.body.status === "confirmed") + const error = + !result || result instanceof TalerError || result.type === "fail"; + const completed = + !error && + (result.body.status === "aborted" || result.body.status === "confirmed"); useEffect(() => { if (completed && onOperationAlreadyCompleted) { - onOperationAlreadyCompleted() + onOperationAlreadyCompleted(); } - }, [completed]) + }, [completed]); if (error || completed) { return ; } - return - - Operation ready - - + return ( + + + Operation ready + + ); } /** @@ -100,7 +110,9 @@ export function PaymentOptions({
💵
- to a Taler wallet + + to a Taler wallet + {!!bankState.currentWithdrawalOperationId && ( - { - updateBankState("currentWithdrawalOperationId", undefined) - }} /> + { + updateBankState( + "currentWithdrawalOperationId", + undefined, + ); + }} + /> )} diff --git a/packages/demobank-ui/src/pages/PaytoWireTransferForm.tsx b/packages/demobank-ui/src/pages/PaytoWireTransferForm.tsx index ffcf9eb8b..3643e1f6b 100644 --- a/packages/demobank-ui/src/pages/PaytoWireTransferForm.tsx +++ b/packages/demobank-ui/src/pages/PaytoWireTransferForm.tsx @@ -356,7 +356,9 @@ export function PaytoWireTransferForm({ />

- IBAN of the recipient's account + + IBAN of the recipient's account +

@@ -385,7 +387,9 @@ export function PaytoWireTransferForm({ />

- Some text to identify the transfer + + Some text to identify the transfer +

@@ -534,13 +538,13 @@ export function InputAmount( if ( sep_pos !== -1 && l - sep_pos - 1 > - config.currency_specification.num_fractional_input_digits + config.currency_specification.num_fractional_input_digits ) { e.currentTarget.value = e.currentTarget.value.substring( 0, sep_pos + - config.currency_specification.num_fractional_input_digits + - 1, + config.currency_specification.num_fractional_input_digits + + 1, ); } onChange(e.currentTarget.value); diff --git a/packages/demobank-ui/src/pages/ProfileNavigation.tsx b/packages/demobank-ui/src/pages/ProfileNavigation.tsx index 02f30d8e8..607487c9d 100644 --- a/packages/demobank-ui/src/pages/ProfileNavigation.tsx +++ b/packages/demobank-ui/src/pages/ProfileNavigation.tsx @@ -33,7 +33,7 @@ export function ProfileNavigation({ credentials.status !== "loggedIn" ? false : !credentials.isUserAdministrator; - const { navigateTo } = useNavigationContext() + const { navigateTo } = useNavigationContext(); return (
diff --git a/packages/demobank-ui/src/pages/QrCodeSection.tsx b/packages/demobank-ui/src/pages/QrCodeSection.tsx index 037849804..bf0369855 100644 --- a/packages/demobank-ui/src/pages/QrCodeSection.tsx +++ b/packages/demobank-ui/src/pages/QrCodeSection.tsx @@ -19,7 +19,7 @@ import { HttpStatusCode, stringifyWithdrawUri, TranslatedString, - WithdrawUriResult + WithdrawUriResult, } from "@gnu-taler/taler-util"; import { LocalNotificationBanner, @@ -41,13 +41,13 @@ export function QrCodeSection({ onAborted: () => void; }): VNode { const { i18n } = useTranslationContext(); - const walletInegrationApi = useTalerWalletIntegrationAPI() + const walletInegrationApi = useTalerWalletIntegrationAPI(); const talerWithdrawUri = stringifyWithdrawUri(withdrawUri); const { state: credentials } = useBackendState(); const creds = credentials.status !== "loggedIn" ? undefined : credentials; useEffect(() => { - walletInegrationApi.publishTalerAction(withdrawUri) + walletInegrationApi.publishTalerAction(withdrawUri); }, []); const [notification, notify, handleError] = useLocalNotification(); diff --git a/packages/demobank-ui/src/pages/RegistrationPage.tsx b/packages/demobank-ui/src/pages/RegistrationPage.tsx index cbf5758aa..b7b02b76d 100644 --- a/packages/demobank-ui/src/pages/RegistrationPage.tsx +++ b/packages/demobank-ui/src/pages/RegistrationPage.tsx @@ -218,7 +218,9 @@ function RegistrationForm({ ? "123" : getRandomPassword(); const username = `_${user.first}-${user.second}_`; - const name = `${capitalizeFirstLetter(user.first)} ${capitalizeFirstLetter(user.second)}`; + const name = `${capitalizeFirstLetter(user.first)} ${capitalizeFirstLetter( + user.second, + )}`; await doRegistrationAndLogin(name, username, password, () => { onRegistrationSuccesful(username, password); }); diff --git a/packages/demobank-ui/src/pages/SolveChallengePage.tsx b/packages/demobank-ui/src/pages/SolveChallengePage.tsx index 4d3169390..de0ba483f 100644 --- a/packages/demobank-ui/src/pages/SolveChallengePage.tsx +++ b/packages/demobank-ui/src/pages/SolveChallengePage.tsx @@ -485,10 +485,14 @@ function ChallengeDetails({ {challenge.request.is_public !== undefined && (
- Is this account public? + + Is this account public? +
- {challenge.request.is_public ? i18n.str`Enable` : i18n.str`Disable`} + {challenge.request.is_public + ? i18n.str`Enable` + : i18n.str`Disable`}
)} @@ -505,7 +509,9 @@ function ChallengeDetails({ {challenge.request.tan_channel !== undefined && (
- Authentication channel + + Authentication channel +
{challenge.request.tan_channel ?? i18n.str`Remove`} diff --git a/packages/demobank-ui/src/pages/WalletWithdrawForm.tsx b/packages/demobank-ui/src/pages/WalletWithdrawForm.tsx index c9c2f174e..8ce4c6a09 100644 --- a/packages/demobank-ui/src/pages/WalletWithdrawForm.tsx +++ b/packages/demobank-ui/src/pages/WalletWithdrawForm.tsx @@ -85,7 +85,7 @@ function OldWithdrawalForm({ // const uri = parseWithdrawUri(suri)! const url = privatePages.operationDetails.url({ wopid: bankState.currentWithdrawalOperationId, - }) + }); return ( @@ -95,12 +95,12 @@ function OldWithdrawalForm({ { - // e.preventDefault() - // walletInegrationApi.publishTalerAction(uri, () => { - // navigateTo(url) - // }) - // }} + // onClick={(e) => { + // e.preventDefault() + // walletInegrationApi.publishTalerAction(uri, () => { + // navigateTo(url) + // }) + // }} > this page @@ -345,7 +345,7 @@ export function WalletWithdrawForm({ onAuthorizationRequired={onAuthorizationRequired} routeClose={routeCancel} onAbort={onOperationAborted} - // route={routeCancel} + // route={routeCancel} /> )}
diff --git a/packages/demobank-ui/src/pages/WithdrawalQRCode.tsx b/packages/demobank-ui/src/pages/WithdrawalQRCode.tsx index 03f6556af..a23909338 100644 --- a/packages/demobank-ui/src/pages/WithdrawalQRCode.tsx +++ b/packages/demobank-ui/src/pages/WithdrawalQRCode.tsx @@ -78,8 +78,17 @@ export function WithdrawalQRCode({
-
diff --git a/packages/demobank-ui/src/pages/account/ShowAccountDetails.tsx b/packages/demobank-ui/src/pages/account/ShowAccountDetails.tsx index 8fec0f682..6d5a1c18d 100644 --- a/packages/demobank-ui/src/pages/account/ShowAccountDetails.tsx +++ b/packages/demobank-ui/src/pages/account/ShowAccountDetails.tsx @@ -88,10 +88,11 @@ export function ShowAccountDetails({ async function doUpdate() { if (!submitAccount || !creds) return; await handleError(async () => { - const resp = await api.updateAccount({ - token: creds.token, - username: account, - }, + const resp = await api.updateAccount( + { + token: creds.token, + username: account, + }, submitAccount, ); diff --git a/packages/demobank-ui/src/pages/admin/AccountForm.tsx b/packages/demobank-ui/src/pages/admin/AccountForm.tsx index 300508abe..fcad47b4a 100644 --- a/packages/demobank-ui/src/pages/admin/AccountForm.tsx +++ b/packages/demobank-ui/src/pages/admin/AccountForm.tsx @@ -129,7 +129,7 @@ export function AccountForm({ purpose === "create" || (purpose === "update" && (config.allow_edit_name || userIsAdmin)); - const isCashoutEnabled = config.allow_conversion + const isCashoutEnabled = config.allow_conversion; const editableCashout = showingCurrentUserInfo && (purpose === "create" || @@ -475,9 +475,9 @@ export function AccountForm({ !editableThreshold ? undefined : (e) => { - form.debit_threshold = e as AmountString; - updateForm(structuredClone(form)); - } + form.debit_threshold = e as AmountString; + updateForm(structuredClone(form)); + } } /> ({
)} {/* channel, not shown if old cashout api */} - {OLD_CASHOUT_API || config.supported_tan_channels - .length === 0 ? undefined : ( + {OLD_CASHOUT_API || + config.supported_tan_channels.length === 0 ? undefined : (