@treely/strapi-slices 8.2.5 → 8.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs
CHANGED
|
@@ -4941,7 +4941,6 @@ var ProjectsMap = ({
|
|
|
4941
4941
|
const map = (0, import_react34.useRef)(null);
|
|
4942
4942
|
const animationIntervalRef = (0, import_react34.useRef)(null);
|
|
4943
4943
|
const [featureCollection, setFeatureCollection] = (0, import_react34.useState)(null);
|
|
4944
|
-
const [isLoading, setIsLoading] = (0, import_react34.useState)(false);
|
|
4945
4944
|
const initialBboxRef = (0, import_react34.useRef)(null);
|
|
4946
4945
|
const [isMapReady, setIsMapReady] = (0, import_react34.useState)(false);
|
|
4947
4946
|
const [strapiProjects, setStrapiProjects] = (0, import_react34.useState)(null);
|
|
@@ -4964,15 +4963,12 @@ var ProjectsMap = ({
|
|
|
4964
4963
|
}, [locale, strapiProjects]);
|
|
4965
4964
|
const fetchProjectsData = (0, import_react34.useCallback)(
|
|
4966
4965
|
async (bbox) => {
|
|
4967
|
-
setIsLoading(true);
|
|
4968
4966
|
try {
|
|
4969
4967
|
const fpmData = await getFpmProjectsByBbox_default(bbox);
|
|
4970
4968
|
const mergedData = strapiProjects ? mergeProjectData_default(fpmData, strapiProjects) : fpmData;
|
|
4971
4969
|
setFeatureCollection(mergedData);
|
|
4972
4970
|
} catch (error) {
|
|
4973
4971
|
console.error("Error fetching projects:", error);
|
|
4974
|
-
} finally {
|
|
4975
|
-
setIsLoading(false);
|
|
4976
4972
|
}
|
|
4977
4973
|
},
|
|
4978
4974
|
[strapiProjects]
|
|
@@ -5254,19 +5250,17 @@ var ProjectsMap = ({
|
|
|
5254
5250
|
center: initialCenter,
|
|
5255
5251
|
zoom: initialZoom,
|
|
5256
5252
|
maxZoom: MAPBOX_MAX_ZOOM,
|
|
5257
|
-
minZoom: slice.minZoomLevel
|
|
5253
|
+
minZoom: slice.minZoomLevel,
|
|
5254
|
+
cooperativeGestures: true
|
|
5258
5255
|
});
|
|
5259
5256
|
map.current.addControl(new import_mapbox_gl.default.NavigationControl(), "top-right");
|
|
5260
5257
|
map.current.on("load", () => {
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
map.current.on("moveend", () => {
|
|
5264
|
-
if (initialBboxRef.current) {
|
|
5265
|
-
debouncedUpdateBbox();
|
|
5258
|
+
if (map.current?.getLayer("road-number-shield")) {
|
|
5259
|
+
map.current?.setLayoutProperty("road-number-shield", "visibility", "none");
|
|
5266
5260
|
}
|
|
5261
|
+
setIsMapReady(true);
|
|
5267
5262
|
});
|
|
5268
5263
|
return () => {
|
|
5269
|
-
debouncedUpdateBbox.cancel();
|
|
5270
5264
|
if (animationIntervalRef.current) {
|
|
5271
5265
|
clearInterval(animationIntervalRef.current);
|
|
5272
5266
|
}
|
|
@@ -5276,9 +5270,17 @@ var ProjectsMap = ({
|
|
|
5276
5270
|
}, [
|
|
5277
5271
|
slice.defaultCenterCoordinates,
|
|
5278
5272
|
slice.defaultZoomLevel,
|
|
5279
|
-
slice.minZoomLevel
|
|
5280
|
-
debouncedUpdateBbox
|
|
5273
|
+
slice.minZoomLevel
|
|
5281
5274
|
]);
|
|
5275
|
+
(0, import_react34.useEffect)(() => {
|
|
5276
|
+
if (!map.current || !isMapReady) return;
|
|
5277
|
+
const currentMap = map.current;
|
|
5278
|
+
currentMap.on("moveend", debouncedUpdateBbox);
|
|
5279
|
+
return () => {
|
|
5280
|
+
debouncedUpdateBbox.cancel();
|
|
5281
|
+
currentMap.off("moveend", debouncedUpdateBbox);
|
|
5282
|
+
};
|
|
5283
|
+
}, [isMapReady, debouncedUpdateBbox]);
|
|
5282
5284
|
(0, import_react34.useEffect)(() => {
|
|
5283
5285
|
fetchStrapiData();
|
|
5284
5286
|
}, [fetchStrapiData]);
|
|
@@ -5381,8 +5383,7 @@ var ProjectsMap = ({
|
|
|
5381
5383
|
overflow: "hidden",
|
|
5382
5384
|
boxShadow: ["md", null, null, "none"]
|
|
5383
5385
|
}
|
|
5384
|
-
)
|
|
5385
|
-
isLoading && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_boemly34.Box, { children: "Loading projects..." })
|
|
5386
|
+
)
|
|
5386
5387
|
] })
|
|
5387
5388
|
] });
|
|
5388
5389
|
};
|
|
@@ -8947,7 +8948,7 @@ var Redirect = ({ slice }) => {
|
|
|
8947
8948
|
router.asPath,
|
|
8948
8949
|
router.query
|
|
8949
8950
|
);
|
|
8950
|
-
|
|
8951
|
+
window.location.replace(redirectUrl);
|
|
8951
8952
|
}, [slice.url, router]);
|
|
8952
8953
|
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_jsx_runtime61.Fragment, {});
|
|
8953
8954
|
};
|