From 1875982a1575b77eed2f96fe2a479b4c7f7e8a6b Mon Sep 17 00:00:00 2001 From: Sebastien Arod Date: Mon, 10 Jun 2024 17:31:14 +0200 Subject: [PATCH] Revert "feat: Lazy load ResistantMap to allow code splitting" This reverts commit 2391ad98b0c6255f3447f9e214e50e2bc8e7cb37. --- src/routes/Liste/Map/ResistantsMap.tsx | 6 +++--- src/routes/Liste/index.tsx | 30 ++++++++------------------ 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/routes/Liste/Map/ResistantsMap.tsx b/src/routes/Liste/Map/ResistantsMap.tsx index 2199c97..83106f2 100644 --- a/src/routes/Liste/Map/ResistantsMap.tsx +++ b/src/routes/Liste/Map/ResistantsMap.tsx @@ -1,7 +1,7 @@ -import maplibregl from "maplibre-gl"; -import "maplibre-gl/dist/maplibre-gl.css"; import React from "react"; import Map, { Marker, NavigationControl, Popup } from "react-map-gl"; +import maplibregl from "maplibre-gl"; +import "maplibre-gl/dist/maplibre-gl.css"; import { Resistant } from "../../../Resistant"; import { Picto } from "./Picto"; import { PopupContent } from "./PopupContent"; @@ -12,7 +12,7 @@ interface Props { const accessToken = "LiH20XNxcFiTXyT4fgjM"; -export default ({ resistants }: Props) => { +export const ResistantsMap = ({ resistants }: Props) => { const [selectedResistant, selectResistant] = React.useState( null ); diff --git a/src/routes/Liste/index.tsx b/src/routes/Liste/index.tsx index f1ff9d2..6e665ea 100644 --- a/src/routes/Liste/index.tsx +++ b/src/routes/Liste/index.tsx @@ -1,28 +1,23 @@ -import { - Center, - Group, - Loader, - SegmentedControl, - TextInput, -} from "@mantine/core"; +import React from "react"; +import { Outlet } from "react-router"; +import { Center, Group, SegmentedControl, TextInput } from "@mantine/core"; import { IconCameraSelfie, IconList, IconMap, IconUsers, } from "@tabler/icons-react"; -import React, { Suspense, lazy } from "react"; -import { Outlet } from "react-router"; -import { resistantsOrder } from "../../Resistant"; import { Separator } from "../../components/Separator"; import { DisplayModeContext } from "../../context/DisplayModeContext"; -import { HomeContext } from "../../context/HomeContext"; import { resistants } from "../../resistants"; import { ViewMode } from "../ViewMode"; import { FiltreAcademie } from "./FiltreAcademie"; +import { ResistantsMap } from "./Map/ResistantsMap"; +import { ResistantsThumbs } from "./Thumbs/ResistantsThumbs"; import { FiltreDepartement } from "./FiltreDepartement"; import { ResistantRow } from "./List/ResistantRow"; -import { ResistantsThumbs } from "./Thumbs/ResistantsThumbs"; +import { HomeContext } from "../../context/HomeContext"; +import { resistantsOrder } from "../../Resistant"; const normalize = (text: string) => (text || "") @@ -30,8 +25,6 @@ const normalize = (text: string) => .normalize("NFD") .replace(/\p{Diacritic}/gu, ""); -const LazyResistantsMap = lazy(() => import("./Map/ResistantsMap")); - export const ListeResistants = () => { const { mode, setMode } = React.useContext(DisplayModeContext); const { isHome } = React.useContext(HomeContext); @@ -125,13 +118,8 @@ export const ListeResistants = () => { )} - {mode === "map" && ( - } - > - - - )} + {mode === "map" && } +