diff --git a/dashboard/src/components/dashboard/ProductGrid.jsx b/dashboard/src/components/dashboard/ProductGrid.jsx index 4b4b486..51d067d 100644 --- a/dashboard/src/components/dashboard/ProductGrid.jsx +++ b/dashboard/src/components/dashboard/ProductGrid.jsx @@ -58,14 +58,6 @@ const ProductGrid = ({ direction: "desc", }); const [searchQuery, setSearchQuery] = useState(""); - const [columnVisibility, setColumnVisibility] = useState({ - image: true, - name: true, - totalQuantity: true, - totalRevenue: true, - orderCount: true, - price: true, - }); useEffect(() => { fetchProducts(); @@ -210,11 +202,20 @@ const ProductGrid = ({ )}
+
+ + setSearchQuery(e.target.value)} + className="pl-8 h-9 w-[200px]" + /> +
setSearchQuery(e.target.value)} - className="pl-8 h-9" - /> -
- - - - - - Toggle columns - - {Object.entries(columnVisibility).map(([column, isVisible]) => ( - - setColumnVisibility(prev => ({ - ...prev, - [column]: value - })) - } - > - {column === 'totalQuantity' ? 'Sold' : - column === 'totalRevenue' ? 'Revenue' : - column === 'orderCount' ? 'Orders' : - column} - - ))} - - - - -
+
{loading && !products.length ? ( ) : error ? ( @@ -337,84 +292,72 @@ const ProductGrid = ({ - {columnVisibility.image && ( - - )} - {columnVisibility.totalQuantity && ( - - )} - {columnVisibility.totalRevenue && ( - - )} - {columnVisibility.orderCount && ( - - )} - {columnVisibility.price && ( - - )} + + + + + @@ -423,54 +366,42 @@ const ProductGrid = ({ key={product.id} className="hover:bg-muted/50 transition-colors" > - {columnVisibility.image && ( - - )} - {columnVisibility.name && ( - - )} - {columnVisibility.totalQuantity && ( - - )} - {columnVisibility.totalRevenue && ( - - )} - {columnVisibility.orderCount && ( - - )} - {columnVisibility.price && ( - - )} + + + + + + ))}
- )} - {columnVisibility.name && ( - - - - - - - - - - - + + + + + + + + + + +
- {product.ImgThumb && ( - (e.target.style.display = "none")} - /> - )} - - - - {product.totalQuantity} - - ${product.totalRevenue.toFixed(2)} - - {product.orderCount} - - ${product.price.toFixed(2)} - + {product.ImgThumb && ( + (e.target.style.display = "none")} + /> + )} + + + + {product.totalQuantity} + + ${product.totalRevenue.toFixed(2)} + + {product.orderCount} + + ${product.price.toFixed(2)} +