forked from MapComplete/MapComplete
Split up allKnownLayouts, make parsing it lazy for faster loading
This commit is contained in:
parent
6dc0fa0851
commit
6ee85b12f8
14 changed files with 311 additions and 323 deletions
|
@ -35,7 +35,7 @@ export default class AllThemesGui {
|
|||
])
|
||||
.SetClass("block m-5 lg:w-3/4 lg:ml-40")
|
||||
.SetStyle("pointer-events: all;")
|
||||
.AttachTo("topleft-tools")
|
||||
.AttachTo("top-left")
|
||||
} catch (e) {
|
||||
console.error(">>>> CRITICAL", e)
|
||||
new FixedUiElement(
|
||||
|
|
|
@ -3,7 +3,6 @@ import Svg from "../../Svg"
|
|||
import Combine from "../Base/Combine"
|
||||
import { SubtleButton } from "../Base/SubtleButton"
|
||||
import Translations from "../i18n/Translations"
|
||||
import personal from "../../assets/themes/personal/personal.json"
|
||||
import Constants from "../../Models/Constants"
|
||||
import BaseUIElement from "../BaseUIElement"
|
||||
import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig"
|
||||
|
@ -382,7 +381,7 @@ export default class MoreScreen extends Combine {
|
|||
return undefined
|
||||
}
|
||||
const button = MoreScreen.createLinkButton(state, layout)?.SetClass(buttonClass)
|
||||
if (layout.id === personal.id) {
|
||||
if (layout.id === "personal") {
|
||||
const element = new VariableUiElement(
|
||||
state.osmConnection.userDetails
|
||||
.map((userdetails) => userdetails.csCount)
|
||||
|
|
|
@ -37,7 +37,7 @@ export default class SelectTheme
|
|||
|
||||
constructor(params: { features: any[]; layer: LayerConfig; bbox: BBox }) {
|
||||
const t = Translations.t.importHelper.selectTheme
|
||||
let options: InputElement<string>[] = AllKnownLayouts.layoutsList
|
||||
let options: InputElement<string>[] = Array.from(AllKnownLayouts.allKnownLayouts.values())
|
||||
.filter((th) => th.layers.some((l) => l.id === params.layer.id))
|
||||
.filter((th) => th.id !== "personal")
|
||||
.map(
|
||||
|
@ -60,7 +60,7 @@ export default class SelectTheme
|
|||
return []
|
||||
}
|
||||
// we get the layer with the correct ID via the actual theme config, as the actual theme might have different presets due to overrides
|
||||
const themeConfig = AllKnownLayouts.layoutsList.find((th) => th.id === theme)
|
||||
const themeConfig = AllKnownLayouts.allKnownLayouts.get(theme)
|
||||
const layer = themeConfig.layers.find((l) => l.id === params.layer.id)
|
||||
return layer.presets
|
||||
})
|
||||
|
|
|
@ -8,17 +8,17 @@ import { Utils } from "../Utils"
|
|||
import Combine from "./Base/Combine"
|
||||
import { StackedRenderingChart } from "./BigComponents/TagRenderingChart"
|
||||
import { LayerFilterPanel } from "./BigComponents/FilterView"
|
||||
import { AllKnownLayouts } from "../Customizations/AllKnownLayouts"
|
||||
import MapState from "../Logic/State/MapState"
|
||||
import BaseUIElement from "./BaseUIElement"
|
||||
import Title from "./Base/Title"
|
||||
import { FixedUiElement } from "./Base/FixedUiElement"
|
||||
import List from "./Base/List"
|
||||
|
||||
import LayoutConfig from "../Models/ThemeConfig/LayoutConfig"
|
||||
import mcChanges from "../assets/generated/themes/mapcomplete-changes.json"
|
||||
class StatisticsForOverviewFile extends Combine {
|
||||
constructor(homeUrl: string, paths: string[]) {
|
||||
paths = paths.filter((p) => !p.endsWith("file-overview.json"))
|
||||
const layer = AllKnownLayouts.allKnownLayouts.get("mapcomplete-changes").layers[0]
|
||||
const layer = new LayoutConfig(<any>mcChanges, true).layers[0]
|
||||
const filteredLayer = MapState.InitializeFilteredLayers(
|
||||
{ id: "statistics-view", layers: [layer] },
|
||||
undefined
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue