diff --git a/src/components/ConfirmationDialog.js b/src/components/ConfirmationDialog.js index f5a60e9..73f4029 100644 --- a/src/components/ConfirmationDialog.js +++ b/src/components/ConfirmationDialog.js @@ -1,6 +1,7 @@ import React from "react"; import { AlertDialog, AlertDialogBody, AlertDialogCloseButton, AlertDialogContent, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, Button } from "@chakra-ui/react"; import { useTranslation } from "react-i18next"; +import { addNewlines } from "../TextHelper"; export default function ConfirmationDialog(props) { const { t } = useTranslation(); @@ -15,7 +16,7 @@ export default function ConfirmationDialog(props) { - {t(props.description)} + {addNewlines(t(props.description))} diff --git a/src/components/MyAccountModal.js b/src/components/MyAccountModal.js index 8f88fdb..75a131a 100644 --- a/src/components/MyAccountModal.js +++ b/src/components/MyAccountModal.js @@ -15,6 +15,8 @@ function MyAccountModal(props) { const [activationCode, setActivationCode] = useState("") const [isProcessingCode, setIsProcessingCode] = useState(false) const [showDeleteAccount, setShowDeleteAccount] = useState(false) + const [showActivationConfirmation, setShowActivationConfirmation] = useState(false) + useEffect(() => { async function getSubs() { let resp = await new NetworkApi().getSubscription() @@ -29,7 +31,8 @@ function MyAccountModal(props) { getSubs() }, [t]) const activate = async () => { - if (!window.confirm(t("plan_activation_confirmation"))) return + setShowActivationConfirmation(false) + //if (!window.confirm(t("plan_activation_confirmation"))) return setIsProcessingCode(true) let code = activationCode.length === 8 ? activationCode.slice(0, 4) + "-" + activationCode.slice(4) : activationCode; let resp = await new NetworkApi().claimSubscription(code) @@ -129,7 +132,7 @@ function MyAccountModal(props) { {isProcessingCode ? ( ) : ( - + )} @@ -141,6 +144,7 @@ function MyAccountModal(props) { }}>{t("delete_account")} yes ? deleteAccount() : setShowDeleteAccount(false)} /> + yes ? activate() : setShowActivationConfirmation(false)} /> ) }