Huge refactoring: split readonly and writable stores

This commit is contained in:
Pieter Vander Vennet 2022-06-05 02:24:14 +02:00
parent 0946d8ac9c
commit 4283b76f36
95 changed files with 819 additions and 625 deletions

View file

@ -1,7 +1,7 @@
import {Translation} from "../UI/i18n/Translation";
import {ApplicableUnitJson} from "./ThemeConfig/Json/UnitConfigJson";
import Translations from "../UI/i18n/Translations";
import {UIEventSource} from "../Logic/UIEventSource";
import {Store, UIEventSource} from "../Logic/UIEventSource";
import BaseUIElement from "../UI/BaseUIElement";
import Toggle from "../UI/Input/Toggle";
@ -49,7 +49,7 @@ export class Denomination {
return (this._humanSingular ?? this._human).Clone()
}
getToggledHuman(isSingular: UIEventSource<boolean>): BaseUIElement {
getToggledHuman(isSingular: Store<boolean>): BaseUIElement {
if (this._humanSingular === undefined) {
return this.human
}

View file

@ -129,7 +129,7 @@ export default class FilterConfig {
}))
// We map the query parameter for this case
return qp.map(str => {
return qp.sync(str => {
const parsed = Number(str)
if (isNaN(parsed)) {
// Nope, not a correct number!
@ -143,7 +143,7 @@ export default class FilterConfig {
const option = this.options[0]
if (option.fields.length > 0) {
return qp.map(str => {
return qp.sync(str => {
// There are variables in play!
// str should encode a json-hash
try {
@ -178,7 +178,7 @@ export default class FilterConfig {
currentFilter: option.osmTags,
state: "true"
}
return qp.map(
return qp.sync(
str => {
// Only a single option exists here
if (str === "true") {