diff options
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/Withdraw/views.tsx')
-rw-r--r-- | packages/taler-wallet-webextension/src/cta/Withdraw/views.tsx | 152 |
1 files changed, 120 insertions, 32 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw/views.tsx b/packages/taler-wallet-webextension/src/cta/Withdraw/views.tsx index aade67835..cdddd9bbc 100644 --- a/packages/taler-wallet-webextension/src/cta/Withdraw/views.tsx +++ b/packages/taler-wallet-webextension/src/cta/Withdraw/views.tsx @@ -23,7 +23,12 @@ import { Part } from "../../components/Part.js"; import { QR } from "../../components/QR.js"; import { SelectList } from "../../components/SelectList.js"; import { TermsOfService } from "../../components/TermsOfService/index.js"; -import { Input, LinkSuccess, SvgIcon, WarningBox } from "../../components/styled/index.js"; +import { + Input, + LinkSuccess, + SvgIcon, + WarningBox, +} from "../../components/styled/index.js"; import { Button } from "../../mui/Button.js"; import { Grid } from "../../mui/Grid.js"; import editIcon from "../../svg/edit_24px.inline.svg"; @@ -37,28 +42,102 @@ import { EnabledBySettings } from "../../components/EnabledBySettings.js"; export function FinalStateOperation(state: State.AlreadyCompleted): VNode { const { i18n } = useTranslationContext(); + // document.location.href = res.confirmTransferUrl + if (state.thisWallet) { + switch (state.operationState) { + case "confirmed": { + state.redirectToTx(); + return ( + <WarningBox> + <div style={{ justifyContent: "center", lineHeight: "25px" }}> + <i18n.Translate> + This operation has already been completed. + </i18n.Translate> + </div> + </WarningBox> + ); + } + case "aborted": { + state.redirectToTx(); + return ( + <WarningBox> + <div style={{ justifyContent: "center", lineHeight: "25px" }}> + <i18n.Translate> + This operation has already been aborted + </i18n.Translate> + </div> + </WarningBox> + ); + } + case "selected": { + if (state.confirmTransferUrl) { + document.location.href = state.confirmTransferUrl; + } + return ( + <WarningBox> + <div style={{ justifyContent: "center", lineHeight: "25px" }}> + <i18n.Translate> + This operation has started and should be completed in the bank. + </i18n.Translate> + </div> + {state.confirmTransferUrl && ( + <div style={{ justifyContent: "center", lineHeight: "25px" }}> + <i18n.Translate> + You can confirm the operation in + </i18n.Translate> + + <a + target="_bank" + rel="noreferrer" + href={state.confirmTransferUrl} + > + <i18n.Translate>this page</i18n.Translate> + </a> + </div> + )} + </WarningBox> + ); + } + } + } switch (state.operationState) { - case "confirmed": return <WarningBox> - <div style={{ justifyContent: "center", lineHeight: "25px" }}> - <i18n.Translate>This operation has already been completed by another wallet.</i18n.Translate> - </div> - </WarningBox> - case "aborted": return <WarningBox> - <div style={{ justifyContent: "center", lineHeight: "25px" }}> - <i18n.Translate>This operation has already been aborted</i18n.Translate> - </div> - </WarningBox> - case "selected": return <WarningBox> - <div style={{ justifyContent: "center", lineHeight: "25px" }}> - <i18n.Translate>This operation has already been used by another wallet.</i18n.Translate> - </div> - <div style={{ justifyContent: "center", lineHeight: "25px" }}> - <i18n.Translate>It can be confirmed in</i18n.Translate> <a target="_bank" rel="noreferrer" href={state.confirmTransferUrl}> - <i18n.Translate>this page</i18n.Translate> - </a> - </div> - </WarningBox> + case "confirmed": + return ( + <WarningBox> + <div style={{ justifyContent: "center", lineHeight: "25px" }}> + <i18n.Translate> + This operation has already been completed by another wallet. + </i18n.Translate> + </div> + </WarningBox> + ); + case "aborted": + return ( + <WarningBox> + <div style={{ justifyContent: "center", lineHeight: "25px" }}> + <i18n.Translate> + This operation has already been aborted + </i18n.Translate> + </div> + </WarningBox> + ); + case "selected": + return ( + <WarningBox> + <div style={{ justifyContent: "center", lineHeight: "25px" }}> + <i18n.Translate> + This operation has already been used by another wallet. + </i18n.Translate> + </div> + <div style={{ justifyContent: "center", lineHeight: "25px" }}> + <i18n.Translate>It can be confirmed in</i18n.Translate> + <a target="_bank" rel="noreferrer" href={state.confirmTransferUrl}> + <i18n.Translate>this page</i18n.Translate> + </a> + </div> + </WarningBox> + ); } } @@ -95,21 +174,31 @@ export function SuccessView(state: State.Success): VNode { kind="neutral" big /> - {state.chooseCurrencies.length > 0 ? + {state.chooseCurrencies.length > 0 ? ( <Fragment> <p> - {state.chooseCurrencies.map(currency => { - return <Button variant={currency === state.selectedCurrency ? "contained" : "outlined"} - onClick={async () => { - state.changeCurrency(currency) - }} - > - {currency} - </Button> + {state.chooseCurrencies.map((currency) => { + return ( + <Button + key={currency} + variant={ + currency === state.selectedCurrency + ? "contained" + : "outlined" + } + onClick={async () => { + state.changeCurrency(currency); + }} + > + {currency} + </Button> + ); })} </p> </Fragment> - : <Fragment />} + ) : ( + <Fragment /> + )} <Part title={i18n.str`Details`} @@ -202,7 +291,6 @@ function WithdrawWithMobile({ } export function SelectAmountView({ - currency, amount, exchangeBaseUrl, confirm, |