diff --git a/app/(public)/page.jsx b/app/(public)/page.jsx index a850a631..2bee3a61 100644 --- a/app/(public)/page.jsx +++ b/app/(public)/page.jsx @@ -4,12 +4,14 @@ import Hero from "@/components/Hero"; import Newsletter from "@/components/Newsletter"; import OurSpecs from "@/components/OurSpec"; import LatestProducts from "@/components/LatestProducts"; +import RecommendedProducts from "@/components/RecommendedProducts"; export default function Home() { return (
+ diff --git a/app/(public)/shop/page.jsx b/app/(public)/shop/page.jsx index e76d4ea7..34699b4f 100644 --- a/app/(public)/shop/page.jsx +++ b/app/(public)/shop/page.jsx @@ -1,42 +1,136 @@ 'use client' -import { Suspense } from "react" +import { Suspense, useState } from "react" import ProductCard from "@/components/ProductCard" import { MoveLeftIcon } from "lucide-react" import { useRouter, useSearchParams } from "next/navigation" import { useSelector } from "react-redux" - function ShopContent() { +function ShopContent() { - // get query params ?search=abc const searchParams = useSearchParams() const search = searchParams.get('search') const router = useRouter() - const products = useSelector(state => state.product.list) + const [minPrice, setMinPrice] = useState(0) + const [maxPrice, setMaxPrice] = useState(999999) + const [inStockOnly, setInStockOnly] = useState(false) + const [proximity, setProximity] = useState(100) + const [category, setCategory] = useState("all") - const filteredProducts = search + let filteredProducts = search ? products.filter(product => product.name.toLowerCase().includes(search.toLowerCase()) ) - : products; + : products + + filteredProducts = filteredProducts.filter(p => + p.price >= minPrice && + p.price <= maxPrice && + (inStockOnly ? p.inStock === true : true) && + (category === "all" ? true : p.category === category) + ) return (
-
-

router.push('/shop')} className="text-2xl text-slate-500 my-6 flex items-center gap-2 cursor-pointer"> {search && } All Products

-
- {filteredProducts.map((product) => )} +
+ + {/* LEFT: PRODUCT GRID */} +
+

router.push('/shop')} + className="text-2xl text-slate-500 my-6 flex items-center gap-2 cursor-pointer" + > + {search && } + All Products +

+ +
+ {filteredProducts.map((product) => ( + + ))} +
+ + {/* RIGHT: FILTER PANEL - moved further down */} +
+

+ Filters +

+ + {/* PRICE FILTER */} +
+

Price

+
+ setMinPrice(Number(e.target.value))} + /> + - + setMaxPrice(Number(e.target.value))} + /> +
+
+ + {/* STOCK FILTER */} +
+ +
+ + {/* PROXIMITY FILTER */} +
+

Proximity (km)

+ setProximity(Number(e.target.value))} + className="w-full mt-2" + /> +

{proximity} km

+
+ + {/* CATEGORY FILTER */} +
+

Category

+ +
+ +
+
) } - export default function Shop() { - return ( - Loading shop...
}> - - - ); + return ( + Loading shop...
}> + + + ); } \ No newline at end of file diff --git a/app/store/add-product/page.jsx b/app/store/add-product/page.jsx index 2707490d..200546c7 100644 --- a/app/store/add-product/page.jsx +++ b/app/store/add-product/page.jsx @@ -14,11 +14,11 @@ export default function StoreAddProduct() { description: "", mrp: 0, price: 0, + quantity: 1, // Added quantity field category: "", }) const [loading, setLoading] = useState(false) - const onChangeHandler = (e) => { setProductInfo({ ...productInfo, [e.target.name]: e.target.value }) } @@ -26,42 +26,52 @@ export default function StoreAddProduct() { const onSubmitHandler = async (e) => { e.preventDefault() // Logic to add a product - } - return (
toast.promise(onSubmitHandler(e), { loading: "Adding Product..." })} className="text-slate-500 mb-28">

Add New Products

Product Images

-
+
{Object.keys(images).map((key) => ( ))}
-