diff --git a/index.html b/index.html
new file mode 100644
index 0000000..8fa8bd7
--- /dev/null
+++ b/index.html
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+ Dashboard - Structure
+
+
+
+
+
+
+
+
diff --git a/package.json b/package.json
index 650baae..d31b74f 100644
--- a/package.json
+++ b/package.json
@@ -3,6 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
+ "@ant-design/icons": "^5.4.0",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.14.19",
"@react-google-maps/api": "^2.19.2",
@@ -65,9 +66,9 @@
"zustand": "^4.4.5"
},
"scripts": {
- "start": "react-scripts start",
- "build": "react-scripts build",
- "test": "react-scripts test",
+ "start": "vite",
+ "build": "vite build",
+ "serve": "vite preview",
"eject": "react-scripts eject",
"g:api": "node src/Extensions/FileGenerator/generateApi.js",
"g:column": "node src/Extensions/FileGenerator/generateColumn.js",
@@ -95,6 +96,8 @@
]
},
"devDependencies": {
- "@types/react-toggle": "^4.0.5"
+ "@types/react-toggle": "^4.0.5",
+ "@vitejs/plugin-react": "^4.3.1",
+ "vite": "^5.3.5"
}
}
diff --git a/public/index.html b/public/index.html
index 813d035..8fa8bd7 100644
--- a/public/index.html
+++ b/public/index.html
@@ -10,6 +10,8 @@
Dashboard - Structure
+
+
diff --git a/src.zip b/src.zip
deleted file mode 100644
index 11cebac..0000000
Binary files a/src.zip and /dev/null differ
diff --git a/src/Components/Columns/ColumnsImage.tsx b/src/Components/Columns/ColumnsImage.tsx
index 42154f1..0e93c1d 100644
--- a/src/Components/Columns/ColumnsImage.tsx
+++ b/src/Components/Columns/ColumnsImage.tsx
@@ -8,7 +8,6 @@ import {
} from '@ant-design/icons';
import React from 'react';
import { Image, Space } from 'antd';
-import { BaseURL, BaseURL_IMAGE } from '../../api/config';
const ColumnsImage= ({src}:any) => {
diff --git a/src/Components/ValidationField/View/File.tsx b/src/Components/ValidationField/View/File.tsx
index 974985d..56b392e 100644
--- a/src/Components/ValidationField/View/File.tsx
+++ b/src/Components/ValidationField/View/File.tsx
@@ -1,9 +1,16 @@
+<<<<<<< HEAD
import { Button, Upload, UploadFile } from 'antd'
import useFormField from '../../../Hooks/useFormField';
import { UploadOutlined } from '@ant-design/icons';
import { BaseURL, BaseURL_IMAGE } from '../../../api/config';
import { useTranslation } from 'react-i18next';
import { ErrorMessage } from 'formik';
+=======
+import { Button, Upload, UploadFile } from "antd";
+import useFormField from "../../../Hooks/useFormField";
+import React, { useMemo } from "react";
+import { FaUpload } from "react-icons/fa";
+>>>>>>> c6ee1f60784e6dd9e87132499ccbeb09ece51f63
const File = ({ name, label, onChange, isDisabled, accept, props }: any) => {
@@ -43,6 +50,26 @@ const File = ({ name, label, onChange, isDisabled, accept, props }: any) => {
defaultFileList={[...fileList]}
onChange={onChange || FilehandleChange}
customRequest={customRequest}
+<<<<<<< HEAD
+=======
+ className={` w-100`}
+ id={name}
+ >
+ }
+ >
+ {placeholder
+ ? t(`input.${placeholder}`)
+ : t("input.Click_to_upload_the_image")}
+
+ {isError ? "required" : ""}
+ {errorMsg}
+
+
+ );
+};
+>>>>>>> c6ee1f60784e6dd9e87132499ccbeb09ece51f63
>
}>{t("upload_image")}
diff --git a/src/Components/ValidationField/View/MaltyFile.tsx b/src/Components/ValidationField/View/MaltyFile.tsx
new file mode 100644
index 0000000..ab2ab7a
--- /dev/null
+++ b/src/Components/ValidationField/View/MaltyFile.tsx
@@ -0,0 +1,86 @@
+import React, { useMemo } from "react";
+import { Button, Upload } from "antd";
+import useFormField from "../../../Hooks/useFormField";
+import { FaUpload } from "react-icons/fa";
+
+const MaltyFile = ({
+ name,
+ label,
+ onChange,
+ isDisabled,
+ placeholder,
+ className,
+ props,
+}: any) => {
+ const { formik, t, isError } = useFormField(name, props);
+ let imageUrl = formik?.values?.[name] ?? null;
+
+ // Memoizing the fileList to prevent unnecessary recalculations
+ const fileList = useMemo(() => {
+ return imageUrl
+ ? imageUrl.map((file: any, index: number) => {
+ return file instanceof File
+ ? {
+ uid: index,
+ name: file?.name,
+ status: "done",
+ originFileObj: file,
+ }
+ : {
+ uid: index,
+ id: file?.id,
+ name: file?.name,
+ status: "done",
+ url: file?.url || "",
+ thumbUrl: file?.url || "",
+ };
+ })
+ : [];
+ }, [imageUrl]); // Dependency array ensures it recalculates only when imageUrl changes
+
+ const FilehandleChange = ({ fileList }: any) => {
+ if (fileList.length === 0) {
+ formik.setFieldValue(name, null);
+ } else {
+ formik.setFieldValue(
+ name,
+ fileList.map((file: any) => file?.originFileObj ?? file),
+ );
+ }
+ };
+
+ // Custom request function
+ const customRequest = async ({ onSuccess }: any) => {
+ // Perform any necessary actions before onSuccess is called
+ onSuccess();
+ };
+
+ return (
+
+
+
+
+ }
+ >
+ {t(`input.` + placeholder) ?? t("input.upload_image")}
+
+ {isError ? "required" : ""}
+
+
+ );
+};
+
+export default MaltyFile;
diff --git a/vite.config.js b/vite.config.js
new file mode 100644
index 0000000..4e690eb
--- /dev/null
+++ b/vite.config.js
@@ -0,0 +1,11 @@
+import { defineConfig } from 'vite';
+import react from '@vitejs/plugin-react';
+
+export default defineConfig(() => {
+ return {
+ build: {
+ outDir: 'build',
+ },
+ plugins: [react()],
+ };
+});
\ No newline at end of file