Skip to content

Build your personal knowledge base with Trilium Notes

feat(book_properties): group dark map styles

Elian Doran0dffa0f3335c
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index a72173a2a6..073ca2803a 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -1969,7 +1969,8 @@
"map-style": "Map style:",
"max-nesting-depth": "Max nesting depth:",
"raster": "Raster",
- "vector": "Vector"
+ "vector_light": "Vector (Light)",
+ "vector_dark": "Vector (Dark)"
},
"table_context_menu": {
"delete_row": "Delete row"
diff --git a/apps/client/src/widgets/ribbon_widgets/book_properties_config.ts b/apps/client/src/widgets/ribbon_widgets/book_properties_config.ts
index 3a3635be51..de5bc6fda2 100644
--- a/apps/client/src/widgets/ribbon_widgets/book_properties_config.ts
+++ b/apps/client/src/widgets/ribbon_widgets/book_properties_config.ts
@@ -3,7 +3,7 @@ import FNote from "../../entities/fnote";
import attributes from "../../services/attributes";
import { ViewTypeOptions } from "../../services/note_list_renderer"
import NoteContextAwareWidget from "../note_context_aware_widget";
-import { DEFAULT_MAP_LAYER_NAME, MAP_LAYERS } from "../view_widgets/geo_view/map_layer";
+import { DEFAULT_MAP_LAYER_NAME, MAP_LAYERS, type MapLayer } from "../view_widgets/geo_view/map_layer";
interface BookConfig {
properties: BookProperty[];
@@ -123,19 +123,19 @@ export const bookPropertiesConfig: Record<ViewTypeOptions, BookConfig> = {
name: t("book_properties_config.raster"),
items: Object.entries(MAP_LAYERS)
.filter(([_, layer]) => layer.type === "raster")
- .map(([id, layer]) => ({
- value: id,
- label: layer.name
- }))
+ .map(buildMapLayer)
},
{
- name: t("book_properties_config.vector"),
+ name: t("book_properties_config.vector_light"),
items: Object.entries(MAP_LAYERS)
- .filter(([_, layer]) => layer.type === "vector")
- .map(([id, layer]) => ({
- value: id,
- label: layer.name
- }))
+ .filter(([_, layer]) => layer.type === "vector" && !layer.isDarkTheme)
+ .map(buildMapLayer)
+ },
+ {
+ name: t("book_properties_config.vector_dark"),
+ items: Object.entries(MAP_LAYERS)
+ .filter(([_, layer]) => layer.type === "vector" && layer.isDarkTheme)
+ .map(buildMapLayer)
}
]
}
@@ -155,3 +155,10 @@ export const bookPropertiesConfig: Record<ViewTypeOptions, BookConfig> = {
properties: []
}
};
+
+function buildMapLayer([ id, layer ]: [ string, MapLayer ]): ComboBoxItem {
+ return {
+ value: id,
+ label: layer.name
+ };
+}
diff --git a/apps/client/src/widgets/view_widgets/geo_view/map_layer.ts b/apps/client/src/widgets/view_widgets/geo_view/map_layer.ts
index c99d7d74b4..7b12a10761 100644
--- a/apps/client/src/widgets/view_widgets/geo_view/map_layer.ts
+++ b/apps/client/src/widgets/view_widgets/geo_view/map_layer.ts
@@ -1,14 +1,14 @@
-interface Layer {
+export interface MapLayer {
name: string;
isDarkTheme?: boolean;
}
-interface VectorLayer extends Layer {
+interface VectorLayer extends MapLayer {
type: "vector";
style: string | (() => Promise<{}>)
}
-interface RasterLayer extends Layer {
+interface RasterLayer extends MapLayer {
type: "raster";
url: string;
attribution: string;