Merge develop

This commit is contained in:
Pieter Vander Vennet 2021-10-26 01:27:35 +02:00
commit 07bc5d6a6d
88 changed files with 3284 additions and 2363 deletions

View file

@ -26,7 +26,7 @@ export default class FeatureInfoBox extends ScrollableFullScreen {
) {
super(() => FeatureInfoBox.GenerateTitleBar(tags, layerConfig),
() => FeatureInfoBox.GenerateContent(tags, layerConfig),
undefined);
tags.data.id);
if (layerConfig === undefined) {
throw "Undefined layerconfig";
@ -178,7 +178,6 @@ export default class FeatureInfoBox extends ScrollableFullScreen {
allRenderings.push(editors)
return new Combine(allRenderings).SetClass("block")
}
/**

View file

@ -17,7 +17,6 @@ import ChangeLocationAction from "../../Logic/Osm/Actions/ChangeLocationAction";
import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig";
import MoveConfig from "../../Models/ThemeConfig/MoveConfig";
import {ElementStorage} from "../../Logic/ElementStorage";
import ValidatedTextField from "../Input/ValidatedTextField";
import AvailableBaseLayers from "../../Logic/Actors/AvailableBaseLayers";
interface MoveReason {
@ -47,7 +46,7 @@ export default class MoveWizard extends Toggle {
const t = Translations.t.move
const loginButton = new Toggle(
t.loginToMove.Clone().SetClass("btn").onClick(() => state.osmConnection.AttemptLogin()),
t.loginToMove.SetClass("btn").onClick(() => state.osmConnection.AttemptLogin()),
undefined,
state.featureSwitchUserbadge
)
@ -55,8 +54,8 @@ export default class MoveWizard extends Toggle {
const reasons: MoveReason[] = []
if (options.enableRelocation) {
reasons.push({
text: t.reasons.reasonRelocation.Clone(),
invitingText: t.inviteToMove.reasonRelocation.Clone(),
text: t.reasons.reasonRelocation,
invitingText: t.inviteToMove.reasonRelocation,
icon: Svg.relocation_svg(),
changesetCommentValue: "relocated",
lockBounds: false,
@ -67,7 +66,7 @@ export default class MoveWizard extends Toggle {
}
if(options.enableImproveAccuracy){
reasons.push({
text: t.reasons.reasonInaccurate.Clone(),
text: t.reasons.reasonInaccurate,
invitingText: t.inviteToMove.reasonInaccurate,
icon: Svg.crosshair_svg(),
changesetCommentValue: "improve_accuracy",
@ -86,14 +85,14 @@ export default class MoveWizard extends Toggle {
moveReason.setData(reason)
moveButton = new SubtleButton(
reason.icon.SetStyle("height: 1.5rem; width: auto;"),
Translations.WT(reason.invitingText).Clone()
Translations.WT(reason.invitingText)
).onClick(() => {
currentStep.setData("pick_location")
})
}else{
moveButton = new SubtleButton(
Svg.move_ui().SetStyle("height: 1.5rem; width: auto"),
t.inviteToMove.generic.Clone()
t.inviteToMove.generic
).onClick(() => {
currentStep.setData("reason")
})
@ -102,7 +101,7 @@ export default class MoveWizard extends Toggle {
const moveAgainButton = new SubtleButton(
Svg.move_ui(),
t.inviteToMoveAgain.Clone()
t.inviteToMoveAgain
).onClick(() => {
currentStep.setData("reason")
})
@ -152,7 +151,7 @@ export default class MoveWizard extends Toggle {
confirmMove.onClick(() => {
const loc = locationInput.GetValue().data
state.changes.applyAction(new ChangeLocationAction(featureToMove.properties.id, [loc.lon, loc.lat], {
reason: Translations.WT(reason.text).textFor("en"),
reason: reason.changesetCommentValue,
theme: state.layoutToUse.id
}))
featureToMove.properties._lat = loc.lat
@ -160,7 +159,7 @@ export default class MoveWizard extends Toggle {
state.allElements.getEventSourceById(id).ping()
currentStep.setData("moved")
})
const zoomInFurhter = t.zoomInFurther.Clone().SetClass("alert block m-6")
const zoomInFurhter = t.zoomInFurther.SetClass("alert block m-6")
return new Combine([
locationInput,
new Toggle(confirmMove, zoomInFurhter, locationInput.GetValue().map(l => l.zoom >= 19))
@ -175,11 +174,11 @@ export default class MoveWizard extends Toggle {
case "start":
return moveButton;
case "reason":
return new Combine([t.whyMove.Clone().SetClass("text-lg font-bold"), selectReason, cancelButton]).SetClass(dialogClasses);
return new Combine([t.whyMove.SetClass("text-lg font-bold"), selectReason, cancelButton]).SetClass(dialogClasses);
case "pick_location":
return new Combine([t.moveTitle.Clone().SetClass("text-lg font-bold"), new VariableUiElement(locationInput), cancelButton]).SetClass(dialogClasses)
return new Combine([t.moveTitle.SetClass("text-lg font-bold"), new VariableUiElement(locationInput), cancelButton]).SetClass(dialogClasses)
case "moved":
return new Combine([t.pointIsMoved.Clone().SetClass("thanks"), moveAgainButton]).SetClass("flex flex-col");
return new Combine([t.pointIsMoved.SetClass("thanks"), moveAgainButton]).SetClass("flex flex-col");
}
@ -196,20 +195,20 @@ export default class MoveWizard extends Toggle {
const moveDisallowedReason = new UIEventSource<BaseUIElement>(undefined)
if (id.startsWith("way")) {
moveDisallowedReason.setData(t.isWay.Clone())
moveDisallowedReason.setData(t.isWay)
} else if (id.startsWith("relation")) {
moveDisallowedReason.setData(t.isRelation.Clone())
} else {
moveDisallowedReason.setData(t.isRelation)
} else if(id.indexOf("-") < 0) {
OsmObject.DownloadReferencingWays(id).then(referencing => {
if (referencing.length > 0) {
console.log("Got a referencing way, move not allowed")
moveDisallowedReason.setData(t.partOfAWay.Clone())
moveDisallowedReason.setData(t.partOfAWay)
}
})
OsmObject.DownloadReferencingRelations(id).then(partOf => {
if(partOf.length > 0){
moveDisallowedReason.setData(t.partOfRelation.Clone())
if(partOf.length > 0){
moveDisallowedReason.setData(t.partOfRelation)
}
})
}
@ -217,7 +216,7 @@ export default class MoveWizard extends Toggle {
moveFlow,
new Combine([
Svg.move_not_allowed_svg().SetStyle("height: 2rem").SetClass("m-2"),
new Combine([t.cannotBeMoved.Clone(),
new Combine([t.cannotBeMoved,
new VariableUiElement(moveDisallowedReason).SetClass("subtle")
]).SetClass("flex flex-col")
]).SetClass("flex m-2 p-2 rounded-lg bg-gray-200"),

View file

@ -26,6 +26,7 @@ import ChangeTagAction from "../../Logic/Osm/Actions/ChangeTagAction";
import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig";
import {Unit} from "../../Models/Unit";
import VariableInputElement from "../Input/VariableInputElement";
import Toggle from "../Input/Toggle";
/**
* Shows the question element.
@ -75,7 +76,7 @@ export default class TagRenderingQuestion extends Combine {
const inputElement: InputElement<TagsFilter> =
new VariableInputElement(applicableMappingsSrc.map(applicableMappings =>
new VariableInputElement(applicableMappingsSrc.map(applicableMappings =>
TagRenderingQuestion.GenerateInputElement(configuration, applicableMappings, applicableUnit, tags)
))
@ -104,8 +105,11 @@ export default class TagRenderingQuestion extends Combine {
.onClick(save)
}
const saveButton = options.saveButtonConstr(inputElement.GetValue())
const saveButton = new Combine([
options.saveButtonConstr(inputElement.GetValue()),
new Toggle(Translations.t.general.testing, undefined, State.state.featureSwitchIsTesting).SetClass("alert")
])
let bottomTags: BaseUIElement;
if (options.bottomText !== undefined) {
bottomTags = options.bottomText(inputElement.GetValue())
@ -118,7 +122,7 @@ export default class TagRenderingQuestion extends Combine {
return "";
}
if (tagsFilter === undefined) {
return Translations.t.general.noTagsSelected.Clone().SetClass("subtle");
return Translations.t.general.noTagsSelected.SetClass("subtle");
}
if (csCount < Constants.userJourney.tagsVisibleAndWikiLinked) {
const tagsStr = tagsFilter.asHumanString(false, true, tags.data);
@ -135,6 +139,8 @@ export default class TagRenderingQuestion extends Combine {
options.cancelButton,
saveButton,
bottomTags])
this.SetClass("question disable-links")
}
@ -189,7 +195,7 @@ export default class TagRenderingQuestion extends Combine {
applicableMappings.map((mapping, i) => {
return {
value: new And([mapping.if, ...allIfNotsExcept(i)]),
shown: Translations.WT(mapping.then).Clone()
shown: Translations.WT(mapping.then)
}
})
)
@ -203,7 +209,7 @@ export default class TagRenderingQuestion extends Combine {
if (inputEls.length == 0) {
if(ff === undefined){
if (ff === undefined) {
throw "Error: could not generate a question: freeform and all mappings are undefined"
}
return ff;