+
+
+ Discover Amazing Products
+
+
+ {total} products available
+
+
+
+
+
+ {loading ? (
+
+ {Array.from({ length: 8 }).map((_, i) => (
+
+ ))}
+
+ ) : products.length === 0 ? (
+
+
+
+ No products found
+
+
+ Try adjusting your search or filters
+
+
+ ) : (
+ <>
+
+ {products.map((product) => (
+
+ ))}
+
+
+ {totalPages > 1 && (
+
+
+ {Array.from({ length: totalPages }, (_, i) => i + 1).map((p) => (
+
+ ))}
+
+
+ )}
+ >
+ )}
+
+ );
+}
diff --git a/shopping-app/src/app/products/[id]/page.tsx b/shopping-app/src/app/products/[id]/page.tsx
new file mode 100644
index 00000000000000..4194991e71ea10
--- /dev/null
+++ b/shopping-app/src/app/products/[id]/page.tsx
@@ -0,0 +1,218 @@
+"use client";
+
+import { useEffect, useState } from "react";
+import { useParams, useRouter } from "next/navigation";
+import { api } from "@/lib/api";
+import { useAuthStore } from "@/store/auth";
+import { useCartStore } from "@/store/cart";
+import Link from "next/link";
+
+interface Product {
+ id: number;
+ name: string;
+ description: string;
+ price: number;
+ category: string;
+ image: string;
+ stock: number;
+ rating: number;
+}
+
+export default function ProductDetailPage() {
+ const params = useParams();
+ const router = useRouter();
+ const { token } = useAuthStore();
+ const { setItems } = useCartStore();
+ const [product, setProduct] = useState