diff --git a/src/App.tsx b/src/App.tsx index 3a2b434..2935dfa 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -11,7 +11,6 @@ import { RoleByType } from "./utils/RoleByType"; const Page404 = lazy(() => import("./Layout/Ui/NotFoundPage")); const Auth = lazy(() => import("./Pages/Auth/Page")); const App = () => { - return ( { {renderRoutesRecursively(menuItems)} {CrudRoute.map((route) => { - const useAbility = hasAbility(route.abilities, route.abilities_value); - if(!RoleByType(route)){ - return false ; - } + const useAbility = hasAbility(route.abilities, route.abilities_value); + if (!RoleByType(route)) { + return false; + } if (!useAbility) { return false; } diff --git a/src/Components/CustomFields/PdfUploader.tsx b/src/Components/CustomFields/PdfUploader.tsx index e76460c..b0e2c98 100644 --- a/src/Components/CustomFields/PdfUploader.tsx +++ b/src/Components/CustomFields/PdfUploader.tsx @@ -16,7 +16,7 @@ const PdfUploader = ({ }: any) => { const { formik, t, isError } = useFormField(name, props); let FormikName = formik.values[name]; - const imageUrl = formik.values[name] ? FormikName : ""; + const imageUrl = formik.values[name] ? FormikName : ""; const [Imageurl, setImageurl] = useState(null); const FilehandleChange = (value: any) => { diff --git a/src/Components/CustomFields/SelectTag.tsx b/src/Components/CustomFields/SelectTag.tsx index 5d3a902..eb4685b 100644 --- a/src/Components/CustomFields/SelectTag.tsx +++ b/src/Components/CustomFields/SelectTag.tsx @@ -7,7 +7,7 @@ import { useFormikContext } from "formik"; const SelectTag: React.FC = () => { const [searchValue, setSearchValue] = useState(""); - + const [fieldValue, setFieldValue] = useState(""); const formik = useFormikContext(); const handleChange = (value: string[]) => { @@ -38,18 +38,16 @@ const SelectTag: React.FC = () => { const [t] = useTranslation(); const options = data?.data ?? []; - const additionalData = - options.length < 1 && searchValue.length > 1 && !isLoading - ? [{ id: searchValue, name: searchValue }] - : []; + const additionalData = + options.length < 1 && searchValue.length > 1 && !isLoading + ? [{ id: searchValue, name: searchValue }] + : []; + const value = + formik?.values?.tags?.map((item: any) => item?.id ?? item) ?? []; + const AllOptions = [...options, ...additionalData]; -const value = formik?.values?.tags?.map((item: any) => item?.id ?? item) ?? []; - - - const AllOptions = [...options, ...additionalData] - return (
diff --git a/src/Components/DataTable/SearchField.tsx b/src/Components/DataTable/SearchField.tsx index 51fb041..20d89e3 100644 --- a/src/Components/DataTable/SearchField.tsx +++ b/src/Components/DataTable/SearchField.tsx @@ -15,22 +15,17 @@ const SearchField: React.FC = ({ placeholder, searchBy }) => { const [searchQuery, setSearchQuery] = useState(""); const inputRef = useRef(null); - - - const {setFilter} = useFilterStateState() + const { setFilter } = useFilterStateState(); const handleInputChange = (value: string) => { setSearchQuery(value); - }; - const handleInputChangeWithDebounce = useDebounce( - (value: string) => { - setFilter({ - name:value - }) - } - ) + const handleInputChangeWithDebounce = useDebounce((value: string) => { + setFilter({ + name: value, + }); + }); const handleToggleDropdown = () => { setIsOpen(!isOpen); @@ -60,7 +55,10 @@ const SearchField: React.FC = ({ placeholder, searchBy }) => { className="search__input" placeholder={t(placeholder)} value={searchQuery} - onChange={(e) => {handleInputChange(e.target.value) ; handleInputChangeWithDebounce(e.target.value)}} + onChange={(e) => { + handleInputChange(e.target.value); + handleInputChangeWithDebounce(e.target.value); + }} />
diff --git a/src/Components/Filter/OrderBySelect.tsx b/src/Components/Filter/OrderBySelect.tsx index 1689b38..d2dc85e 100644 --- a/src/Components/Filter/OrderBySelect.tsx +++ b/src/Components/Filter/OrderBySelect.tsx @@ -6,11 +6,11 @@ import { useFilterStateState } from "../../zustand/Filter"; const OrderBySelect = () => { const { t } = useTranslation(); - const {setFilter} = useFilterStateState() + const { setFilter } = useFilterStateState(); const handleChange = (value: string) => { setFilter({ - sort_by:value - }) + sort_by: value, + }); }; return ( @@ -29,8 +29,14 @@ const OrderBySelect = () => { options={[ { value: "ascending", label: t("select.array.order.ascending") }, { value: "descending", label: t("select.array.order.descending") }, - { value: "recently_viewed", label: t("select.array.order.recently_viewed") }, - { value: "recently_arrived", label: t("select.array.order.recently_arrived") }, + { + value: "recently_viewed", + label: t("select.array.order.recently_viewed"), + }, + { + value: "recently_arrived", + label: t("select.array.order.recently_arrived"), + }, ]} /> diff --git a/src/Components/Filter/PaginationColumn.tsx b/src/Components/Filter/PaginationColumn.tsx index 2006728..34b39ac 100644 --- a/src/Components/Filter/PaginationColumn.tsx +++ b/src/Components/Filter/PaginationColumn.tsx @@ -4,7 +4,6 @@ import { Divider, Select } from "antd"; import usePagination from "../../Layout/Dashboard/usePagination"; import { useNavigate } from "react-router-dom"; - const PaginationColumn = () => { const { t } = useTranslation(); const navigate = useNavigate(); @@ -13,7 +12,6 @@ const PaginationColumn = () => { navigate(`?per_page=${value}`); }; - return (