Merge branch 'develop' into feature/professional
This commit is contained in:
commit
b84b40a500
52 changed files with 33741 additions and 1118 deletions
|
@ -8,6 +8,8 @@ import {Utils} from "../Utils";
|
|||
import LanguagePicker from "./LanguagePicker";
|
||||
import IndexText from "./BigComponents/IndexText";
|
||||
import FeaturedMessage from "./BigComponents/FeaturedMessage";
|
||||
import Toggle from "./Input/Toggle";
|
||||
import {SubtleButton} from "./Base/SubtleButton";
|
||||
|
||||
export default class AllThemesGui {
|
||||
constructor() {
|
||||
|
@ -15,16 +17,22 @@ export default class AllThemesGui {
|
|||
try {
|
||||
|
||||
new FixedUiElement("").AttachTo("centermessage")
|
||||
const state = new UserRelatedState(undefined, undefined);
|
||||
const state = new UserRelatedState(undefined);
|
||||
const intro = new Combine([
|
||||
|
||||
LanguagePicker.CreateLanguagePicker(Translations.t.index.title.SupportedLanguages())
|
||||
.SetClass("absolute top-2 right-3"),
|
||||
|
||||
.SetClass("flex absolute top-2 right-3"),
|
||||
new IndexText()
|
||||
]);
|
||||
new Combine([
|
||||
intro,
|
||||
new FeaturedMessage(),
|
||||
new MoreScreen(state, true),
|
||||
new Toggle(
|
||||
undefined,
|
||||
new SubtleButton(undefined, Translations.t.index.logIn).SetStyle("height:min-content").onClick(() => state.osmConnection.AttemptLogin()),
|
||||
state.osmConnection.isLoggedIn),
|
||||
Translations.t.general.aboutMapcomplete
|
||||
.Subs({"osmcha_link": Utils.OsmChaLinkFor(7)})
|
||||
.SetClass("link-underline"),
|
||||
|
|
|
@ -84,9 +84,16 @@ class SingleLayerSelectionButton extends Toggle {
|
|||
previousLayer.setData(previousLayer.data ?? available.data)
|
||||
options.currentBackground.setData(previousLayer.data)
|
||||
})
|
||||
|
||||
options.currentBackground.addCallbackAndRunD(background => {
|
||||
if (background.category === options.preferredType) {
|
||||
previousLayer.setData(background)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
available.addCallbackAndRunD(availableLayer => {
|
||||
available.addCallbackD(availableLayer => {
|
||||
// Called whenever a better layer is available
|
||||
|
||||
if (previousLayer.data === undefined) {
|
||||
// PreviousLayer is unset -> we definitively weren't using this category -> no need to switch
|
||||
|
@ -96,6 +103,11 @@ class SingleLayerSelectionButton extends Toggle {
|
|||
// The previously used layer doesn't match the current layer -> no need to switch
|
||||
return;
|
||||
}
|
||||
|
||||
// Is the previous layer still valid? If so, we don't bother to switch
|
||||
if(previousLayer.data.feature === null || GeoOperations.inside(locationControl.data, previousLayer.data.feature)){
|
||||
return
|
||||
}
|
||||
|
||||
if (availableLayer.category === options.preferredType) {
|
||||
// Allright, we can set this different layer
|
||||
|
@ -112,12 +124,6 @@ class SingleLayerSelectionButton extends Toggle {
|
|||
}
|
||||
})
|
||||
|
||||
options.currentBackground.addCallbackAndRunD(background => {
|
||||
if (background.category === options.preferredType) {
|
||||
previousLayer.setData(background)
|
||||
}
|
||||
})
|
||||
|
||||
this.activate = () => {
|
||||
checkPreviousLayer()
|
||||
if (available.data.category !== options.preferredType) {
|
||||
|
|
|
@ -33,16 +33,11 @@ export default class FeaturedMessage extends Combine {
|
|||
|
||||
public static WelcomeMessages(): { start_date: Date, end_date: Date, message: string, featured_theme?: string }[] {
|
||||
const all_messages: { start_date: Date, end_date: Date, message: string, featured_theme?: string }[] = []
|
||||
console.log("Constructing the list...", welcome_messages)
|
||||
for (const i in welcome_messages) {
|
||||
console.log(i)
|
||||
if (isNaN(Number(i))) {
|
||||
continue
|
||||
}
|
||||
console.log("> ", i)
|
||||
const wm = welcome_messages[i]
|
||||
console.log(wm)
|
||||
|
||||
if (wm === null) {
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -302,11 +302,10 @@ export default class ImportButton extends Toggle {
|
|||
|
||||
let action: OsmChangeAction & { getPreview(): Promise<FeatureSource> }
|
||||
|
||||
const theme = o.state.layoutToUse.id
|
||||
const changes = o.state.changes
|
||||
let confirm: () => Promise<string>
|
||||
if (o.conflationSettings !== undefined) {
|
||||
|
||||
// Conflate the way
|
||||
action = new ReplaceGeometryAction(
|
||||
o.state,
|
||||
o.feature,
|
||||
|
@ -323,6 +322,7 @@ export default class ImportButton extends Toggle {
|
|||
}
|
||||
|
||||
} else {
|
||||
// Upload the way to OSM
|
||||
const geom = o.feature.geometry
|
||||
let coordinates: [number, number][]
|
||||
if (geom.type === "LineString") {
|
||||
|
@ -331,7 +331,6 @@ export default class ImportButton extends Toggle {
|
|||
coordinates = geom.coordinates[0]
|
||||
}
|
||||
|
||||
|
||||
action = new CreateWayWithPointReuseAction(
|
||||
o.newTags.data,
|
||||
coordinates,
|
||||
|
@ -341,7 +340,6 @@ export default class ImportButton extends Toggle {
|
|||
withinRangeOfM: 1,
|
||||
ifMatches: new Tag("_is_part_of_building", "true"),
|
||||
mode: "move_osm_point"
|
||||
|
||||
}]
|
||||
)
|
||||
|
||||
|
@ -364,7 +362,13 @@ export default class ImportButton extends Toggle {
|
|||
})
|
||||
})
|
||||
|
||||
const confirmButton = new SubtleButton(o.image(), o.message)
|
||||
const tagsExplanation = new VariableUiElement(o.newTags.map(tagsToApply => {
|
||||
const tagsStr = tagsToApply.map(t => t.asHumanString(false, true)).join("&");
|
||||
return Translations.t.general.add.importTags.Subs({tags: tagsStr});
|
||||
}
|
||||
)).SetClass("subtle")
|
||||
|
||||
const confirmButton = new SubtleButton(o.image(), new Combine([o.message, tagsExplanation]).SetClass("flex flex-col"))
|
||||
confirmButton.onClick(async () => {
|
||||
{
|
||||
if (isImported.data) {
|
||||
|
@ -380,9 +384,7 @@ export default class ImportButton extends Toggle {
|
|||
}
|
||||
})
|
||||
|
||||
const cancel = new SubtleButton(Svg.close_ui(), Translations.t.general.cancel).onClick(() => {
|
||||
importClicked.setData(false)
|
||||
})
|
||||
const cancel = new SubtleButton(Svg.close_ui(), Translations.t.general.cancel).onClick(() => importClicked.setData(false))
|
||||
|
||||
|
||||
return new Combine([confirmationMap, confirmButton, cancel]).SetClass("flex flex-col")
|
||||
|
|
|
@ -197,6 +197,7 @@ export default class DefaultGUI {
|
|||
return;
|
||||
}
|
||||
isOpened.setData(false);
|
||||
return true; // Unregister this caller - we only autoclose once
|
||||
});
|
||||
|
||||
this.state.selectedElement.addCallbackAndRunD((_) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue