mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 07:08:55 +02:00
feat(book_properties): group dark map styles
This commit is contained in:
parent
d17f5b8447
commit
0dffa0f333
@ -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"
|
||||
|
@ -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
|
||||
};
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user