diff --git a/react-admin/src/pages/admin-user/AdminUserEdit.tsx b/react-admin/src/pages/admin-user/AdminUserEdit.tsx index 3f96ed33..eb8e8450 100644 --- a/react-admin/src/pages/admin-user/AdminUserEdit.tsx +++ b/react-admin/src/pages/admin-user/AdminUserEdit.tsx @@ -56,7 +56,6 @@ function AdminUserEdit() { }; return ( -
@@ -171,7 +170,6 @@ function AdminUserEdit() {
-
); } diff --git a/react-admin/src/pages/admin-user/AdminUserTable.tsx b/react-admin/src/pages/admin-user/AdminUserTable.tsx index 48046ced..fdd6a55c 100644 --- a/react-admin/src/pages/admin-user/AdminUserTable.tsx +++ b/react-admin/src/pages/admin-user/AdminUserTable.tsx @@ -128,27 +128,30 @@ function AdminUserTable() { return ( <> -
-
- {t("admin_users")} -
- - - {t("create")} - - -
-
-
- - +
+
+
+ {t("admin_users")} +
+ + + {t("create")} +
+
+
+ + + +
+
+ ); } diff --git a/react-admin/src/pages/asset/AssetTable.tsx b/react-admin/src/pages/asset/AssetTable.tsx index 1123679d..aa5eccf6 100644 --- a/react-admin/src/pages/asset/AssetTable.tsx +++ b/react-admin/src/pages/asset/AssetTable.tsx @@ -1,134 +1,132 @@ -import React, { useState } from "react"; -import { useAssetTable } from "./hooks/useAssetTable"; +import React, {useState} from "react"; +import {useAssetTable} from "./hooks/useAssetTable"; import _ from "lodash"; -import { useStoreAsset } from "./hooks/useStoreAsset"; -import { useTranslation } from "react-i18next"; -import { AssetSaveSchema } from "./schemas/asset.save.schema"; -import { SubmitHandler, useForm } from "react-hook-form"; -import { joiResolver } from "@hookform/resolvers/joi"; +import {useStoreAsset} from "./hooks/useStoreAsset"; +import {useTranslation} from "react-i18next"; +import {AssetSaveSchema} from "./schemas/asset.save.schema"; +import {SubmitHandler, useForm} from "react-hook-form"; +import {joiResolver} from "@hookform/resolvers/joi"; import IAssetSave from "../../types/asset/IAssetSave"; import IAssetModel from "../../types/asset/IAssetModel"; -import { AssetUploadModal } from "./AssetUploadModal"; -import { DisplayAsset } from "./DisplayAsset"; -import { CreateFolderModal } from "./CreateFolderModal"; +import {AssetUploadModal} from "./AssetUploadModal"; +import {DisplayAsset} from "./DisplayAsset"; +import {CreateFolderModal} from "./CreateFolderModal"; import {useParams} from "react-router-dom"; function AssetTable() { - const [isUploadAssetModalOpen, setIsUploadAssetModalOpen] = useState(false); - const [isCreateFolderModalOpen, setIsCreateFolderModalOpen] = useState(false); + const [isUploadAssetModalOpen, setIsUploadAssetModalOpen] = useState(false); + const [isCreateFolderModalOpen, setIsCreateFolderModalOpen] = useState(false); - const params = useParams() - const asset_id: string = params.asset_id ?? '' + const params = useParams() + const asset_id: string = params.asset_id ?? '' - const asset_api_table_response = useAssetTable(asset_id); - const assets: Array = _.get( - asset_api_table_response, - "data.data.data", - [], - ); + const asset_api_table_response = useAssetTable(asset_id); + const assets: Array = _.get( + asset_api_table_response, + "data.data.data", + [], + ); - const { mutate } = useStoreAsset(asset_id); - const [t] = useTranslation("global"); + const {mutate} = useStoreAsset(asset_id); + const [t] = useTranslation("global"); - const { - register, - handleSubmit, - formState: { errors }, - } = useForm({ - resolver: joiResolver(AssetSaveSchema, { allowUnknown: true }), - }); + const { + register, + handleSubmit, + formState: {errors}, + } = useForm({ + resolver: joiResolver(AssetSaveSchema, {allowUnknown: true}), + }); - const openFolder = (e: React.MouseEvent, asset_id: string) => { - e.preventDefault(); - console.log(asset_id); - }; + const openFolder = (e: React.MouseEvent, asset_id: string) => { + e.preventDefault(); + console.log(asset_id); + }; - const onCloseCreateFolderModal = () => { - setIsCreateFolderModalOpen(false); - }; + const onCloseCreateFolderModal = () => { + setIsCreateFolderModalOpen(false); + }; - const openCreateFolderModal = () => { - setIsCreateFolderModalOpen(true); - }; + const openCreateFolderModal = () => { + setIsCreateFolderModalOpen(true); + }; - const onCloseUploadModal = () => { - setIsUploadAssetModalOpen(false); - }; + const onCloseUploadModal = () => { + setIsUploadAssetModalOpen(false); + }; - const openUploadAssetModal = () => { - setIsUploadAssetModalOpen(true); - }; + const openUploadAssetModal = () => { + setIsUploadAssetModalOpen(true); + }; - const submitHandler: SubmitHandler = (data: IAssetSave) => { - data.file = data.file_list ? data.file_list[0] : undefined; - onCloseUploadModal(); - mutate(data); - }; + const submitHandler: SubmitHandler = (data: IAssetSave) => { + data.file = data.file_list ? data.file_list[0] : undefined; + onCloseUploadModal(); + mutate(data); + }; - return ( -
-
-
-
- {t("asset_table")} -
-
- - -
+ return ( + <> +
+
+ {t("asset_table")} +
+
+ + +
-
- - -
-
+
+ + +
+
-
-
-
-
-
-
- {assets.map((asset: IAssetModel) => { - return ( - - ); - })} -
+
+
+
+
+
+
+ {assets.map((asset: IAssetModel) => { + return ( + + ); + })} +
+
+
+
-
-
-
-
-
- ); + + ); } export default AssetTable; diff --git a/react-admin/src/pages/component/ComponentCreatePage.tsx b/react-admin/src/pages/component/ComponentCreatePage.tsx index eb0e53a3..f45bc40d 100644 --- a/react-admin/src/pages/component/ComponentCreatePage.tsx +++ b/react-admin/src/pages/component/ComponentCreatePage.tsx @@ -1,346 +1,345 @@ import React from "react"; -import { Link } from "react-router-dom"; -import { PlusIcon, TrashIcon } from "@heroicons/react/24/solid"; +import {Link} from "react-router-dom"; +import {PlusIcon, TrashIcon} from "@heroicons/react/24/solid"; import InputField from "../../components/InputField"; -import { useStoreComponent } from "./hooks/useStoreComponent"; -import { useTranslation } from "react-i18next"; -import { AvoRedFieldTypesEnum } from "../../types/field/AvoRedFieldTypesEnum"; -import { Controller, useFieldArray, useForm } from "react-hook-form"; -import { joiResolver } from "@hookform/resolvers/joi"; -import { useComponentCreateSchema } from "./schemas/component.create.schema"; +import {useStoreComponent} from "./hooks/useStoreComponent"; +import {useTranslation} from "react-i18next"; +import {AvoRedFieldTypesEnum} from "../../types/field/AvoRedFieldTypesEnum"; +import {Controller, useFieldArray, useForm} from "react-hook-form"; +import {joiResolver} from "@hookform/resolvers/joi"; +import {useComponentCreateSchema} from "./schemas/component.create.schema"; import ICreatableComponent, {CreatableElementDataType} from "../../types/component/ICreatableComponent"; import ErrorMessage from "../../components/ErrorMessage"; import slug from "slug"; export const ComponentCreatePage = (() => { - const { mutate, error } = useStoreComponent(); - const { - control, - register, - handleSubmit, - formState: { errors }, - setValue, - trigger, - } = useForm({ - resolver: joiResolver(useComponentCreateSchema()), - }); - const { fields: elements, append, remove } = useFieldArray({ - control, - name: "elements", - }); + const {mutate, error} = useStoreComponent(); + const { + control, + register, + handleSubmit, + formState: {errors}, + setValue, + trigger, + } = useForm({ + resolver: joiResolver(useComponentCreateSchema()), + }); + const {fields: elements, append, remove} = useFieldArray({ + control, + name: "elements", + }); - const [t] = useTranslation("global"); + const [t] = useTranslation("global"); - const addElementOnClick = () => { - append({ name: "", identifier: "", element_type: AvoRedFieldTypesEnum.TEXT, element_data_type: 'TEXT' }); - }; + const addElementOnClick = () => { + append({name: "", identifier: "", element_type: AvoRedFieldTypesEnum.TEXT, element_data_type: 'TEXT'}); + }; - const deleteElementOnClick = (elementIndex: number) => { - remove(elementIndex); - }; + const deleteElementOnClick = (elementIndex: number) => { + remove(elementIndex); + }; - const elementTypeButtonOnClick = ( - fieldIndex: number, - fieldTypeValue: string, - ) => { - setValue(`elements.${fieldIndex}.element_type`, fieldTypeValue); - setValue(`elements.${fieldIndex}.element_data`, [{ label: "", value: "" }]); - // Ideally value of this data type can be based on element - // e.g: Number Input field will have INT(It should match rust backend type) data type - setValue(`elements.${fieldIndex}.element_data_type`, 'TEXT'); - trigger(`elements.${fieldIndex}`); - }; + const elementTypeButtonOnClick = ( + fieldIndex: number, + fieldTypeValue: string, + ) => { + setValue(`elements.${fieldIndex}.element_type`, fieldTypeValue); + setValue(`elements.${fieldIndex}.element_data`, [{label: "", value: ""}]); + // Ideally value of this data type can be based on element + // e.g: Number Input field will have INT(It should match rust backend type) data type + setValue(`elements.${fieldIndex}.element_data_type`, 'TEXT'); + trigger(`elements.${fieldIndex}`); + }; - const optionDeleteActionOnClick = ( - e: React.MouseEvent, - elementIndex: number, - element_data: Array | undefined, - option_index: number, - ) => { - element_data?.splice(option_index, 1); - setValue(`elements.${elementIndex}.element_data`, element_data); - trigger(`elements.${elementIndex}`); - }; + const optionDeleteActionOnClick = ( + e: React.MouseEvent, + elementIndex: number, + element_data: Array | undefined, + option_index: number, + ) => { + element_data?.splice(option_index, 1); + setValue(`elements.${elementIndex}.element_data`, element_data); + trigger(`elements.${elementIndex}`); + }; - const optionAddActionOnClick = ( - e: React.MouseEvent, - elementIndex: number, - element_data: Array | undefined, - ) => { - element_data?.push({ label: "", value: "" }); - setValue(`elements.${elementIndex}.element_data`, element_data); - trigger(`elements.${elementIndex}`); - }; + const optionAddActionOnClick = ( + e: React.MouseEvent, + elementIndex: number, + element_data: Array | undefined, + ) => { + element_data?.push({label: "", value: ""}); + setValue(`elements.${elementIndex}.element_data`, element_data); + trigger(`elements.${elementIndex}`); + }; - const submitHandler = (data: any) => { - mutate(data); - }; + const submitHandler = (data: any) => { + mutate(data); + }; - const onNameChange = (e: React.KeyboardEvent) => { - setValue('identifier', slug(e.currentTarget.value || '')) - } + const onNameChange = (e: React.KeyboardEvent) => { + setValue('identifier', slug(e.currentTarget.value || '')) + } - const ElementNameOnChange = (async (e: React.KeyboardEvent, elementIndex: number) => { - setValue(`elements.${elementIndex}.identifier`, slug(e.currentTarget.value)) - await trigger(`elements.${elementIndex}`) - }) + const ElementNameOnChange = (async (e: React.KeyboardEvent, elementIndex: number) => { + setValue(`elements.${elementIndex}.identifier`, slug(e.currentTarget.value)) + await trigger(`elements.${elementIndex}`) + }) - return ( -
-
-
-
-

- {t("component_information")} -

-
-
- onNameChange(e)} - /> - -
-
- - -
- - {elements.map((element, index) => { - return ( -
-
- + return ( +
+
+
+

+ {t("component_information")} +

+ +
+ onNameChange(e)} + /> + +
+
+ +
-
-
-
- elementTypeButtonOnClick( - index, - AvoRedFieldTypesEnum.TEXT, - ) - } - className={`${ - element.element_type === AvoRedFieldTypesEnum.TEXT - ? "bg-primary-300" - : "bg-gray-300" - } ring-1 p-3 mt-3 rounded`} - > - {t("text")} -
-
- elementTypeButtonOnClick( - index, - AvoRedFieldTypesEnum.TEXTAREA, - ) - } - className={`${ - element.element_type === AvoRedFieldTypesEnum.TEXTAREA - ? "bg-primary-300" - : "bg-gray-300" - } ring-1 p-3 mt-3 rounded`} - > - {t("textarea")} -
-
- elementTypeButtonOnClick( - index, - AvoRedFieldTypesEnum.SELECT, - ) - } - className={`${ - element.element_type === AvoRedFieldTypesEnum.SELECT - ? "bg-primary-300" - : "bg-gray-300" - } ring-1 p-3 mt-3 rounded`} - > - {t("select")} -
-
+ {elements.map((element, index) => { + return ( +
+
+ +
-
-
- { - return <>{t!('element_type')}: {element.value}; - }} - control={control} - /> - -
-
- ElementNameOnChange(e, index)} - /> -
-
- -
- { - return element.value.element_type === - AvoRedFieldTypesEnum.SELECT ? ( -
-
-
- {t("element_options")} -
+
+
+
+ elementTypeButtonOnClick( + index, + AvoRedFieldTypesEnum.TEXT, + ) + } + className={`${ + element.element_type === AvoRedFieldTypesEnum.TEXT + ? "bg-primary-300" + : "bg-gray-300" + } ring-1 p-3 mt-3 rounded`} + > + {t("text")} +
+
+ elementTypeButtonOnClick( + index, + AvoRedFieldTypesEnum.TEXTAREA, + ) + } + className={`${ + element.element_type === AvoRedFieldTypesEnum.TEXTAREA + ? "bg-primary-300" + : "bg-gray-300" + } ring-1 p-3 mt-3 rounded`} + > + {t("textarea")} +
+
+ elementTypeButtonOnClick( + index, + AvoRedFieldTypesEnum.SELECT, + ) + } + className={`${ + element.element_type === AvoRedFieldTypesEnum.SELECT + ? "bg-primary-300" + : "bg-gray-300" + } ring-1 p-3 mt-3 rounded`} + > + {t("select")} +
- {element.value.element_data?.map( - (element_data, element_data_index) => { - return ( -
-
- -
+
+
+ { + return <>{t!('element_type')}: {element.value}; + }} + control={control} + /> + +
+
+ ElementNameOnChange(e, index)} + /> +
+
+ +
+ { + return element.value.element_type === + AvoRedFieldTypesEnum.SELECT ? ( +
+
+
+ {t("element_options")} +
+
-
- -
- { + return ( +
+
+ +
+ +
+ +
+ +
+ optionDeleteActionOnClick( + e, + index, + element.value.element_data, + element_data_index, + ) + } + className="absolute inset-y-0 end-0 z-40 flex items-center text-gray-500" + > + +
+
+
+
+ ); + }, )} - /> -
- optionDeleteActionOnClick( - e, - index, - element.value.element_data, - element_data_index, - ) - } - className="absolute inset-y-0 end-0 z-40 flex items-center text-gray-500" - > - +
+ optionAddActionOnClick( + e, + index, + element.value.element_data, + ) + } + > + +
-
-
-
- ); - }, - )} -
- optionAddActionOnClick( - e, - index, - element.value.element_data, - ) - } - > - + ) : ( + <> + ); + }} + />
-
- ) : ( - <> - ); - }} - /> -
-
-
- ); - })} +
+
+ ); + })} -
- -
+
+ +
-
- - - {t("cancel")} - +
+ + + {t("cancel")} + +
+
-
-
-
- ); + ); }); diff --git a/react-admin/src/pages/component/ComponentEditPage.tsx b/react-admin/src/pages/component/ComponentEditPage.tsx index ac9c0bba..94d8d26c 100644 --- a/react-admin/src/pages/component/ComponentEditPage.tsx +++ b/react-admin/src/pages/component/ComponentEditPage.tsx @@ -12,14 +12,14 @@ import slug from 'slug' import {useComponentEditSchema} from "./schemas/component.edit.schema" import {AvoRedFieldTypesEnum} from "../../types/field/AvoRedFieldTypesEnum" import IEditableComponent, { - EditableComponentElementDataType, + EditableComponentElementDataType, } from "../../types/component/IEditableComponent"; import {usePutComponentIdentifier} from "./hooks/usePutComponentIdentifier" import {useComponentPutSchema} from "./schemas/component.put.schema"; import {PutComponentIdentifierType} from "../../types/component/PutComponentIdentifierType"; import ErrorMessage from "../../components/ErrorMessage"; -export const ComponentEditPage = (() => { +export const ComponentEditPage = (() => { const [t] = useTranslation("global") const params = useParams() @@ -122,271 +122,269 @@ export const ComponentEditPage = (() => { }) return ( -
-
-
-
-

- {t("component_information")} -

-
-
- - -
-
- - -
- {isEditableIdentifier ? ( - <> +
+
+
+

+ {t("component_information")} +

+ +
+ + +
+
+ + +
+ {isEditableIdentifier ? ( + <> {t("edit_identifier")} - - ) : ( - <> - - - - )} -
+ + ) : ( + <> + + + + )}
+
- {elements.map((element, index) => { - return ( -
-
- -
+ {elements.map((element, index) => { + return ( +
+
+ +
-
-
-
- elementTypeButtonOnClick(index, AvoRedFieldTypesEnum.TEXT) - } - className={`${ - element.element_type === AvoRedFieldTypesEnum.TEXT - ? "bg-primary-300" - : "bg-gray-300" - } ring-1 p-3 mt-3 rounded`} - > - {t("text")} -
-
- elementTypeButtonOnClick(index, AvoRedFieldTypesEnum.TEXTAREA) - } - className={`${ - element.element_type === AvoRedFieldTypesEnum.TEXTAREA - ? "bg-primary-300" - : "bg-gray-300" - } ring-1 p-3 mt-3 rounded`} - > - {t("textarea")} -
-
- elementTypeButtonOnClick(index, AvoRedFieldTypesEnum.SELECT) - } - className={`${ - element.element_type === AvoRedFieldTypesEnum.SELECT - ? "bg-primary-300" - : "bg-gray-300" - } ring-1 p-3 mt-3 rounded`} - > - {t("select")} -
+
+
+
+ elementTypeButtonOnClick(index, AvoRedFieldTypesEnum.TEXT) + } + className={`${ + element.element_type === AvoRedFieldTypesEnum.TEXT + ? "bg-primary-300" + : "bg-gray-300" + } ring-1 p-3 mt-3 rounded`} + > + {t("text")} +
+
+ elementTypeButtonOnClick(index, AvoRedFieldTypesEnum.TEXTAREA) + } + className={`${ + element.element_type === AvoRedFieldTypesEnum.TEXTAREA + ? "bg-primary-300" + : "bg-gray-300" + } ring-1 p-3 mt-3 rounded`} + > + {t("textarea")} +
+
+ elementTypeButtonOnClick(index, AvoRedFieldTypesEnum.SELECT) + } + className={`${ + element.element_type === AvoRedFieldTypesEnum.SELECT + ? "bg-primary-300" + : "bg-gray-300" + } ring-1 p-3 mt-3 rounded`} + > + {t("select")}
+
-
-
- { - return ( - <> - {t!('field_type')}: {field.value} - - ) - }} - control={control} - /> - - -
- -
- ElementNameOnChange(e, index)} - label={t('element_name')} - placeholder={t('element_name')} - /> -
-
- -
+
+
{ + name={`elements.${index}.element_type`} + render={({field}) => { return ( - element.value.element_type === AvoRedFieldTypesEnum.SELECT ? ( -
-
-
- {t("element_options")} -
-
- - {element.value.element_data?.map((element_option, element_data_index) => { - return ( -
- -
- + <> + {t!('field_type')}: {field.value} + + ) + }} + control={control} + /> + + +
+ +
+ ElementNameOnChange(e, index)} + label={t('element_name')} + placeholder={t('element_name')} + /> +
+
+ +
+ { + return ( + element.value.element_type === AvoRedFieldTypesEnum.SELECT ? ( +
+
+
+ {t("element_options")} +
+
+ + {element.value.element_data?.map((element_option, element_data_index) => { + return ( +
+ +
+ + +
+ +
+ + +
+ -
- -
- - -
- - -
optionDeleteActionOnClick(e, index, element.value.element_data, element_data_index)} - className="absolute inset-y-0 end-0 z-40 flex items-center text-gray-500" - > - -
+
optionDeleteActionOnClick(e, index, element.value.element_data, element_data_index)} + className="absolute inset-y-0 end-0 z-40 flex items-center text-gray-500" + > +
+
-
- ) - })} - -
optionAddActionOnClick(e, index, element.value.element_data)}> -
+ ) + })} + +
optionAddActionOnClick(e, index, element.value.element_data)}> + -
- +
- ) : <> - ) - }} - control={control} - /> + +
+ ) : <> + ) + }} + control={control} + /> -
- ); - })} - -
-
+ ); + })} + +
+ -
+ +
-
- - - {t("cancel")} - -
- -
+
+ + + {t("cancel")} + +
+
diff --git a/react-admin/src/pages/component/ComponentTablePage.tsx b/react-admin/src/pages/component/ComponentTablePage.tsx index 26cf3b70..823c1c79 100644 --- a/react-admin/src/pages/component/ComponentTablePage.tsx +++ b/react-admin/src/pages/component/ComponentTablePage.tsx @@ -104,27 +104,25 @@ export const ComponentTablePage = (() => { }) return ( -
-
-
-
- {t("components")} -
- - - {t("create")} - - +
+
+
+ {t("components")}
+ + + {t("create")} + + +
-
- - - -
+
+ + +
); diff --git a/react-admin/src/pages/models/ModelCreatePage.tsx b/react-admin/src/pages/models/ModelCreatePage.tsx index 3f7fad0d..4c41ac19 100644 --- a/react-admin/src/pages/models/ModelCreatePage.tsx +++ b/react-admin/src/pages/models/ModelCreatePage.tsx @@ -1,4 +1,4 @@ -import { Link } from "react-router-dom"; +import {Link} from "react-router-dom"; import InputField from "../../components/InputField"; import {useTranslation} from "react-i18next"; import {useForm} from "react-hook-form"; @@ -24,59 +24,57 @@ export const ModelCreatePage = () => { }) return ( <> -
-
-
-
-

- {t("model_information")} -

+
+
+
+

+ {t("model_information")} +

-
-
- - -
-
- - -
-
- - - {t("cancel")} - -
-
-
-
+
+
+ + +
+
+ + +
+
+ + + {t("cancel")} + +
+
+
diff --git a/react-admin/src/pages/models/ModelEditPage.tsx b/react-admin/src/pages/models/ModelEditPage.tsx index 38dc5f2f..8503c187 100644 --- a/react-admin/src/pages/models/ModelEditPage.tsx +++ b/react-admin/src/pages/models/ModelEditPage.tsx @@ -15,7 +15,7 @@ import {useUpdateModel} from "./hooks/useUpdateModel"; export const ModelEditPage = (() => { const params = useParams(); const model_id = params.model_id ?? '' - const { mutate } = useUpdateModel(model_id); + const {mutate} = useUpdateModel(model_id); const [t] = useTranslation("global") const {data} = useGetModel(model_id) const [isEditableIdentifier, setIsEditableIdentifier] = useState(true) @@ -61,73 +61,71 @@ export const ModelEditPage = (() => { }) return ( <> -
-
-
-
-

- {t("model_information")} -

+
+
+
+

+ {t("model_information")} +

-
-
- -
-
- -
- {isEditableIdentifier ? ( - <> + +
+ +
+
+ +
+ {isEditableIdentifier ? ( + <> {t("edit_identifier")} - - ) : ( - <> - - - - )} -
+ + ) : ( + <> + + + + )}
+
-
- - - {t("cancel")} - -
- -
+
+ + + {t("cancel")} + +
+
diff --git a/react-admin/src/pages/models/ModelTablePage.tsx b/react-admin/src/pages/models/ModelTablePage.tsx index 4177cd9a..90559abc 100644 --- a/react-admin/src/pages/models/ModelTablePage.tsx +++ b/react-admin/src/pages/models/ModelTablePage.tsx @@ -103,30 +103,28 @@ export const ModelTablePage = (() => { return ( <> -
-
-
-
- {t("model")} -
-
- - - {t("create")} - - -
+
+
+
+ {t("model")}
- -
- - +
+ + + {t("create")} +
+ +
+ + + +
) diff --git a/react-admin/src/pages/role/RoleCreate.tsx b/react-admin/src/pages/role/RoleCreate.tsx index e7235347..c088258b 100644 --- a/react-admin/src/pages/role/RoleCreate.tsx +++ b/react-admin/src/pages/role/RoleCreate.tsx @@ -96,8 +96,7 @@ function RoleCreate() { } return ( -
-
+

@@ -225,7 +224,6 @@ function RoleCreate() {

-
); } diff --git a/react-admin/src/pages/role/RoleEdit.tsx b/react-admin/src/pages/role/RoleEdit.tsx index c92e97b2..8b48e31c 100644 --- a/react-admin/src/pages/role/RoleEdit.tsx +++ b/react-admin/src/pages/role/RoleEdit.tsx @@ -126,8 +126,7 @@ function RoleEdit() { }) return ( -
-
+

@@ -281,7 +280,6 @@ function RoleEdit() {

-
); } diff --git a/react-admin/src/pages/role/RoleTable.tsx b/react-admin/src/pages/role/RoleTable.tsx index 6bc39614..1e15960e 100644 --- a/react-admin/src/pages/role/RoleTable.tsx +++ b/react-admin/src/pages/role/RoleTable.tsx @@ -103,8 +103,7 @@ export default function RoleTable() { }) return ( -
-
+
{t("roles")} @@ -127,6 +126,5 @@ export default function RoleTable() {
-
); } diff --git a/react-admin/src/pages/setting/SettingPage.tsx b/react-admin/src/pages/setting/SettingPage.tsx index 9b9b1c89..6fe41096 100644 --- a/react-admin/src/pages/setting/SettingPage.tsx +++ b/react-admin/src/pages/setting/SettingPage.tsx @@ -1,34 +1,34 @@ import InputField from "../../components/InputField"; -import { useSetting } from "./hooks/useSetting" +import {useSetting} from "./hooks/useSetting" import _ from 'lodash' -import { useStoreSetting } from "./hooks/useStoreSetting"; -import { useTranslation } from "react-i18next"; +import {useStoreSetting} from "./hooks/useStoreSetting"; +import {useTranslation} from "react-i18next"; import SettingType from "../../types/settings/SettingType"; -import { SettingSaveSchema } from "./schemas/setting.save.schema"; -import { joiResolver } from "@hookform/resolvers/joi"; -import { useForm } from "react-hook-form"; +import {SettingSaveSchema} from "./schemas/setting.save.schema"; +import {joiResolver} from "@hookform/resolvers/joi"; +import {useForm} from "react-hook-form"; import SaveSettingType from "../../types/settings/SaveSettingType"; import AvoRedButton, {ButtonType} from "../../components/AvoRedButton"; import {randomString} from "../../lib/common"; function SettingPage() { const setting_api_all_response = useSetting() - const { mutate } = useStoreSetting() + const {mutate} = useStoreSetting() const [t] = useTranslation("global") - const existing_settings : Array = _.get(setting_api_all_response, 'data.data', []) + const existing_settings: Array = _.get(setting_api_all_response, 'data.data', []) const values: SaveSettingType = {'settings': existing_settings} const { register, handleSubmit, setValue, - formState: { errors } + formState: {errors} } = useForm({ - resolver: joiResolver(SettingSaveSchema, { allowUnknown: true }), + resolver: joiResolver(SettingSaveSchema, {allowUnknown: true}), values }); - const getIdentifierIndex = ((identifier: string) : number => { + const getIdentifierIndex = ((identifier: string): number => { return existing_settings.findIndex((setting) => setting.identifier === identifier); }) const submitHandler = ((data: SaveSettingType) => { @@ -42,76 +42,74 @@ function SettingPage() { }) return ( -
-
-
-
-
- {t("settings")} -
+ <> +
+
+
+ {t("settings")}
+
-
-
-
    -
  • +
    +
      +
    • - {t("general")} -
    • -
    -
    + > + {t("general")} +
  • +
+
-
-
-
-
+
+ +
+
+ +
+ +
+ +
- -
- -
- -
-
- -
- - -
+
+
-
-
- -
+
+ +
+ + +
+
-
+ ); }