diff --git a/Logic/ContributorCount.ts b/Logic/ContributorCount.ts index 08eb496c5..99b9c503c 100644 --- a/Logic/ContributorCount.ts +++ b/Logic/ContributorCount.ts @@ -1,5 +1,5 @@ /// Given a feature source, calculates a list of OSM-contributors who mapped the latest versions -import {UIEventSource} from "./UIEventSource"; +import {Store, UIEventSource} from "./UIEventSource"; import FeaturePipeline from "./FeatureSource/FeaturePipeline"; import Loc from "../Models/Loc"; import {BBox} from "./BBox"; @@ -7,10 +7,10 @@ import {BBox} from "./BBox"; export default class ContributorCount { public readonly Contributors: UIEventSource> = new UIEventSource>(new Map()); - private readonly state: { featurePipeline: FeaturePipeline, currentBounds: UIEventSource, locationControl: UIEventSource }; + private readonly state: { featurePipeline: FeaturePipeline, currentBounds: Store, locationControl: Store }; private lastUpdate: Date = undefined; - constructor(state: { featurePipeline: FeaturePipeline, currentBounds: UIEventSource, locationControl: UIEventSource }) { + constructor(state: { featurePipeline: FeaturePipeline, currentBounds: Store, locationControl: Store }) { this.state = state; const self = this; state.currentBounds.map(bbox => { diff --git a/Models/ThemeConfig/Json/RewritableConfigJson.ts b/Models/ThemeConfig/Json/RewritableConfigJson.ts index eb15c40a7..d97435939 100644 --- a/Models/ThemeConfig/Json/RewritableConfigJson.ts +++ b/Models/ThemeConfig/Json/RewritableConfigJson.ts @@ -1,9 +1,14 @@ /** * Rewrites and multiplies the given renderings of type T. * + * This can be used for introducing many similar questions automatically, + * which also makes translations easier. + * + * (Note that the key does _not_ need to be wrapped in {}. + * However, we recommend to use them if the key is used in a translation, as missing keys will be picked up and warned for by the translation scripts) + * * For example: * - * * ``` * { * rewrite: { @@ -13,9 +18,9 @@ * ["Y", 1], * ["Z", 2] * ], - * renderings: { + * renderings: [{ * "key":"a|b|c" - * } + * }] * } * } * ``` diff --git a/UI/BigComponents/CopyrightPanel.ts b/UI/BigComponents/CopyrightPanel.ts index e64624ee3..0c3a2b522 100644 --- a/UI/BigComponents/CopyrightPanel.ts +++ b/UI/BigComponents/CopyrightPanel.ts @@ -1,6 +1,6 @@ import Combine from "../Base/Combine"; import Translations from "../i18n/Translations"; -import {UIEventSource} from "../../Logic/UIEventSource"; +import {Store, UIEventSource} from "../../Logic/UIEventSource"; import {FixedUiElement} from "../Base/FixedUiElement"; import * as licenses from "../../assets/generated/license_info.json" import SmallLicense from "../../Models/smallLicense"; @@ -48,7 +48,7 @@ export class OpenIdEditor extends VariableUiElement { export class OpenJosm extends Combine { - constructor(state: { osmConnection: OsmConnection, currentBounds: UIEventSource, }, iconStyle?: string) { + constructor(state: { osmConnection: OsmConnection, currentBounds: Store, }, iconStyle?: string) { const t = Translations.t.general.attribution const josmState = new UIEventSource(undefined) @@ -98,10 +98,10 @@ export default class CopyrightPanel extends Combine { constructor(state: { layoutToUse: LayoutConfig, featurePipeline: FeaturePipeline, - currentBounds: UIEventSource, + currentBounds: Store, locationControl: UIEventSource, osmConnection: OsmConnection, - isTranslator: UIEventSource + isTranslator: Store }) { const t = Translations.t.general.attribution diff --git a/UI/BigComponents/LeftControls.ts b/UI/BigComponents/LeftControls.ts index ea29a3e5a..5255f5a59 100644 --- a/UI/BigComponents/LeftControls.ts +++ b/UI/BigComponents/LeftControls.ts @@ -6,7 +6,7 @@ import MapControlButton from "../MapControlButton"; import Svg from "../../Svg"; import AllDownloads from "./AllDownloads"; import FilterView from "./FilterView"; -import {UIEventSource} from "../../Logic/UIEventSource"; +import {Store, UIEventSource} from "../../Logic/UIEventSource"; import BackgroundMapSwitch from "./BackgroundMapSwitch"; import Lazy from "../Base/Lazy"; import {VariableUiElement} from "../Base/VariableUIElement"; @@ -28,7 +28,7 @@ export default class LeftControls extends Combine { const currentViewFL = state.currentView?.layer const currentViewAction = new Toggle( new Lazy(() => { - const feature: UIEventSource = state.currentView.features.map(ffs => ffs[0]?.feature) + const feature: Store = state.currentView.features.map(ffs => ffs[0]?.feature) const icon = new VariableUiElement(feature.map(feature => { const defaultIcon = Svg.checkbox_empty_svg() if (feature === undefined) { diff --git a/UI/BigComponents/TranslatorsPanel.ts b/UI/BigComponents/TranslatorsPanel.ts index a858ab463..88b1eb1f6 100644 --- a/UI/BigComponents/TranslatorsPanel.ts +++ b/UI/BigComponents/TranslatorsPanel.ts @@ -11,7 +11,7 @@ import Link from "../Base/Link"; import LinkToWeblate from "../Base/LinkToWeblate"; import Toggleable from "../Base/Toggleable"; import Title from "../Base/Title"; -import {UIEventSource} from "../../Logic/UIEventSource"; +import {Store, UIEventSource} from "../../Logic/UIEventSource"; import {SubtleButton} from "../Base/SubtleButton"; import Svg from "../../Svg"; import * as native_languages from "../../assets/language_native.json" @@ -19,7 +19,7 @@ import * as used_languages from "../../assets/generated/used_languages.json" import BaseUIElement from "../BaseUIElement"; class TranslatorsPanelContent extends Combine { - constructor(layout: LayoutConfig, isTranslator: UIEventSource) { + constructor(layout: LayoutConfig, isTranslator: Store) { const t = Translations.t.translations const {completeness, untranslated, total} = TranslatorsPanel.MissingTranslationsFor(layout) @@ -106,7 +106,7 @@ class TranslatorsPanelContent extends Combine { export default class TranslatorsPanel extends Toggle { - constructor(state: { layoutToUse: LayoutConfig, isTranslator: UIEventSource }, iconStyle?: string) { + constructor(state: { layoutToUse: LayoutConfig, isTranslator: Store }, iconStyle?: string) { const t = Translations.t.translations super( new Lazy(() => new TranslatorsPanelContent(state.layoutToUse, state.isTranslator) diff --git a/UI/Input/LengthInput.ts b/UI/Input/LengthInput.ts index 2c041618a..486d6c4c3 100644 --- a/UI/Input/LengthInput.ts +++ b/UI/Input/LengthInput.ts @@ -6,6 +6,7 @@ import {Utils} from "../../Utils"; import Loc from "../../Models/Loc"; import {GeoOperations} from "../../Logic/GeoOperations"; import Minimap from "../Base/Minimap"; +import BackgroundMapSwitch from "../BigComponents/BackgroundMapSwitch"; /**