diff --git a/assets/components/Utils/MapWrapper.jsx b/assets/components/Utils/MapWrapper.jsx deleted file mode 100644 index e85a7f1c..00000000 --- a/assets/components/Utils/MapWrapper.jsx +++ /dev/null @@ -1,79 +0,0 @@ -import PropTypes from "prop-types"; -import React, { useEffect, useRef } from "react"; - -import Map from "ol/Map"; -import View from "ol/View"; -import WMTSCapabilities from "ol/format/WMTSCapabilities"; -import TileLayer from "ol/layer/Tile"; -import { fromLonLat } from "ol/proj"; -import WMTS, { optionsFromCapabilities } from "ol/source/WMTS"; -import olDefaults from "../../data/ol-defaults.json"; -import "./../../sass/components/zoom-range.scss"; - -const MapWrapper = (props) => { - // const [map, setMap] = useState(); // NOTE : code non-utilisé commenté temporairement pour que le GitHub Action passe - - // get ref to div element - OpenLayers will render into this div - const mapElement = useRef(); - - useEffect(() => { - const center = props.center ?? olDefaults.center; // Paris - - // create map - const initialMap = new Map({ - target: mapElement.current, - view: new View({ - projection: "EPSG:3857", - center: fromLonLat(center), - zoom: props.zoom, - }), - controls: [], - }); - // setMap(initialMap); // NOTE : code non-utilisé commenté temporairement pour que le GitHub Action passe - - // Ajout de la couche PLANIGNV2 - fetch("https://wxs.ign.fr/cartes/geoportail/wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetCapabilities") - .then((response) => { - if (!response.ok) { - throw response.statusText; - } - return response.text(); - }) - .then((response) => { - const format = new WMTSCapabilities(); - const capabilities = format.read(response); - - const wmtsOptions = optionsFromCapabilities(capabilities, { - layer: olDefaults.default_background_layer, - matrixSet: "EPSG:3857", - }); - - const layer = new TileLayer({ - opacity: 1, - source: new WMTS(wmtsOptions), - }); - initialMap.addLayer(layer); - }) - .catch((error) => { - console.log(error); - }); - - /* We set map target to undefined to represent a - * nonexistent HTML element ID, when the React component is unmounted. - * This prevents multiple maps being added to the map container on a - * re-render. - */ - return () => initialMap.setTarget(undefined); - }, [props]); - - return
; -}; - -MapWrapper.propTypes = { - id: PropTypes.string.isRequired, - className: PropTypes.string, - zoom: PropTypes.number.isRequired, - center: PropTypes.arrayOf(PropTypes.number), -}; - -export default MapWrapper; diff --git a/assets/pages/Home.jsx b/assets/pages/Home.tsx similarity index 72% rename from assets/pages/Home.jsx rename to assets/pages/Home.tsx index 28393a4b..be673b26 100644 --- a/assets/pages/Home.jsx +++ b/assets/pages/Home.tsx @@ -16,7 +16,7 @@ const Home = () => { return ( - {params.authentication_failed === 1 && ( + {params?.["authentication_failed"] === 1 && ( { )} {/* Section : Présentation */} -
+
-
-

+

+

Construisons ensemble le futur portail de la connaissance du territoire

@@ -79,43 +79,28 @@ const Home = () => {
-

Ce que vous pouvez faire avec cartes.gouv.fr

+

Ce que vous pouvez faire avec cartes.gouv.fr

-
-
- +
+
+

Consommez des services

Lorem ipsum dolor sit amet,consectetur adipiscing elit.

- + Prochainement
-
- +
+

Stocker et partager des géodonnées

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

-
- +
+

Effectuer des traitements

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

{/*

@@ -137,26 +122,16 @@ const Home = () => { )}

*/}
-
- +
+

Lorem ipsum dolor

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

-
-
- +
+
+

Consectetur adipiscing elit

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

{/*

@@ -179,37 +154,22 @@ const Home = () => {

*/}
-
- +
+

Sit amet

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

-
- +
+

Dolor sit amet consectetur

Lorem ipsum dolor sit amet,consectetur adipiscing elit.

- + Prochainement
-
- +
+

Adipiscing elits

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

diff --git a/assets/pages/users/Me.jsx b/assets/pages/users/Me.jsx deleted file mode 100644 index 59beb50f..00000000 --- a/assets/pages/users/Me.jsx +++ /dev/null @@ -1,36 +0,0 @@ -import React from "react"; - -import AppLayout from "../../components/Layout/AppLayout"; -import BtnBackToHome from "../../components/Utils/BtnBackToHome"; -import { defaultNavItems } from "../../config/navItems"; -import functions from "../../functions"; -import useUser from "../../hooks/useUser"; - -const Me = () => { - const { user } = useUser(); - - return ( - -

Mon compte

-

- Prénom : {user.firstName} -

-

- Nom : {user.lastName} -

-

- Email : {user.email} -

-

- {"Date d'inscription"} : {functions.date.format(user.accountCreationDate)} -

-

- Identifiant technique : {user.id} -

- - -
- ); -}; - -export default Me; diff --git a/assets/pages/users/Me.tsx b/assets/pages/users/Me.tsx new file mode 100644 index 00000000..c3c7cf28 --- /dev/null +++ b/assets/pages/users/Me.tsx @@ -0,0 +1,39 @@ +import AppLayout from "../../components/Layout/AppLayout"; +import BtnBackToHome from "../../components/Utils/BtnBackToHome"; +import { defaultNavItems } from "../../config/navItems"; +import functions from "../../functions"; +import useUser from "../../hooks/useUser"; + +const Me = () => { + const { user } = useUser(); + + return ( + +

Mon compte

+ + {user && ( + <> +

+ Prénom : {user.firstName} +

+

+ Nom : {user.lastName} +

+

+ Email : {user.email} +

+

+ {"Date d'inscription"} : {functions.date.format(user.accountCreationDate)} +

+

+ Identifiant technique : {user.id} +

+ + )} + + +
+ ); +}; + +export default Me; diff --git a/assets/router/RouterRenderer.jsx b/assets/router/RouterRenderer.tsx similarity index 97% rename from assets/router/RouterRenderer.jsx rename to assets/router/RouterRenderer.tsx index 14c24e6f..4ee644bf 100644 --- a/assets/router/RouterRenderer.jsx +++ b/assets/router/RouterRenderer.tsx @@ -1,10 +1,10 @@ -import SymfonyRouting from "../modules/Routing"; -import React, { Suspense, lazy } from "react"; +import { JSX, Suspense, lazy } from "react"; import AppLayout from "../components/Layout/AppLayout"; import LoadingText from "../components/Utils/LoadingText"; import { defaultNavItems } from "../config/navItems"; import useUser from "../hooks/useUser"; +import SymfonyRouting from "../modules/Routing"; import Home from "../pages/Home"; import Redirect from "../pages/Redirect"; import PageNotFound from "../pages/error/PageNotFound"; @@ -45,7 +45,7 @@ function RouterRenderer() { const { user } = useUser(); // vérification si la route demandée est bien connue/enregistrée - if (!knownRoutes.includes(route.name)) { + if (route.name === false || !knownRoutes.includes(route.name)) { return ; } @@ -58,7 +58,7 @@ function RouterRenderer() { } } - let content = null; + let content: JSX.Element; switch (route.name) { case "home":