forked from MapComplete/MapComplete
Add binoculars theme, auto reformat everything
This commit is contained in:
parent
38dea806c5
commit
78d6482c88
586 changed files with 115573 additions and 111842 deletions
|
@ -60,7 +60,7 @@ export default class DeleteWizard extends Toggle {
|
|||
}
|
||||
(State.state?.changes ?? new Changes())
|
||||
.applyAction(new ChangeTagAction(
|
||||
id, new And(tagsToApply.map(kv => new Tag(kv.k, kv.v))), tagsSource.data
|
||||
id, new And(tagsToApply.map(kv => new Tag(kv.k, kv.v))), tagsSource.data
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -115,30 +115,30 @@ export default class DeleteWizard extends Toggle {
|
|||
}
|
||||
).SetClass("w-1/2 float-right");
|
||||
|
||||
const isShown = new UIEventSource<boolean>(id.indexOf("-")< 0)
|
||||
|
||||
const isShown = new UIEventSource<boolean>(id.indexOf("-") < 0)
|
||||
|
||||
super(
|
||||
new Toggle(
|
||||
new Combine([Svg.delete_icon_svg().SetClass("h-16 w-16 p-2 m-2 block bg-gray-300 rounded-full"),
|
||||
t.isDeleted.Clone()]).SetClass("flex m-2 rounded-full"),
|
||||
new Toggle(
|
||||
new Combine([Svg.delete_icon_svg().SetClass("h-16 w-16 p-2 m-2 block bg-gray-300 rounded-full"),
|
||||
t.isDeleted.Clone()]).SetClass("flex m-2 rounded-full"),
|
||||
new Toggle(
|
||||
new Toggle(
|
||||
new Toggle(
|
||||
question,
|
||||
new SubtleButton(Svg.envelope_ui(), t.readMessages.Clone()),
|
||||
State.state.osmConnection.userDetails.map(ud => ud.csCount > Constants.userJourney.addNewPointWithUnreadMessagesUnlock || ud.unreadMessages == 0)
|
||||
),
|
||||
new Toggle(
|
||||
question,
|
||||
new SubtleButton(Svg.envelope_ui(), t.readMessages.Clone()),
|
||||
State.state.osmConnection.userDetails.map(ud => ud.csCount > Constants.userJourney.addNewPointWithUnreadMessagesUnlock || ud.unreadMessages == 0)
|
||||
),
|
||||
|
||||
deleteButton,
|
||||
confirm),
|
||||
new VariableUiElement(deleteAction.canBeDeleted.map(cbd => new Combine([cbd.reason.Clone(), t.useSomethingElse.Clone()]))),
|
||||
deleteAction.canBeDeleted.map(cbd => allowSoftDeletion || cbd.canBeDeleted !== false)),
|
||||
deleteButton,
|
||||
confirm),
|
||||
new VariableUiElement(deleteAction.canBeDeleted.map(cbd => new Combine([cbd.reason.Clone(), t.useSomethingElse.Clone()]))),
|
||||
deleteAction.canBeDeleted.map(cbd => allowSoftDeletion || cbd.canBeDeleted !== false)),
|
||||
|
||||
t.loginToDelete.Clone().onClick(State.state.osmConnection.AttemptLogin),
|
||||
State.state.osmConnection.isLoggedIn
|
||||
),
|
||||
deleteAction.isDeleted),
|
||||
t.loginToDelete.Clone().onClick(State.state.osmConnection.AttemptLogin),
|
||||
State.state.osmConnection.isLoggedIn
|
||||
),
|
||||
deleteAction.isDeleted),
|
||||
undefined,
|
||||
isShown)
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ export default class EditableTagRendering extends Toggle {
|
|||
configuration: TagRenderingConfig,
|
||||
units: Unit [],
|
||||
editMode = new UIEventSource<boolean>(false)
|
||||
) {
|
||||
) {
|
||||
const answer: BaseUIElement = new TagRenderingAnswer(tags, configuration)
|
||||
answer.SetClass("w-full")
|
||||
let rendering = answer;
|
||||
|
@ -30,7 +30,6 @@ export default class EditableTagRendering extends Toggle {
|
|||
});
|
||||
|
||||
|
||||
|
||||
const answerWithEditButton = new Combine([answer,
|
||||
new Toggle(editButton, undefined, State.state.osmConnection.isLoggedIn)])
|
||||
.SetClass("flex justify-between w-full")
|
||||
|
@ -47,7 +46,7 @@ export default class EditableTagRendering extends Toggle {
|
|||
{
|
||||
units: units,
|
||||
cancelButton: cancelbutton,
|
||||
afterSave: () => {
|
||||
afterSave: () => {
|
||||
editMode.setData(false)
|
||||
}
|
||||
})
|
||||
|
|
|
@ -66,8 +66,8 @@ export default class FeatureInfoBox extends ScrollableFullScreen {
|
|||
}
|
||||
return new EditableTagRendering(tags, tr, layerConfig.units);
|
||||
});
|
||||
|
||||
let editElements : BaseUIElement[] = []
|
||||
|
||||
let editElements: BaseUIElement[] = []
|
||||
if (!questionBoxIsUsed) {
|
||||
editElements.push(questionBox);
|
||||
}
|
||||
|
@ -124,10 +124,10 @@ export default class FeatureInfoBox extends ScrollableFullScreen {
|
|||
})
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
const editors = new VariableUiElement(State.state.featureSwitchUserbadge.map(
|
||||
userbadge => {
|
||||
if(!userbadge){
|
||||
if (!userbadge) {
|
||||
return undefined
|
||||
}
|
||||
return new Combine(editElements)
|
||||
|
|
|
@ -97,10 +97,10 @@ export default class SplitRoadWizard extends Toggle {
|
|||
let hasRun = false
|
||||
way.map(way => {
|
||||
const partOf = partOfSrc.data
|
||||
if(way === undefined || partOf === undefined){
|
||||
if (way === undefined || partOf === undefined) {
|
||||
return;
|
||||
}
|
||||
if(hasRun){
|
||||
if (hasRun) {
|
||||
return
|
||||
}
|
||||
hasRun = true
|
||||
|
@ -108,7 +108,7 @@ export default class SplitRoadWizard extends Toggle {
|
|||
<OsmWay>way, way.asGeoJson(), partOf, splitPoints.data.map(ff => ff.feature)
|
||||
)
|
||||
State.state.changes.applyAction(splitAction)
|
||||
|
||||
|
||||
}, [partOfSrc])
|
||||
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ export default class TagRenderingQuestion extends Combine {
|
|||
|
||||
const inputElement: InputElement<TagsFilter> = TagRenderingQuestion.GenerateInputElement(configuration, applicableUnit, tags)
|
||||
|
||||
if(inputElement === undefined){
|
||||
if (inputElement === undefined) {
|
||||
console.trace("MultiAnswer failed", configuration)
|
||||
const inputElement0: InputElement<TagsFilter> = TagRenderingQuestion.GenerateInputElement(configuration, applicableUnit, tags)
|
||||
|
||||
|
@ -128,21 +128,22 @@ export default class TagRenderingQuestion extends Combine {
|
|||
})
|
||||
|
||||
|
||||
function allIfNotsExcept(excludeIndex: number) : TagsFilter[]{
|
||||
if(configuration.mappings === undefined){
|
||||
function allIfNotsExcept(excludeIndex: number): TagsFilter[] {
|
||||
if (configuration.mappings === undefined) {
|
||||
return []
|
||||
}
|
||||
if(configuration.multiAnswer){
|
||||
if (configuration.multiAnswer) {
|
||||
// The multianswer will do the ifnot configuration themself
|
||||
return []
|
||||
}
|
||||
return Utils.NoNull(configuration.mappings?.map((m,i) => excludeIndex === i ? undefined: m.ifnot))
|
||||
return Utils.NoNull(configuration.mappings?.map((m, i) => excludeIndex === i ? undefined : m.ifnot))
|
||||
}
|
||||
|
||||
const ff = TagRenderingQuestion.GenerateFreeform(configuration, applicableUnit, tagsSource);
|
||||
const hasImages = mappings.filter(mapping => mapping.then.ExtractImages().length > 0).length > 0
|
||||
|
||||
if (mappings.length < 8 || configuration.multiAnswer || hasImages) {
|
||||
inputEls = (mappings ?? []).map((mapping,i) => TagRenderingQuestion.GenerateMappingElement(tagsSource, mapping, allIfNotsExcept(i)));
|
||||
inputEls = (mappings ?? []).map((mapping, i) => TagRenderingQuestion.GenerateMappingElement(tagsSource, mapping, allIfNotsExcept(i)));
|
||||
inputEls = Utils.NoNull(inputEls);
|
||||
} else {
|
||||
const dropdown: InputElement<TagsFilter> = new DropDown("",
|
||||
|
@ -182,7 +183,7 @@ export default class TagRenderingQuestion extends Combine {
|
|||
configuration: TagRenderingConfig,
|
||||
elements: InputElement<TagsFilter>[], freeformField: InputElement<TagsFilter>, ifNotSelected: TagsFilter[]): InputElement<TagsFilter> {
|
||||
const checkBoxes = new CheckBoxes(elements);
|
||||
|
||||
|
||||
const inputEl = new InputElementMap<number[], TagsFilter>(
|
||||
checkBoxes,
|
||||
(t0, t1) => {
|
||||
|
@ -350,19 +351,19 @@ export default class TagRenderingQuestion extends Combine {
|
|||
|
||||
input.GetValue().setData(tagsData[freeform.key] ?? freeform.default);
|
||||
|
||||
let inputTagsFilter : InputElement<TagsFilter> = new InputElementMap(
|
||||
let inputTagsFilter: InputElement<TagsFilter> = new InputElementMap(
|
||||
input, (a, b) => a === b || (a?.isEquivalent(b) ?? false),
|
||||
pickString, toString
|
||||
);
|
||||
|
||||
if(freeform.inline){
|
||||
|
||||
|
||||
if (freeform.inline) {
|
||||
|
||||
inputTagsFilter.SetClass("w-16-imp")
|
||||
inputTagsFilter = new InputElementWrapper(inputTagsFilter, configuration.render, freeform.key, tags)
|
||||
inputTagsFilter.SetClass("block")
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return inputTagsFilter;
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue