diff --git a/src/app/dashboard/(user-dashboard)/products/_components/product-content-view.tsx b/src/app/dashboard/(user-dashboard)/products/_components/product-content-view.tsx
new file mode 100644
index 000000000..e14e89a96
--- /dev/null
+++ b/src/app/dashboard/(user-dashboard)/products/_components/product-content-view.tsx
@@ -0,0 +1,161 @@
+import { AnimatePresence } from "framer-motion";
+import { useRouter } from "next-nprogress-bar";
+
+import {
+ Table,
+ TableBody,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from "~/components/ui/table";
+import { useProductModal } from "~/hooks/admin-product/use-product.modal";
+import { useProducts } from "~/hooks/admin-product/use-products.persistence";
+import { cn } from "~/lib/utils";
+import { ProductTableProperties } from "~/types/admin-product.types";
+import { ProductGridCard } from "./product-grid-card";
+import { ProductListRow } from "./product-list-row";
+import { ProductNotFound } from "./product-not-found";
+
+type Properties = {
+ subset: ProductTableProperties[];
+ filteredProducts: ProductTableProperties[];
+ searchTerm: string;
+ view: "grid" | "list";
+};
+
+export const ProductContentView = ({
+ subset,
+ filteredProducts,
+ searchTerm,
+ view = "grid",
+}: Properties) => {
+ const { products } = useProducts();
+ const {
+ updateOpen,
+ updateProductId,
+ product_id,
+ isActionModal,
+ setIsActionModal,
+ setIsDelete,
+ } = useProductModal();
+ const router = useRouter();
+
+ if (!products) return;
+
+ const handleOpenActionModal = (product_id: string) => {
+ updateProductId(product_id);
+ setIsActionModal(!isActionModal);
+ };
+
+ const handleOpenDetail = (product_id: string) => {
+ setIsActionModal(false);
+ updateProductId(product_id);
+ updateOpen(true);
+ };
+ const handleDeleteAction = (id: string) => {
+ setIsActionModal(false);
+ updateProductId(id);
+ setIsDelete(true);
+ };
+ const handleEditAction = (id: string) => {
+ setIsActionModal(false);
+ router.push(`/dashboard/products/${id}`);
+ };
+
+ return (
+
+ {view === "list" && (
+
+
+
+
+
+ Product Name
+
+
+ Product ID
+
+
+ Category
+
+
+ Price
+
+
+ Status
+
+
+ Actions
+
+
+
+
+ {filteredProducts.length > 0 &&
+ subset.length > 0 &&
+ subset.map((product, index) => (
+ handleOpenDetail(product.product_id)}
+ onEdit={() => handleEditAction(product.product_id)}
+ onDelete={() => handleDeleteAction(product.product_id)}
+ onOpenActionModal={() =>
+ handleOpenActionModal(product.product_id)
+ }
+ onCloseActionModal={() => setIsActionModal(false)}
+ />
+ ))}
+
+ {filteredProducts.length === 0 && searchTerm.length > 1 && (
+
+ )}
+
+
+ )}
+ {view === "grid" && (
+
+
+ {filteredProducts.length > 0 &&
+ subset.length > 0 &&
+ subset.map((product) => (
+
({})}
+ onEdit={() => handleEditAction(product.product_id)}
+ onDelete={() => handleDeleteAction(product.product_id)}
+ />
+ ))}
+
+ {filteredProducts.length === 0 && searchTerm.length > 1 && (
+
+ )}
+
+ )}
+
+ );
+};
diff --git a/src/app/dashboard/(user-dashboard)/products/_components/product-content.tsx b/src/app/dashboard/(user-dashboard)/products/_components/product-content.tsx
index 9b190c91b..d3f450d1a 100644
--- a/src/app/dashboard/(user-dashboard)/products/_components/product-content.tsx
+++ b/src/app/dashboard/(user-dashboard)/products/_components/product-content.tsx
@@ -5,22 +5,12 @@ import { useEffect, useMemo, useState } from "react";
import LoadingSpinner from "~/components/miscellaneous/loading-spinner";
import ProductCardSkeleton from "~/components/skeleton/product.skeleton";
-
-import "~/components/ui/table";
-
-import {
- Table,
- TableBody,
- TableHead,
- TableHeader,
- TableRow,
-} from "~/components/ui/table";
import { useProductModal } from "~/hooks/admin-product/use-product.modal";
import { useProductsFilters } from "~/hooks/admin-product/use-products.-filters.persistence";
import { useProducts } from "~/hooks/admin-product/use-products.persistence";
import { cn } from "~/lib/utils";
import { ProductTableProperties } from "~/types/admin-product.types";
-import ProductBodyShadcn from "./product-body-shadcn";
+import { ProductContentView } from "./product-content-view";
const Pagination = dynamic(() => import("react-paginate"), {
ssr: false,
@@ -108,60 +98,17 @@ const ProductContent = ({
-
- {view === "list" && (
-
-
-
-
- Product Name
-
-
- Product ID
-
-
- Category
-
-
- Price
-
-
- Status
-
-
- Actions
-
-
-
-
-
-
- {filteredProducts.length === 0 && searchTerm.length > 1 && (
-
-
- No product found for "
- {searchTerm}
- "
-
-
- )}
-
- )}
-
+
{!products &&
}
diff --git a/src/app/dashboard/(user-dashboard)/products/_components/product-filter.tsx b/src/app/dashboard/(user-dashboard)/products/_components/product-filter.tsx
index d81f8864b..7fff6eb7c 100644
--- a/src/app/dashboard/(user-dashboard)/products/_components/product-filter.tsx
+++ b/src/app/dashboard/(user-dashboard)/products/_components/product-filter.tsx
@@ -87,7 +87,7 @@ const ProductFilter = ({