diff --git a/src/app/dashboard/(user-dashboard)/layout.tsx b/src/app/dashboard/(user-dashboard)/layout.tsx index 5c4b1925c..472a3d467 100644 --- a/src/app/dashboard/(user-dashboard)/layout.tsx +++ b/src/app/dashboard/(user-dashboard)/layout.tsx @@ -8,7 +8,7 @@ export default function AdminLayout({ children: React.ReactNode; }) { return ( -
+
{children} diff --git a/src/app/dashboard/(user-dashboard)/products/[productId]/form-images/project-logo.tsx b/src/app/dashboard/(user-dashboard)/products/[productId]/form-images/project-logo.tsx index c8cffcf8b..ce822e4d4 100644 --- a/src/app/dashboard/(user-dashboard)/products/[productId]/form-images/project-logo.tsx +++ b/src/app/dashboard/(user-dashboard)/products/[productId]/form-images/project-logo.tsx @@ -17,7 +17,7 @@ const handleImageChange = (event: React.ChangeEvent) => { const ProjectLogo = ({ form, name }: Properties) => { const [isDragging, setIsDragging] = useState(false); - const projectLogo = form.getValues("media"); + const productImage = form.getValues("media"); const handleDrop = (event: React.DragEvent) => { event.preventDefault(); @@ -55,18 +55,19 @@ const ProjectLogo = ({ form, name }: Properties) => { {isDragging && (
-

Drop to upload

+

Drop to upload

)} - {projectLogo.url && typeof projectLogo.url === "string" ? ( -
+ {productImage.url && typeof productImage.url === "string" ? ( +
- + - + {product.name} - {product.status === "in_stock" && "In Stock"} - {product.status === "low_on_stock" && "Low on Stock"} - {product.status === "out_of_stock" && "Out of Stock"} + + {" "} + {product.status === "in_stock" && "In Stock"} + {product.status === "low_on_stock" && "Low on Stock"} + {product.status === "out_of_stock" && "Out of Stock"} +
-
+
-
diff --git a/src/app/dashboard/(user-dashboard)/products/_components/product-detail-view.tsx b/src/app/dashboard/(user-dashboard)/products/_components/product-detail-view.tsx index 7e13ae354..b5933bfea 100644 --- a/src/app/dashboard/(user-dashboard)/products/_components/product-detail-view.tsx +++ b/src/app/dashboard/(user-dashboard)/products/_components/product-detail-view.tsx @@ -1,5 +1,6 @@ import { AnimatePresence, motion } from "framer-motion"; import { X } from "lucide-react"; +import { useRouter } from "next-nprogress-bar"; import { useEffect, useTransition } from "react"; import BlurImage from "~/components/miscellaneous/blur-image"; @@ -11,6 +12,7 @@ import { useProducts } from "~/hooks/admin-product/use-products.persistence"; import { cn, formatPrice, simulateDelay } from "~/lib/utils"; const ProductDetailView = () => { + const router = useRouter(); const { products, deleteProduct } = useProducts(); const [isLoading, startTransition] = useTransition(); const { @@ -46,6 +48,12 @@ const ProductDetailView = () => { setIsDelete(false); }); }; + const handleEditAction = (id: string) => { + updateOpen(false); + router.push(`/dashboard/products/${id}`); + updateProductId("null"); + }; + useEffect(() => { document.title = isOpen ? `Product - ${product?.name}` @@ -59,8 +67,8 @@ const ProductDetailView = () => { initial={{ opacity: 0, x: 100 }} animate={{ opacity: 1, x: 0 }} exit={{ opacity: 0, x: 100 }} - transition={{ duration: 0.5 }} - className="sticky top-0 hidden w-full min-w-[350px] flex-col gap-y-5 rounded-[6px] border border-gray-300 bg-white px-2 py-4 shadow-[0px_1px_18px_0px_rgba(10,_57,_176,_0.12)] lg:flex lg:max-w-[370px] xl:w-[403px] xl:px-4" + transition={{ duration: 0.3 }} + className="sticky top-0 hidden w-full min-w-[340px] flex-col gap-y-5 rounded-[6px] border border-gray-300 bg-white px-2 py-4 shadow-[0px_1px_18px_0px_rgba(10,_57,_176,_0.12)] lg:flex lg:max-w-[370px] xl:w-[403px] xl:px-4" >
{ Delete )} -
diff --git a/src/app/dashboard/(user-dashboard)/products/page.test.tsx b/src/app/dashboard/(user-dashboard)/products/page.test.tsx deleted file mode 100644 index dea52ad56..000000000 --- a/src/app/dashboard/(user-dashboard)/products/page.test.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { render } from "~/test/utils"; -import Page from "./page"; - -describe("page tests", () => { - it("should render correctly", () => { - expect.assertions(1); - - render(); - - expect(true).toBeTruthy(); - }); -});