Revert "feat: Lazy load ResistantMap to allow code splitting"
This reverts commit 2391ad98b0
.
suppression-manon-adrien
parent
2391ad98b0
commit
1875982a15
|
@ -1,7 +1,7 @@
|
||||||
import maplibregl from "maplibre-gl";
|
|
||||||
import "maplibre-gl/dist/maplibre-gl.css";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import Map, { Marker, NavigationControl, Popup } from "react-map-gl";
|
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 { Resistant } from "../../../Resistant";
|
||||||
import { Picto } from "./Picto";
|
import { Picto } from "./Picto";
|
||||||
import { PopupContent } from "./PopupContent";
|
import { PopupContent } from "./PopupContent";
|
||||||
|
@ -12,7 +12,7 @@ interface Props {
|
||||||
|
|
||||||
const accessToken = "LiH20XNxcFiTXyT4fgjM";
|
const accessToken = "LiH20XNxcFiTXyT4fgjM";
|
||||||
|
|
||||||
export default ({ resistants }: Props) => {
|
export const ResistantsMap = ({ resistants }: Props) => {
|
||||||
const [selectedResistant, selectResistant] = React.useState<Resistant | null>(
|
const [selectedResistant, selectResistant] = React.useState<Resistant | null>(
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,28 +1,23 @@
|
||||||
import {
|
import React from "react";
|
||||||
Center,
|
import { Outlet } from "react-router";
|
||||||
Group,
|
import { Center, Group, SegmentedControl, TextInput } from "@mantine/core";
|
||||||
Loader,
|
|
||||||
SegmentedControl,
|
|
||||||
TextInput,
|
|
||||||
} from "@mantine/core";
|
|
||||||
import {
|
import {
|
||||||
IconCameraSelfie,
|
IconCameraSelfie,
|
||||||
IconList,
|
IconList,
|
||||||
IconMap,
|
IconMap,
|
||||||
IconUsers,
|
IconUsers,
|
||||||
} from "@tabler/icons-react";
|
} 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 { Separator } from "../../components/Separator";
|
||||||
import { DisplayModeContext } from "../../context/DisplayModeContext";
|
import { DisplayModeContext } from "../../context/DisplayModeContext";
|
||||||
import { HomeContext } from "../../context/HomeContext";
|
|
||||||
import { resistants } from "../../resistants";
|
import { resistants } from "../../resistants";
|
||||||
import { ViewMode } from "../ViewMode";
|
import { ViewMode } from "../ViewMode";
|
||||||
import { FiltreAcademie } from "./FiltreAcademie";
|
import { FiltreAcademie } from "./FiltreAcademie";
|
||||||
|
import { ResistantsMap } from "./Map/ResistantsMap";
|
||||||
|
import { ResistantsThumbs } from "./Thumbs/ResistantsThumbs";
|
||||||
import { FiltreDepartement } from "./FiltreDepartement";
|
import { FiltreDepartement } from "./FiltreDepartement";
|
||||||
import { ResistantRow } from "./List/ResistantRow";
|
import { ResistantRow } from "./List/ResistantRow";
|
||||||
import { ResistantsThumbs } from "./Thumbs/ResistantsThumbs";
|
import { HomeContext } from "../../context/HomeContext";
|
||||||
|
import { resistantsOrder } from "../../Resistant";
|
||||||
|
|
||||||
const normalize = (text: string) =>
|
const normalize = (text: string) =>
|
||||||
(text || "")
|
(text || "")
|
||||||
|
@ -30,8 +25,6 @@ const normalize = (text: string) =>
|
||||||
.normalize("NFD")
|
.normalize("NFD")
|
||||||
.replace(/\p{Diacritic}/gu, "");
|
.replace(/\p{Diacritic}/gu, "");
|
||||||
|
|
||||||
const LazyResistantsMap = lazy(() => import("./Map/ResistantsMap"));
|
|
||||||
|
|
||||||
export const ListeResistants = () => {
|
export const ListeResistants = () => {
|
||||||
const { mode, setMode } = React.useContext(DisplayModeContext);
|
const { mode, setMode } = React.useContext(DisplayModeContext);
|
||||||
const { isHome } = React.useContext(HomeContext);
|
const { isHome } = React.useContext(HomeContext);
|
||||||
|
@ -125,13 +118,8 @@ export const ListeResistants = () => {
|
||||||
<ResistantsThumbs resistants={filteredResistants} />
|
<ResistantsThumbs resistants={filteredResistants} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{mode === "map" && (
|
{mode === "map" && <ResistantsMap resistants={filteredResistants} />}
|
||||||
<Suspense
|
|
||||||
fallback={<Loader style={{ display: "block", margin: "auto" }} />}
|
|
||||||
>
|
|
||||||
<LazyResistantsMap resistants={filteredResistants} />
|
|
||||||
</Suspense>
|
|
||||||
)}
|
|
||||||
<Outlet />
|
<Outlet />
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
Loading…
Reference in New Issue