Make imageCarousel fit in with other elements (to make images optional or lower in the popup), add ghost bike popup

This commit is contained in:
Pieter Vander Vennet 2020-07-14 20:18:44 +02:00
parent 5970883adc
commit 54a01dfbef
15 changed files with 289 additions and 57 deletions

View file

@ -13,7 +13,6 @@ export class UserDetails {
public osmConnection: OsmConnection;
public dryRun: boolean;
home: { lon: number; lat: number };
}
export class OsmConnection {
@ -121,6 +120,27 @@ export class OsmConnection {
}
public preferences = new UIEventSource<any>({});
public preferenceSources : any = {}
public GetPreference(key: string) : UIEventSource<string>{
if(this.preferenceSources[key] !== undefined){
return this.preferenceSources[key];
}
const pref = new UIEventSource<string>(undefined);
pref.addCallback((v) => {
this.SetPreference(key, v);
});
this.preferences.addCallback((prefs) => {
if (prefs[key] !== undefined) {
pref.setData(prefs[key]);
}
});
this.preferenceSources[key] = pref;
return pref;
}
private UpdatePreferences() {
const self = this;
this.auth.xhr({
@ -142,7 +162,7 @@ export class OsmConnection {
});
}
public SetPreference(k:string, v:string) {
private SetPreference(k:string, v:string) {
if(!this.userDetails.data.loggedIn){
console.log("Not saving preference: user not logged in");
return;