From d7bb20ce97039f484d8fe78820d13f7a6eac24e7 Mon Sep 17 00:00:00 2001 From: bender Date: Mon, 9 Mar 2026 19:59:40 +0000 Subject: [PATCH 1/5] Add src/app/admin/products/edit/page.tsx --- src/app/admin/products/edit/page.tsx | 335 +++++++++++++++++++++++++++ 1 file changed, 335 insertions(+) create mode 100644 src/app/admin/products/edit/page.tsx diff --git a/src/app/admin/products/edit/page.tsx b/src/app/admin/products/edit/page.tsx new file mode 100644 index 0000000..0bd8448 --- /dev/null +++ b/src/app/admin/products/edit/page.tsx @@ -0,0 +1,335 @@ +"use client"; + +import { useState } from "react"; +import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; +import NavbarLayoutFloatingOverlay from '@/components/navbar/NavbarLayoutFloatingOverlay/NavbarLayoutFloatingOverlay'; +import FooterMedia from '@/components/sections/footer/FooterMedia'; +import { ArrowLeft, Save, X } from "lucide-react"; +import Link from "next/link"; + +interface ProductFormData { + id: string; + brand: string; + name: string; + price: string; + rating: number; + reviewCount: string; + imageSrc: string; + imageAlt: string; + description: string; + sku: string; + stock: number; + category: string; +} + +const initialFormData: ProductFormData = { + id: "1", brand: "TechVault", name: "Pro Wireless Earbuds", price: "$249.99", rating: 5, + reviewCount: "2.8k", imageSrc: "https://webuild-dev.s3.eu-north-1.amazonaws.com/users/user_3AiptcO4QrzBpwIQbUIl2kal97h/a-premium-tech-gadget-product-shot-sleek-1773085532843-b5a0598a.png", imageAlt: "Premium wireless earbuds", description: "High-quality wireless earbuds with active noise cancellation and 24-hour battery life", sku: "TWE-PRO-001", stock: 245, + category: "Audio" +}; + +export default function EditProductPage() { + const [formData, setFormData] = useState(initialFormData); + const [isSaving, setIsSaving] = useState(false); + + const handleInputChange = (e: React.ChangeEvent) => { + const { name, value } = e.target; + setFormData(prev => ({ + ...prev, + [name]: name === "rating" || name === "stock" ? parseInt(value) : value + })); + }; + + const handleSave = async () => { + setIsSaving(true); + try { + // Simulate API call + await new Promise(resolve => setTimeout(resolve, 1000)); + console.log("Product saved:", formData); + alert("Product updated successfully!"); + } finally { + setIsSaving(false); + } + }; + + const handleReset = () => { + setFormData(initialFormData); + }; + + return ( + + + +
+
+ {/* Header */} +
+ + + Back to Home + +

Edit Product

+

Modify product details, pricing, and inventory information

+
+ + {/* Form Container */} +
+
+ {/* Product Image Preview */} +
+
+ {formData.imageAlt} +
+
+ + +
+
+ + {/* Product Details Form */} +
+ {/* Brand & Name */} +
+ + +
+ +
+ + +
+ + {/* SKU & Category */} +
+
+ + +
+
+ + +
+
+
+
+ + {/* Pricing & Inventory Section */} +
+

Pricing & Inventory

+
+
+ + +
+ +
+ + +
+ +
+ + +
+
+
+ + {/* Description & Review Count */} +
+

Additional Details

+
+
+ + +
+ +
+ + +
+
+ +
+ +