diff --git a/assets/components/Utils/ZoomRange.tsx b/assets/components/Utils/ZoomRange.tsx index 04c73c98..423f9bfe 100644 --- a/assets/components/Utils/ZoomRange.tsx +++ b/assets/components/Utils/ZoomRange.tsx @@ -95,13 +95,11 @@ const ZoomRange: FC = (props) => { useEffect(() => { if (leftMapTargetRef.current) { - const minValue = olDefaults.zoom_levels.TOP < min ? min : olDefaults.zoom_levels.TOP; - leftMapRef.current = createMap(leftMapTargetRef.current, minValue); + leftMapRef.current = createMap(leftMapTargetRef.current, Math.max(min, olDefaults.zoom_levels.TOP)); } if (rightMapTargetRef.current) { - const maxValue = olDefaults.zoom_levels.BOTTOM > max ? max : olDefaults.zoom_levels.BOTTOM; - rightMapRef.current = createMap(rightMapTargetRef.current, maxValue); + rightMapRef.current = createMap(rightMapTargetRef.current, Math.min(max, olDefaults.zoom_levels.BOTTOM)); } return () => { @@ -142,7 +140,7 @@ const ZoomRange: FC = (props) => { { value: values[0], onChange: (e) => { - const v = values; + const v = [...values]; v[0] = Number(e.currentTarget.value); onChange(v); }, @@ -150,7 +148,7 @@ const ZoomRange: FC = (props) => { { value: values[1], onChange: (e) => { - const v = values; + const v = [...values]; v[1] = Number(e.currentTarget.value); onChange(v); }, diff --git a/assets/espaceco/pages/communities/ManageCommunity.tsx b/assets/espaceco/pages/communities/ManageCommunity.tsx index 1090c4b2..f5755b2d 100644 --- a/assets/espaceco/pages/communities/ManageCommunity.tsx +++ b/assets/espaceco/pages/communities/ManageCommunity.tsx @@ -16,6 +16,7 @@ import api from "../../api"; import Description from "./management/Description"; import Grid from "./management/Grid"; import ZoomAndCentering from "./management/ZoomAndCentering"; +import Layer from "./management/Layer"; type ManageCommunityProps = { communityId: number; @@ -57,13 +58,13 @@ const ManageCommunity: FC = ({ communityId }) => { @@ -74,6 +75,8 @@ const ManageCommunity: FC = ({ communityId }) => { return ; case "tab3": return ; + case "tab4": + return ; case "tab7": return ; // TODO default: diff --git a/assets/espaceco/pages/communities/ManageCommunityTr.tsx b/assets/espaceco/pages/communities/ManageCommunityTr.tsx index deff3b21..ed597ee1 100644 --- a/assets/espaceco/pages/communities/ManageCommunityTr.tsx +++ b/assets/espaceco/pages/communities/ManageCommunityTr.tsx @@ -16,6 +16,7 @@ export const { i18n } = declareComponentKeys< | "tab5" | "tab6" | "tab7" + | "desc.tab.title" | "desc.name" | "desc.hint_name" | "desc.description" @@ -35,6 +36,7 @@ export const { i18n } = declareComponentKeys< | "modal.document.name" | "modal.document.file_hint" | "zoom.consistant_error" + | "zoom.tab.title" | "zoom.position" | "zoom.position_hint" | "zoom.zoom_range" @@ -49,6 +51,10 @@ export const { i18n } = declareComponentKeys< | "zoom.xmax" | "zoom.ymin" | "zoom.ymax" + | "layer.tab.title" + | "layer.tabl" + | "layer.tab2" + | "layer.tab3" | "grid.grids" | { K: "grid.explain"; R: JSX.Element } >()("ManageCommunity"); @@ -65,6 +71,7 @@ export const ManageCommunityFrTranslations: Translations<"fr">["ManageCommunity" tab5: "Outils", tab6: "Signalements", tab7: "Emprises", + "desc.tab.title": "Décrire le guichet", "desc.name": "Nom du guichet", "desc.hint_name": "Donnez un nom clair et compréhensible", "desc.description": "Description", @@ -94,6 +101,7 @@ export const ManageCommunityFrTranslations: Translations<"fr">["ManageCommunity" "modal.document.name": "Titre", "modal.document.file_hint": "Taille maximale : 5 Mo.", "zoom.consistant_error": "Emprise et position ne sont pas cohérents", + "zoom.tab.title": "Définir l’état initial de la carte à l’ouverture du guichet", "zoom.position": "Position", "zoom.position_hint": "Fixer la position et définissez le niveau de zoom (utilisez votre souris ou la barre de recherche ci-dessous", "zoom.zoom_range": "Gérer les niveaux de zoom minimum et maximum permis (optionnel)", @@ -110,6 +118,10 @@ export const ManageCommunityFrTranslations: Translations<"fr">["ManageCommunity" "zoom.xmax": "X max", "zoom.ymin": "Y min", "zoom.ymax": "Y max", + "layer.tab.title": "Gérer les couches de la carte", + "layer.tabl": "Mes données", + "layer.tab2": "Données de la géoplateforme", + "layer.tab3": "Fonds de carte", "grid.grids": "Emprises du guichet (optionnel)", "grid.explain": (

@@ -132,6 +144,7 @@ export const ManageCommunityEnTranslations: Translations<"en">["ManageCommunity" tab5: undefined, tab6: undefined, tab7: undefined, + "desc.tab.title": undefined, "desc.name": undefined, "desc.hint_name": undefined, "desc.description": undefined, @@ -160,6 +173,7 @@ export const ManageCommunityEnTranslations: Translations<"en">["ManageCommunity" "modal.document.name": "Title", "modal.document.file_hint": "Maximum file size : 5 Mo.", "zoom.consistant_error": undefined, + "zoom.tab.title": undefined, "zoom.position": "Position", "zoom.position_hint": undefined, "zoom.zoom_range": undefined, @@ -174,6 +188,10 @@ export const ManageCommunityEnTranslations: Translations<"en">["ManageCommunity" "zoom.xmax": "X max", "zoom.ymin": "Y min", "zoom.ymax": "Y max", + "layer.tab.title": undefined, + "layer.tabl": "My datas", + "layer.tab2": "Geoplateforme datas", + "layer.tab3": "Base maps", "grid.grids": undefined, "grid.explain": undefined, }; diff --git a/assets/espaceco/pages/communities/management/Description.tsx b/assets/espaceco/pages/communities/management/Description.tsx index e8838485..3c58fdbe 100644 --- a/assets/espaceco/pages/communities/management/Description.tsx +++ b/assets/espaceco/pages/communities/management/Description.tsx @@ -95,7 +95,7 @@ const Description: FC = ({ community }) => { return ( <> -

{t("tab1")}

+

{t("desc.tab.title")}

{tCommon("mandatory_fields")}

= ({ grids }) => { const { t } = useTranslation("ManageCommunity"); return ( <> -

{t("tab7")}

{t("grid.grids")}

{t("grid.explain")} { + const { t } = useTranslation("ManageCommunity"); + const { data: capabilities } = useCapabilities(); + + /* const cbBaseMapsOptions = useMemo(() => { + if (!capabilities) return []; + + + Array.from(baseMaps, (m) =>
); + }, [capabilities]); */ + + const cbBaseMapsOptions = useMemo(() => { + if (!capabilities) return []; + + const options: Options[] = []; + baseMaps.forEach((m) => { + const wmtsOptions = optionsFromCapabilities(capabilities, { layer: m, style: "Légende générique" }); + if (wmtsOptions) { + options.push(wmtsOptions); + } + }); + return options; + }, [capabilities]); + console.log(cbBaseMapsOptions); + + const [selectedTabId, setSelectedTabId] = useState("tab1"); + + return ( + <> +

{t("layer.tab.title")}

+
+
+ + <> + {(() => { + switch (selectedTabId) { + case "my_datas": + return

`Content of ${selectedTabId}`

; + case "gp_datas": + return

`Content of ${selectedTabId}`

; + case "base_maps": + return

`Content of ${selectedTabId}`

; + } + })()} + +
+
+
+
+ + ); +}; + +export default Layer; diff --git a/assets/espaceco/pages/communities/management/ZoomAndCentering.tsx b/assets/espaceco/pages/communities/management/ZoomAndCentering.tsx index b87c7da6..8b5bdb5b 100644 --- a/assets/espaceco/pages/communities/management/ZoomAndCentering.tsx +++ b/assets/espaceco/pages/communities/management/ZoomAndCentering.tsx @@ -66,6 +66,7 @@ const ZoomAndCentering: FC = ({ community }) => { {consistent === false && ( )} +

{t("zoom.tab.title")}