chore(react/collections/geomap): bring back dark theme labels

This commit is contained in:
Elian Doran 2025-09-04 21:39:50 +03:00
parent 50121153dd
commit dd2b718974
No known key found for this signature in database
2 changed files with 10 additions and 20 deletions

View File

@ -84,9 +84,14 @@ export default function Map({ coordinates, zoom, layerName, viewportChanged, chi
useEffect(() => { mapRef.current && mapRef.current.on("click", onClick) }, [ mapRef, onClick ]); useEffect(() => { mapRef.current && mapRef.current.on("click", onClick) }, [ mapRef, onClick ]);
return <div ref={containerRef} className="geo-map-container"> return (
<ParentMap.Provider value={mapRef.current}> <div
{children} ref={containerRef}
</ParentMap.Provider> className={`geo-map-container ${MAP_LAYERS[layerName].isDarkTheme ? "dark" : ""}`}
</div>; >
<ParentMap.Provider value={mapRef.current}>
{children}
</ParentMap.Provider>
</div>
);
} }

View File

@ -39,26 +39,12 @@ export default class GeoView extends ViewMode<MapData> {
args.$parent.append(this.$root); args.$parent.append(this.$root);
} }
async renderList() {
this.renderMap();
return this.$root;
}
async renderMap() { async renderMap() {
const layerName = this.parentNote.getLabelValue("map:style") ?? ; const layerName = this.parentNote.getLabelValue("map:style") ?? ;
if (this.parentNote.hasLabel("map:scale")) { if (this.parentNote.hasLabel("map:scale")) {
L.control.scale().addTo(map); L.control.scale().addTo(map);
} }
this.$container.toggleClass("dark", !!layerData.isDarkTheme);
layer.addTo(map);
this.map = map;
this.#onMapInitialized();
} }
async #onMapInitialized() { async #onMapInitialized() {
@ -68,7 +54,6 @@ export default class GeoView extends ViewMode<MapData> {
} }
const isEditable = !this.isReadOnly; const isEditable = !this.isReadOnly;
map.on("click", (e) => this.#onMapClicked(e))
map.on("contextmenu", (e) => openMapContextMenu(this.parentNote.noteId, e, isEditable)); map.on("contextmenu", (e) => openMapContextMenu(this.parentNote.noteId, e, isEditable));
if (isEditable) { if (isEditable) {