Comments, appointments adjustments, fixed some issues
This commit is contained in:
@@ -6,8 +6,10 @@ import { useRouter } from "next/navigation";
|
||||
import { useAuth } from "@/context/AuthContext";
|
||||
import { useCart } from "@/context/CartContext";
|
||||
|
||||
//Shared CSS class for the quantity plus and minus buttons
|
||||
const qtyBtnCls = "w-7 h-7 border border-[#ddd] rounded-md bg-white text-base cursor-pointer flex items-center justify-center transition-colors hover:border-[#e68672] disabled:opacity-50";
|
||||
|
||||
//Card shown in the products grid, includes quantity selector and add to cart button
|
||||
export default function ProductCard({ prodId, prodName, categoryName, prodPrice, imageUrl }) {
|
||||
const { user } = useAuth();
|
||||
const { addItem, selectedStoreId } = useCart();
|
||||
@@ -16,6 +18,7 @@ export default function ProductCard({ prodId, prodName, categoryName, prodPrice,
|
||||
const [adding, setAdding] = useState(false);
|
||||
const [feedback, setFeedback] = useState(null);
|
||||
|
||||
//Adds the selected quantity to the cart, redirects to login if not logged in
|
||||
async function handleAddToCart(e) {
|
||||
e.preventDefault();
|
||||
if (!user) { router.push("/login"); return; }
|
||||
|
||||
Reference in New Issue
Block a user