From ffde68823c07d10275b27d000077e92d77eeb116 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?essp=C3=ADndola?= Date: Wed, 24 Sep 2025 21:22:45 -0300 Subject: [PATCH] feat: add shopping cart button with item count and improve SalesDrawer layout --- src/app/home/page.tsx | 32 +++-- src/components/SalesDrawer.tsx | 229 ++++++++++++++++----------------- 2 files changed, 133 insertions(+), 128 deletions(-) diff --git a/src/app/home/page.tsx b/src/app/home/page.tsx index 78e11524..2a3e9440 100644 --- a/src/app/home/page.tsx +++ b/src/app/home/page.tsx @@ -9,6 +9,7 @@ import { getActiveProducts, salesAPI } from '@/services/api.service'; import type { Product } from '@/types/index'; import { PolarProduct } from '@/types/polar'; import { useAuth } from '@/context/auth-store'; +import { ShoppingCart } from 'lucide-react'; interface HomePageProps { tab?: string; @@ -154,7 +155,6 @@ const HomePage: React.FC = ({ const handleProductClick = (productUntyped: Product | PolarProduct) => { const product = productUntyped as Product; setSelectedProduct(product); - setIsDrawerOpen(true); setCartItems((prevCart) => { const pid = String(product.id); // stable local id for UI/cart identity const polarProductId = (product as any).polar_id || String(product.id); // original Polar ID for API calls @@ -263,6 +263,8 @@ const HomePage: React.FC = ({ setCartItems([]); }; + const totalItems = cartItems.length; + // Function to reload products const reloadProducts = async () => { try { @@ -346,22 +348,16 @@ const HomePage: React.FC = ({ loading={loading} /> -
-
-
+
+
+
-
+
= ({
+ + = ({ return ( <> -
- );