diff --git a/src/components/Drawers.tsx b/src/components/Drawers.tsx
index a6c2bf8..9366ec0 100644
--- a/src/components/Drawers.tsx
+++ b/src/components/Drawers.tsx
@@ -47,12 +47,13 @@ function Drawers() {
if (payCartError) {
if (payCartError.includes("insufficient funds: ")) {
const notEnoughMoneyAmount = parseInt(payCartError.replace(/^.*insufficient\sfunds:\s(?=\d+$)/, ""));
-
setNotEnoughMoneyAmount(notEnoughMoneyAmount);
}
setLoading(false);
+ closeCartDrawer()
+ navigate("payment")
return enqueueSnackbar(payCartError);
}
@@ -321,7 +322,7 @@ console.log('aaaaaaaaaaAAAAAAAAAAAAAA', (cart.appliedCartPurchasesDiscount?.Targ
onClick={() => (notEnoughMoneyAmount === 0 ? !loading && handlePayClick() : handleReplenishWallet())}
sx={{ mt: "25px", display: "block" }}
>
- {loading ? : "Оплатить"}
+ {loading ? : notEnoughMoneyAmount === 0 ? "Оплатить" : "Пополнить"}
diff --git a/src/components/InputTextfield.tsx b/src/components/InputTextfield.tsx
index 1df9cf4..68fc345 100644
--- a/src/components/InputTextfield.tsx
+++ b/src/components/InputTextfield.tsx
@@ -20,6 +20,8 @@ interface Props {
FormInputSx?: SxProps;
TextfieldProps: TextFieldProps;
onChange: (e: React.ChangeEvent) => void;
+ onBlur?: () => void
+ onFocus?: () => void
}
export default function InputTextfield({
@@ -31,6 +33,8 @@ export default function InputTextfield({
TextfieldProps,
color,
FormInputSx,
+ onBlur = ()=>{},
+ onFocus = ()=>{}
}: Props) {
const theme = useTheme()
const upMd = useMediaQuery(theme.breakpoints.up("md"))
@@ -45,6 +49,7 @@ export default function InputTextfield({
return (
)}
{
+ onBlur()
+ }}
+ onFocus={(e) => {
+ onFocus()
+ }}
{...TextfieldProps}
fullWidth
id={id}
diff --git a/src/components/TotalPrice.tsx b/src/components/TotalPrice.tsx
index fcd0a3f..4e0e86d 100644
--- a/src/components/TotalPrice.tsx
+++ b/src/components/TotalPrice.tsx
@@ -8,6 +8,7 @@ import { Loader } from "./Loader";
import { currencyFormatter } from "@root/utils/currencyFormatter";
import { payCart } from "@root/api/cart";
import { setUserAccount } from "@root/stores/user";
+import { useCart } from "@root/utils/hooks/useCart";
interface Props {
priceBeforeDiscounts: number;
@@ -19,6 +20,7 @@ export default function TotalPrice({ priceAfterDiscounts, priceBeforeDiscounts,
const theme = useTheme();
const upMd = useMediaQuery(theme.breakpoints.up("md"));
const isMobile = useMediaQuery(theme.breakpoints.down(550));
+ const cart = useCart();
const [notEnoughMoneyAmount, setNotEnoughMoneyAmount] = useState(0);
const [loading, setLoading] = useState(false);
const navigate = useNavigate();
@@ -162,6 +164,7 @@ export default function TotalPrice({ priceAfterDiscounts, priceBeforeDiscounts,
)}