From 1804e52e83c30c7c491336d6a53fe61cd725c9d0 Mon Sep 17 00:00:00 2001 From: g Date: Fri, 14 Feb 2025 20:36:48 +0000 Subject: [PATCH] uwu rawr :3 --- app/dashboard/products/page.tsx | 50 ++++--- app/dashboard/storefront/page.tsx | 8 -- components/modals/import-products-modal.tsx | 139 ++++++++++++++++++++ 3 files changed, 174 insertions(+), 23 deletions(-) create mode 100644 components/modals/import-products-modal.tsx diff --git a/app/dashboard/products/page.tsx b/app/dashboard/products/page.tsx index 4473a93..4c992f4 100644 --- a/app/dashboard/products/page.tsx +++ b/app/dashboard/products/page.tsx @@ -5,16 +5,17 @@ import { useRouter } from "next/navigation"; import Layout from "@/components/layout/layout"; import { Button } from "@/components/ui/button"; import { Product } from "@/models/products"; -import { Plus } from "lucide-react"; +import { Plus, Upload } from "lucide-react"; import { fetchProductData, saveProductData, saveProductImage, deleteProductData, } from "@/lib/productData"; -import { ProductModal } from "@/components/modals/product-modal"; import ProductTable from "@/components/tables/product-table"; -import { Category } from "@/models/categories" +import { Category } from "@/models/categories"; +import ImportProductsModal from "@/components/modals/import-products-modal"; +import { ProductModal } from "@/components/modals/product-modal"; export default function ProductsPage() { @@ -33,6 +34,8 @@ export default function ProductsPage() { pricing: [{ minQuantity: 1, pricePerUnit: 0 }], image: null, }); + const [importModalOpen, setImportModalOpen] = useState(false); + const [addProductOpen, setAddProductOpen] = useState(false); // Fetch products and categories useEffect(() => { @@ -214,14 +217,23 @@ export default function ProductsPage() { return (
-
-

- Product Inventory -

- +
+

Product Inventory

+
+ + +
setModalOpen(false)} + open={addProductOpen} + onClose={() => setAddProductOpen(false)} onSave={handleSaveProduct} productData={productData} categories={categories} editing={editing} handleChange={handleChange} handleTieredPricingChange={handleTieredPricingChange} - handleAddTier={handleAddTier} // ✅ Ensure this is passed - handleRemoveTier={handleRemoveTier} // ✅ Ensure this is passed + handleAddTier={handleAddTier} + handleRemoveTier={handleRemoveTier} setProductData={setProductData} /> + + { + setProducts(products); + }} + />
); diff --git a/app/dashboard/storefront/page.tsx b/app/dashboard/storefront/page.tsx index 0fa8aba..4fda5ac 100644 --- a/app/dashboard/storefront/page.tsx +++ b/app/dashboard/storefront/page.tsx @@ -138,14 +138,12 @@ export default function StorefrontPage() { fetchStorefront(); }, []); - // ✅ Handle Form Input Changes const handleInputChange = ( e: ChangeEvent ) => { setStorefront({ ...storefront, [e.target.name]: e.target.value }); }; - // ✅ Save Storefront Changes const saveStorefront = async () => { try { setSaving(true); @@ -161,7 +159,6 @@ export default function StorefrontPage() { return (
- {/* PGP Key Section */}
@@ -177,7 +174,6 @@ export default function StorefrontPage() { />
- {/* Telegram Section */}
@@ -193,7 +189,6 @@ export default function StorefrontPage() { />
- {/* Welcome Message Section */}
@@ -209,7 +204,6 @@ export default function StorefrontPage() { />
- {/* Shipping Locations Section */}
@@ -282,7 +276,6 @@ export default function StorefrontPage() {
- {/* Cryptocurrency Wallets Section */}
@@ -356,7 +349,6 @@ export default function StorefrontPage() {
- {/* Action Buttons */}
+ + + + + ); +} \ No newline at end of file