Auto-formatting

This commit is contained in:
Pieter Vander Vennet 2022-12-16 13:45:07 +01:00
parent 9e000d521f
commit fed4cff878
26 changed files with 360 additions and 304 deletions

View file

@ -235,7 +235,7 @@ export default class DeleteWizard extends Toggle {
return t.explanations.hardDelete
}
// This is a soft deletion: we explain _why_ the deletion is soft
return t.explanations.softDelete.Subs({ reason: reason})
return t.explanations.softDelete.Subs({ reason: reason })
})
)
}

View file

@ -1,4 +1,4 @@
import {UIEventSource} from "../../Logic/UIEventSource"
import { UIEventSource } from "../../Logic/UIEventSource"
import TagRenderingQuestion from "./TagRenderingQuestion"
import Translations from "../i18n/Translations"
import Combine from "../Base/Combine"
@ -6,10 +6,10 @@ import TagRenderingAnswer from "./TagRenderingAnswer"
import Toggle from "../Input/Toggle"
import BaseUIElement from "../BaseUIElement"
import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig"
import {Unit} from "../../Models/Unit"
import { Unit } from "../../Models/Unit"
import Lazy from "../Base/Lazy"
import {FixedUiElement} from "../Base/FixedUiElement"
import {EditButton} from "./SaveButton"
import { FixedUiElement } from "../Base/FixedUiElement"
import { EditButton } from "./SaveButton"
export default class EditableTagRendering extends Toggle {
constructor(
@ -52,9 +52,9 @@ export default class EditableTagRendering extends Toggle {
undefined,
renderingIsShown
)
const self = this;
editMode.addCallback(editing => {
if(editing){
const self = this
editMode.addCallback((editing) => {
if (editing) {
console.log("Scrolling etr into view")
self.ScrollIntoView()
}
@ -91,18 +91,16 @@ export default class EditableTagRendering extends Toggle {
})
)
const answerWithEditButton = new Combine([
const answerWithEditButton = new Combine([
answer,
new EditButton(state.osmConnection, () => {
editMode.setData(true)
question.ScrollIntoView({
onlyIfPartiallyHidden:true
onlyIfPartiallyHidden: true,
})
}),
]).SetClass("flex justify-between w-full")
rendering = new Toggle(question, answerWithEditButton, editMode)
}
return rendering
}

View file

@ -79,11 +79,15 @@ export default class FeatureInfoBox extends ScrollableFullScreen {
public static GenerateContent(
tags: UIEventSource<any>,
layerConfig: LayerConfig,
state: FeaturePipelineState): BaseUIElement{
state: FeaturePipelineState
): BaseUIElement {
return new Toggle(
new Combine([Svg.delete_icon_svg().SetClass("w-8 h-8"), Translations.t.delete.isDeleted]).SetClass("flex justify-center font-bold items-center") ,
new Combine([
Svg.delete_icon_svg().SetClass("w-8 h-8"),
Translations.t.delete.isDeleted,
]).SetClass("flex justify-center font-bold items-center"),
FeatureInfoBox.GenerateMainContent(tags, layerConfig, state),
tags.map(t => t["_deleted"] == "yes")
tags.map((t) => t["_deleted"] == "yes")
)
}
private static GenerateMainContent(
@ -91,7 +95,6 @@ export default class FeatureInfoBox extends ScrollableFullScreen {
layerConfig: LayerConfig,
state: FeaturePipelineState
): BaseUIElement {
let questionBoxes: Map<string, QuestionBox> = new Map<string, QuestionBox>()
const t = Translations.t.general
const allGroupNames = Utils.Dedup(layerConfig.tagRenderings.map((tr) => tr.group))

View file

@ -1,28 +1,28 @@
import {SubtleButton} from "../Base/SubtleButton"
import { SubtleButton } from "../Base/SubtleButton"
import Combine from "../Base/Combine"
import Svg from "../../Svg"
import {OsmConnection} from "../../Logic/Osm/OsmConnection"
import { OsmConnection } from "../../Logic/Osm/OsmConnection"
import Toggle from "../Input/Toggle"
import {UIEventSource} from "../../Logic/UIEventSource"
import { UIEventSource } from "../../Logic/UIEventSource"
import Translations from "../i18n/Translations"
import {VariableUiElement} from "../Base/VariableUIElement"
import {Translation} from "../i18n/Translation"
import { VariableUiElement } from "../Base/VariableUIElement"
import { Translation } from "../i18n/Translation"
import BaseUIElement from "../BaseUIElement"
import LocationInput from "../Input/LocationInput"
import Loc from "../../Models/Loc"
import {GeoOperations} from "../../Logic/GeoOperations"
import {OsmObject} from "../../Logic/Osm/OsmObject"
import {Changes} from "../../Logic/Osm/Changes"
import { GeoOperations } from "../../Logic/GeoOperations"
import { OsmObject } from "../../Logic/Osm/OsmObject"
import { Changes } from "../../Logic/Osm/Changes"
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 { ElementStorage } from "../../Logic/ElementStorage"
import AvailableBaseLayers from "../../Logic/Actors/AvailableBaseLayers"
import BaseLayer from "../../Models/BaseLayer"
import SearchAndGo from "../BigComponents/SearchAndGo";
import ChangeTagAction from "../../Logic/Osm/Actions/ChangeTagAction";
import {And} from "../../Logic/Tags/And";
import {Tag} from "../../Logic/Tags/Tag";
import SearchAndGo from "../BigComponents/SearchAndGo"
import ChangeTagAction from "../../Logic/Osm/Actions/ChangeTagAction"
import { And } from "../../Logic/Tags/And"
import { Tag } from "../../Logic/Tags/Tag"
interface MoveReason {
text: Translation | string
@ -71,7 +71,7 @@ export default class MoveWizard extends Toggle {
includeSearch: true,
startZoom: 12,
minZoom: 6,
eraseAddressFields: true
eraseAddressFields: true,
})
}
if (options.enableImproveAccuracy) {
@ -85,7 +85,7 @@ export default class MoveWizard extends Toggle {
background: "photo",
startZoom: 17,
minZoom: 16,
eraseAddressFields: false
eraseAddressFields: false,
})
}
@ -166,7 +166,7 @@ export default class MoveWizard extends Toggle {
let searchPanel: BaseUIElement = undefined
if (reason.includeSearch) {
searchPanel = new SearchAndGo({
leafletMap: locationInput.leafletMap
leafletMap: locationInput.leafletMap,
})
}
@ -186,12 +186,14 @@ export default class MoveWizard extends Toggle {
if (reason.eraseAddressFields) {
await state.changes.applyAction(
new ChangeTagAction(featureToMove.properties.id,
new And([new Tag("addr:housenumber", ""),
new ChangeTagAction(
featureToMove.properties.id,
new And([
new Tag("addr:housenumber", ""),
new Tag("addr:street", ""),
new Tag("addr:city", ""),
new Tag("addr:postcode","")]
),
new Tag("addr:postcode", ""),
]),
featureToMove.properties,
{
changeType: "relocated",

View file

@ -33,7 +33,7 @@ export default class QuestionBox extends VariableUiElement {
.filter((tr) => tr.question !== undefined)
.filter((tr) => tr.question !== null)
let focus: () => void = () => {};
let focus: () => void = () => {}
const tagRenderingQuestions = tagRenderings.map(
(tagRendering, i) =>
@ -53,7 +53,6 @@ export default class QuestionBox extends VariableUiElement {
skippedQuestions.data.push(i)
skippedQuestions.ping()
focus()
}),
})
)
@ -141,8 +140,9 @@ export default class QuestionBox extends VariableUiElement {
this.skippedQuestions = skippedQuestions
this.restingQuestions = questionsToAsk
focus = () => this.ScrollIntoView({
onlyIfPartiallyHidden: true
})
focus = () =>
this.ScrollIntoView({
onlyIfPartiallyHidden: true,
})
}
}