From cd80e811bc6b87a696a566a7b9dfe4486881d414 Mon Sep 17 00:00:00 2001 From: Maxime Bouveron Date: Mon, 13 Nov 2023 18:08:11 +0100 Subject: [PATCH] Layout improvements --- public/locales/en/translation.json | 2 + public/locales/fr/translation.json | 2 + .../RA/DataLayer/components/DataLayerForm.js | 4 +- .../DataLayer/components/DescriptionInput.js | 37 +++++++++++++++++++ .../components/tabs/DefinitionTab.js | 20 +++++----- .../tabs/StyleTab/Style/CategorizeValue.js | 2 +- .../components/tabs/StyleTab/index.js | 2 +- .../tabs/TableTab/TableConfigField.js | 2 +- src/views/Main/styles.scss | 9 +++++ 9 files changed, 66 insertions(+), 14 deletions(-) create mode 100644 src/modules/RA/DataLayer/components/DescriptionInput.js diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 3c63c105..30bf3d1b 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -418,6 +418,8 @@ "ordering": "Ordering", "description": "Description", "show-description": "Display description in layers tree", + "description-rich": "Rich text", + "description-html": "HTML", "interactions": "Interactions", "all-data-available": " All available data", "error-required": "This field is required", diff --git a/public/locales/fr/translation.json b/public/locales/fr/translation.json index 841d7c44..a44f9273 100644 --- a/public/locales/fr/translation.json +++ b/public/locales/fr/translation.json @@ -470,6 +470,8 @@ "ordering": "Classement", "description": "Description", "show-description": "Afficher la description dans l'arbre des couches", + "description-rich": "Texte riche", + "description-html": "HTML", "interactions": "Interactions", "all-data-available": " Toutes les données disponibles", "error-required": "Ce champ est requis", diff --git a/src/modules/RA/DataLayer/components/DataLayerForm.js b/src/modules/RA/DataLayer/components/DataLayerForm.js index a91584ce..6de0cb9e 100644 --- a/src/modules/RA/DataLayer/components/DataLayerForm.js +++ b/src/modules/RA/DataLayer/components/DataLayerForm.js @@ -1,6 +1,6 @@ import React from 'react'; -import { TabbedForm, FormTab, ArrayInput, SimpleFormIterator } from 'react-admin'; +import { TabbedForm, FormTab, ArrayInput, SimpleFormIterator, TabbedFormTabs } from 'react-admin'; import JSONInput from '../../../../components/react-admin/JSONInput'; import CustomFormTab from '../../../../components/react-admin/CustomFormTab'; @@ -131,7 +131,7 @@ const DataLayerForm = React.memo(props => { }, []); return ( - + } sanitizeEmptyValues={false} {...props} initialValues={{ fields: [] }}> { + const [currentTab, setCurrentTab] = useState(0); + const translate = useTranslate(); + + return ( + <> + + setCurrentTab(newVal)} + style={{ + root: { + textTransform: 'none', + }, + }} + indicatorColor="primary" + textColor="primary" + > + + + +
+ {currentTab === 0 && } + {currentTab === 1 && ( + + )} +
+ + ); +}; + +export default DescriptionInput; diff --git a/src/modules/RA/DataLayer/components/tabs/DefinitionTab.js b/src/modules/RA/DataLayer/components/tabs/DefinitionTab.js index 4c905273..ef6a79fb 100644 --- a/src/modules/RA/DataLayer/components/tabs/DefinitionTab.js +++ b/src/modules/RA/DataLayer/components/tabs/DefinitionTab.js @@ -21,6 +21,7 @@ import { RES_DATASOURCE } from '../../../ra-modules'; import { WMTS } from '../../../DataSource'; import useSourceData from '../useSourceData'; import SourceFilterField from '../SourceFilterField'; +import DescriptionInput from '../DescriptionInput'; const Br = () =>
; @@ -31,15 +32,21 @@ const DefinitionTab = ({ onSwitch, external }) => { const dataProvider = useDataProvider(); const form = useForm(); - const { input: { value: sourceId } } = useField('source'); - const { input: { value: fields } } = useField('fields'); + const { + input: { value: sourceId }, + } = useField('source'); + const { + input: { value: fields }, + } = useField('fields'); const { _type: type } = useSourceData('source'); React.useEffect(() => onSwitch(type === WMTS), [onSwitch, type]); React.useEffect(() => { - if (external) { return; } + if (external) { + return; + } updateFieldFromSource(fields, form, dataProvider, sourceId); }, [dataProvider, external, fields, form, sourceId]); @@ -90,12 +97,7 @@ const DefinitionTab = ({ onSwitch, external }) => { label="resources.datalayer.fields.active_by_default_pastpart" /> - + { /> )} - + {category.name || translate('style-editor.categorize.empty-category')} diff --git a/src/modules/RA/DataLayer/components/tabs/StyleTab/index.js b/src/modules/RA/DataLayer/components/tabs/StyleTab/index.js index dd9c1f64..a29c38ab 100644 --- a/src/modules/RA/DataLayer/components/tabs/StyleTab/index.js +++ b/src/modules/RA/DataLayer/components/tabs/StyleTab/index.js @@ -56,7 +56,7 @@ const StyleTab = ({ external, ...rest }) => { return ( <> {/* Protect div element */} -
+
diff --git a/src/modules/RA/DataLayer/components/tabs/TableTab/TableConfigField.js b/src/modules/RA/DataLayer/components/tabs/TableTab/TableConfigField.js index db152bb7..5c69d120 100644 --- a/src/modules/RA/DataLayer/components/tabs/TableTab/TableConfigField.js +++ b/src/modules/RA/DataLayer/components/tabs/TableTab/TableConfigField.js @@ -80,7 +80,7 @@ const FieldRow = ({ field, onChange, exportEnabled }) => { - + {field.name} diff --git a/src/views/Main/styles.scss b/src/views/Main/styles.scss index 6509a069..27b22ab3 100644 --- a/src/views/Main/styles.scss +++ b/src/views/Main/styles.scss @@ -5,6 +5,7 @@ flex: 1 0 auto; &-content { + max-width: calc(100vw - 15px); min-height: 100%; display: flex; flex-direction: column; @@ -37,3 +38,11 @@ text-align: center; } } + +.layout { + min-width: unset !important; +} + +#main-content { + width: 100%; +}