UX: hide layers without name from search, search for those layers in the themesearch (see #2157)

This commit is contained in:
Pieter Vander Vennet 2024-09-28 02:53:44 +02:00
parent 556c26d99b
commit 03db69f1a0
2 changed files with 4 additions and 3 deletions

View file

@ -1,4 +1,3 @@
import Constants from "../../Models/Constants"
import SearchUtils from "./SearchUtils"
import ThemeSearch from "./ThemeSearch"
import LayerConfig from "../../Models/ThemeConfig/LayerConfig"
@ -12,7 +11,9 @@ export default class LayerSearch {
constructor(layout: LayoutConfig) {
this._layout = layout
this._layerWhitelist = new Set(layout.layers.map(l => l.id).filter(id => Constants.added_by_default.indexOf(<any>id) < 0))
this._layerWhitelist = new Set(layout.layers
.filter(l => l.isNormal())
.map(l => l.id))
}
static scoreLayers(query: string, options: {

View file

@ -36,7 +36,7 @@ export default class ThemeSearch {
private readonly _otherThemes: MinimalLayoutInformation[]
constructor(state: {osmConnection: OsmConnection, layout: LayoutConfig}) {
this._layersToIgnore = state.layout.layers.map(l => l.id)
this._layersToIgnore = state.layout.layers.filter(l => l.isNormal()).map(l => l.id)
this._knownHiddenThemes = UserRelatedState.initDiscoveredHiddenThemes(state.osmConnection).map(list => new Set(list))
this._otherThemes = ThemeSearch.officialThemes.themes
.filter(th => th.id !== state.layout.id)