From a78e5ee94d92ac3615d54c21c28c425ccb4f5469 Mon Sep 17 00:00:00 2001 From: mariful-nyx Date: Wed, 31 Jul 2024 17:55:31 +0600 Subject: [PATCH] fix console error --- src/components/images/field.tsx | 4 ++-- src/components/images/modal.tsx | 2 +- src/components/seo/SEO.tsx | 14 +++++++++----- src/icons/NXEditPen.tsx | 2 +- src/icons/NXPen.tsx | 2 +- src/icons/NXUnfulfilled.tsx | 4 ++-- ...il--change-edit-modify-pencil-write-writing.svg | 2 +- src/pages/collection/modal.tsx | 6 +++--- src/pages/color/colorList.tsx | 2 +- src/pages/color/modal.tsx | 6 +++--- src/pages/productType/modal.tsx | 10 +++++----- 11 files changed, 29 insertions(+), 25 deletions(-) diff --git a/src/components/images/field.tsx b/src/components/images/field.tsx index 7ffad7e..f1da6ba 100644 --- a/src/components/images/field.tsx +++ b/src/components/images/field.tsx @@ -127,7 +127,7 @@ const ImageField: React.FC = ({ label='', value, name, onChang alt="" className="aspect-square w-full h-full object-cover rounded-md" /> -
+
deleteImage(e, imgData.id)}>
@@ -136,7 +136,7 @@ const ImageField: React.FC = ({ label='', value, name, onChang ))} diff --git a/src/components/images/modal.tsx b/src/components/images/modal.tsx index 91067bf..8b04afb 100644 --- a/src/components/images/modal.tsx +++ b/src/components/images/modal.tsx @@ -172,7 +172,7 @@ const ImageChooseModal: React.FC = ({ onClose, onSelected
@@ -113,7 +113,7 @@ function CollectionModal({ isOpen, onClose, onSubmit, edit }: CollectionModalPro id="name" name='description' errorData={errorData} - value={formData.description} + value={formData.description || ''} onChange={handleChange} className="mt-1 block w-full border border-gray-300 rounded-md shadow-sm p-2 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" /> diff --git a/src/pages/color/colorList.tsx b/src/pages/color/colorList.tsx index e63f514..8a443ae 100644 --- a/src/pages/color/colorList.tsx +++ b/src/pages/color/colorList.tsx @@ -113,7 +113,7 @@ function Color() { - {colors.map((row: any, index) => ( + {colors?.map((row: any, index) => ( ({}); + const [formData, setFormData] = useState({ name: '', code: '#000000' }); const [errorData, setErrorData] = useState({}); const api = useApi(); @@ -80,7 +80,7 @@ function ColorModal({ isOpen, onClose, onSubmit, edit }: ColorModalProps) { id="name" name='name' errorData={errorData} - value={formData.name} + value={formData.name || ''} onChange={handleChange} className="mt-1 block w-full border border-gray-300 rounded-md shadow-sm p-2 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" /> @@ -93,7 +93,7 @@ function ColorModal({ isOpen, onClose, onSubmit, edit }: ColorModalProps) { diff --git a/src/pages/productType/modal.tsx b/src/pages/productType/modal.tsx index 466f45a..077fafd 100644 --- a/src/pages/productType/modal.tsx +++ b/src/pages/productType/modal.tsx @@ -87,7 +87,7 @@ function ProductTypeModal({ isOpen, onClose, onSubmit, edit }: ProductTypeModalP id="name" name='name' errorData={errorData} - value={formData.name} + value={formData.name || ''} onChange={handleChange} className="mt-1 block w-full border border-gray-300 rounded-md shadow-sm p-2 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" /> @@ -100,7 +100,7 @@ function ProductTypeModal({ isOpen, onClose, onSubmit, edit }: ProductTypeModalP Indicates whether this product type is subject to taxation @@ -110,7 +110,7 @@ function ProductTypeModal({ isOpen, onClose, onSubmit, edit }: ProductTypeModalP Select if this product type represents tangible, shippable items @@ -120,7 +120,7 @@ function ProductTypeModal({ isOpen, onClose, onSubmit, edit }: ProductTypeModalP Enable inventory management for this product type @@ -130,7 +130,7 @@ function ProductTypeModal({ isOpen, onClose, onSubmit, edit }: ProductTypeModalP Allow multiple variations of this product type (e.g., sizes, colors)