Small fixes to GRB theme

This commit is contained in:
Pieter Vander Vennet 2022-06-08 12:53:04 +02:00
parent bdcc3329b7
commit 6dbd950ca6
5 changed files with 81 additions and 23 deletions

View file

@ -54,11 +54,13 @@ abstract class AbstractImportButton implements SpecialVisualizations {
public readonly docs: string
public readonly args: { name: string, defaultValue?: string, doc: string }[]
private readonly showRemovedTags: boolean;
private readonly cannotBeImportedMessage: BaseUIElement | undefined;
constructor(funcName: string, docsIntro: string, extraArgs: { name: string, doc: string, defaultValue?: string, required?: boolean }[], showRemovedTags = true) {
constructor(funcName: string, docsIntro: string, extraArgs: { name: string, doc: string, defaultValue?: string, required?: boolean }[],
options?: {showRemovedTags? : true | boolean, cannotBeImportedMessage?: BaseUIElement}) {
this.funcName = funcName
this.showRemovedTags = showRemovedTags;
this.showRemovedTags = options?.showRemovedTags ?? true;
this.cannotBeImportedMessage = options?.cannotBeImportedMessage
this.docs = `${docsIntro}
Note that the contributor must zoom to at least zoomlevel 18 to be able to use this functionality.
@ -200,7 +202,7 @@ ${Utils.special_visualizations_importRequirementDocs}
pleaseLoginButton,
state
),
t.wrongType,
this.cannotBeImportedMessage ?? t.wrongType,
new UIEventSource(this.canBeImported(feature)))
}
@ -304,7 +306,10 @@ export class ConflateButton extends AbstractImportButton {
[{
name: "way_to_conflate",
doc: "The key, of which the corresponding value is the id of the OSM-way that must be conflated; typically a calculatedTag"
}]
}],
{
cannotBeImportedMessage: Translations.t.general.add.import.wrongTypeToConflate
}
);
}
@ -393,7 +398,7 @@ export class ImportWayButton extends AbstractImportButton implements AutoAction
doc: "Distance to distort the geometry to snap to this layer",
defaultValue: "0.1"
}],
false
{ showRemovedTags: false}
)
}
@ -548,7 +553,7 @@ export class ImportPointButton extends AbstractImportButton {
{name:"location_picker",
defaultValue: "photo",
doc: "Chooses the background for the precise location picker, options are 'map', 'photo' or 'osmbasedmap' or 'none' if the precise input picker should be disabled"}],
false
{ showRemovedTags: false}
)
}

View file

@ -35,7 +35,7 @@ import {ConflateButton, ImportPointButton, ImportWayButton} from "./Popup/Import
import TagApplyButton from "./Popup/TagApplyButton";
import AutoApplyButton from "./Popup/AutoApplyButton";
import * as left_right_style_json from "../assets/layers/left_right_style/left_right_style.json";
import {OpenIdEditor} from "./BigComponents/CopyrightPanel";
import {OpenIdEditor, OpenJosm} from "./BigComponents/CopyrightPanel";
import Toggle from "./Input/Toggle";
import Img from "./Base/Img";
import NoteCommentElement from "./Popup/NoteCommentElement";
@ -886,7 +886,14 @@ export default class SpecialVisualizations {
return new OpenIdEditor(state, undefined, feature.data.id)
}
},
{
funcName: "open_in_josm",
docs: "Opens the current view in the JOSM-editor",
args: [],
constr: (state, feature) => {
return new OpenJosm(state)
}
},
{
funcName: "clear_location_history",