From c191a2da860fe7ba9a2439f04c94cdd894bd1fa8 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 20 Feb 2023 10:18:02 -0300 Subject: fix missing props --- packages/demobank-ui/src/pages/AdminPage.tsx | 24 ++++++++++++++++++++- packages/demobank-ui/src/pages/BusinessAccount.tsx | 25 +++++++++++++--------- 2 files changed, 38 insertions(+), 11 deletions(-) (limited to 'packages/demobank-ui/src/pages') diff --git a/packages/demobank-ui/src/pages/AdminPage.tsx b/packages/demobank-ui/src/pages/AdminPage.tsx index d15ac02c4..b4ce58588 100644 --- a/packages/demobank-ui/src/pages/AdminPage.tsx +++ b/packages/demobank-ui/src/pages/AdminPage.tsx @@ -40,6 +40,7 @@ import { WithIntermediate, } from "../utils.js"; import { ErrorBanner } from "./BankFrame.js"; +import { ShowCashoutDetails } from "./BusinessAccount.js"; import { ShowInputErrorLabel } from "./ShowInputErrorLabel.js"; const charset = @@ -69,6 +70,9 @@ export function AdminPage({ onLoadNotOk }: Props): VNode { const [showCashouts, setShowCashouts] = useState(); const [updatePassword, setUpdatePassword] = useState(); const [removeAccount, setRemoveAccount] = useState(); + const [showCashoutDetails, setShowCashoutDetails] = useState< + string | undefined + >(); const [createAccount, setCreateAccount] = useState(false); const { pageStateSetter } = usePageContext(); @@ -90,10 +94,28 @@ export function AdminPage({ onLoadNotOk }: Props): VNode { const { customers } = result.data; + if (showCashoutDetails) { + return ( + { + setShowCashoutDetails(undefined); + }} + /> + ); + } + if (showCashouts) { return (
- + { + setShowCashouts(id); + setShowCashouts(undefined); + }} + /> (); + const [showCashoutDetails, setShowCashoutDetails] = useState< + string | undefined + >(); function showInfoMessage(info: TranslatedString): void { pageStateSetter((prev) => ({ ...prev, @@ -79,18 +80,18 @@ export function BusinessAccount({ }} onComplete={(id) => { setNewcashout(false); - setShowCashout(id); + setShowCashoutDetails(id); }} /> ); } - if (showCashout) { + if (showCashoutDetails) { return ( - { - setShowCashout(undefined); + setShowCashoutDetails(undefined); }} /> ); @@ -129,7 +130,7 @@ export function BusinessAccount({ { - setShowCashout(id); + setShowCashoutDetails(id); }} />
@@ -593,7 +594,11 @@ interface ShowCashoutProps { onCancel: () => void; onLoadNotOk: (error: HttpResponsePaginated) => VNode; } -function ShowCashout({ id, onCancel, onLoadNotOk }: ShowCashoutProps): VNode { +export function ShowCashoutDetails({ + id, + onCancel, + onLoadNotOk, +}: ShowCashoutProps): VNode { const { i18n } = useTranslationContext(); const result = useCashoutDetails(id); const { abortCashout, confirmCashout } = useCircuitAccountAPI(); -- cgit v1.2.3