diff --git a/apps/client/src/widgets/collections/geomap/index.tsx b/apps/client/src/widgets/collections/geomap/index.tsx
index c116ebd7a..0a490b1f3 100644
--- a/apps/client/src/widgets/collections/geomap/index.tsx
+++ b/apps/client/src/widgets/collections/geomap/index.tsx
@@ -1,15 +1,21 @@
import Map from "./map";
import "./index.css";
+import { ViewModeProps } from "../interface";
+import { useNoteLabel } from "../../react/hooks";
+import { DEFAULT_MAP_LAYER_NAME } from "./map_layer";
const DEFAULT_COORDINATES: [number, number] = [3.878638227135724, 446.6630455551659];
const DEFAULT_ZOOM = 2;
-export default function GeoView() {
+export default function GeoView({ note }: ViewModeProps) {
+ const [ layerName ] = useNoteLabel(note, "map:style");
+
return (
);
diff --git a/apps/client/src/widgets/collections/geomap/map.tsx b/apps/client/src/widgets/collections/geomap/map.tsx
index 8a3dd97b1..4452be824 100644
--- a/apps/client/src/widgets/collections/geomap/map.tsx
+++ b/apps/client/src/widgets/collections/geomap/map.tsx
@@ -1,19 +1,17 @@
import { useEffect, useRef, useState } from "preact/hooks";
import L, { LatLng, Layer } from "leaflet";
import "leaflet/dist/leaflet.css";
-import { useNoteContext, useNoteLabel } from "../../react/hooks";
-import { DEFAULT_MAP_LAYER_NAME, MAP_LAYERS } from "./map_layer";
+import { MAP_LAYERS } from "./map_layer";
interface MapProps {
coordinates: LatLng | [number, number];
zoom: number;
+ layerName: string;
}
-export default function Map({ coordinates, zoom }: MapProps) {
+export default function Map({ coordinates, zoom, layerName }: MapProps) {
const mapRef = useRef(null);
const containerRef = useRef(null);
- const { note } = useNoteContext();
- const [ layerName ] = useNoteLabel(note, "map:style");
useEffect(() => {
if (!containerRef.current) return;
@@ -26,7 +24,7 @@ export default function Map({ coordinates, zoom }: MapProps) {
const [ layer, setLayer ] = useState();
useEffect(() => {
async function load() {
- const layerData = MAP_LAYERS[layerName ?? DEFAULT_MAP_LAYER_NAME];
+ const layerData = MAP_LAYERS[layerName];
if (layerData.type === "vector") {
const style = (typeof layerData.style === "string" ? layerData.style : await layerData.style());
@@ -62,9 +60,5 @@ export default function Map({ coordinates, zoom }: MapProps) {
mapRef.current.setView(coordinates, zoom);
}, [ mapRef, coordinates, zoom ]);
- return (
-
-
-
- );
+ return ;
}