diff --git a/src/app/[name]/(Main)/[id]/page.tsx b/src/app/[name]/(Main)/[id]/page.tsx index 919df6e..b196e69 100644 --- a/src/app/[name]/(Main)/[id]/page.tsx +++ b/src/app/[name]/(Main)/[id]/page.tsx @@ -6,6 +6,7 @@ import PlusIcon from "@/components/icons/PlusIcon"; import { toast, toastLoginRequired } from "@/components/Toast"; import { getToken } from "@/lib/api/func"; import { ef } from "@/lib/helpers/utfNumbers"; +import clsx from "clsx"; import { motion } from "framer-motion"; import { ArrowLeft, Clock, Cup, Heart, TruckTick } from "iconsax-react"; import { useParams, useRouter } from "next/navigation"; @@ -36,9 +37,8 @@ function FoodPage({}: Props) { }, [items, foodId]); const handleAddToCart = () => { - if (foodId) { - addToCart(foodId); - } + if (!foodId || food?.data?.isAvailable === false) return; + addToCart(foodId); }; const handleRemoveFromCart = () => { @@ -97,6 +97,7 @@ function FoodPage({}: Props) { } const foodData = food.data; + const isAvailable = foodData.isAvailable !== false; const foodName = foodData.title || foodData.name || foodData.foodName || ""; const foodImage = typeof foodData.image === "string" @@ -128,7 +129,12 @@ function FoodPage({}: Props) { }; return ( -