diff --git a/src/assets/locals/ar.json b/src/assets/locals/ar.json index 54fd449..e44791b 100644 --- a/src/assets/locals/ar.json +++ b/src/assets/locals/ar.json @@ -162,7 +162,8 @@ "openingHours": "ساعات العمل: {{openingTime}} - {{closingTime}}", "restaurantIsClosed": "المطعم مغلق", "address": "العنوان", - "openingTimes": "ساعات العمل" + "openingTimes": "ساعات العمل", + "customizable": "قابل للتخصيص" }, "cart": { "title": "السلة", diff --git a/src/assets/locals/en.json b/src/assets/locals/en.json index efb1a0a..08277a3 100644 --- a/src/assets/locals/en.json +++ b/src/assets/locals/en.json @@ -174,7 +174,8 @@ "pay": "Pay", "payDescription": "Pay for your order", "address": "Address", - "openingTimes": "Opening Times" + "openingTimes": "Opening Times", + "customizable": "Customizable" }, "cart": { "title": "Cart", diff --git a/src/pages/menu/components/AddToCartButton/AddToCartButton.tsx b/src/pages/menu/components/AddToCartButton/AddToCartButton.tsx index c7b605a..a74baa1 100644 --- a/src/pages/menu/components/AddToCartButton/AddToCartButton.tsx +++ b/src/pages/menu/components/AddToCartButton/AddToCartButton.tsx @@ -78,7 +78,13 @@ export function AddToCartButton({ item }: { item: Product }) { } }; - const handleMinusClick = () => { + const handleMinusClick = (e: React.MouseEvent) => { + e.stopPropagation(); + e.preventDefault(); + if (restaurant && !restaurant.isOpened) { + message.warning(t("menu.restaurantIsClosed")); + return; + } if (restaurant && !restaurant.isOpened) { message.warning(t("menu.restaurantIsClosed")); return; diff --git a/src/pages/menu/components/MenuFooter/MenuFooter.tsx b/src/pages/menu/components/MenuFooter/MenuFooter.tsx index bfc78f8..eed4fa3 100644 --- a/src/pages/menu/components/MenuFooter/MenuFooter.tsx +++ b/src/pages/menu/components/MenuFooter/MenuFooter.tsx @@ -1,4 +1,4 @@ -import { Badge, Button } from "antd"; +import { Badge, Button, message } from "antd"; import ArabicPrice from "components/ArabicPrice"; import BackIcon from "components/Icons/BackIcon"; import CartIcon from "components/Icons/cart/CartIcon"; @@ -47,10 +47,18 @@ export function MenuFooter() { > { + if (totalItems === 0) { + e.preventDefault(); + message.warning(t("cart.emptyCartMessage")); + } + }} style={{ width: "100%", padding: "0 16px", @@ -60,6 +68,9 @@ export function MenuFooter() { backgroundColor: colors.primary, height: 48, borderRadius: "999px", + opacity: totalItems === 0 ? 0.5 : 1, + pointerEvents: totalItems === 0 ? "none" : "auto", + cursor: totalItems === 0 ? "not-allowed" : "pointer", }} >