Skip to content

Commit

Permalink
Merge pull request water-fountains#494 from tegonal/shared-location
Browse files Browse the repository at this point in the history
water-fountains#491 loc / water-fountains#493 map.resize / water-fountains#489 switch between cities
  • Loading branch information
robstoll authored Dec 17, 2021
2 parents df9dcea + 64fe564 commit b3315db
Show file tree
Hide file tree
Showing 30 changed files with 681 additions and 503 deletions.
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"haversine": "^1.1.0",
"js-md5": "^0.7.3",
"lodash": "^4.17.21",
"mapbox-gl": "^2.5.1",
"mapbox-gl": "^2.6.1",
"rxjs": "^6.6.7",
"tassign": "^1.0.0",
"ts-md5": "^1.2.8",
Expand All @@ -68,11 +68,11 @@
"@types/haversine": "^1.1.0",
"@types/jasmine": "^3.10.1",
"@types/jasminewd2": "^2.0.9",
"@types/leaflet": "^1.7.0",
"@types/js-md5": "^0.4.3",
"@types/node": "^14.0.0",
"@types/mapbox-gl": "^2.4.2",
"@types/leaflet": "^1.7.0",
"@types/lodash": "^4.14.175",
"@types/mapbox-gl": "^2.6.0",
"@types/node": "^14.0.0",
"@typescript-eslint/eslint-plugin": "4.23.0",
"@typescript-eslint/parser": "4.23.0",
"eslint": "^7.32.0",
Expand Down
5 changes: 4 additions & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@
>
<mat-icon>arrow_back</mat-icon> <span translate>action.return</span>
</button>
<div class="detail-from-bottom" *ngIf="mode === 'details' && (fountainSelectorObservable | async) !== null">
<div
class="detail-from-bottom"
*ngIf="mode === 'details' && (fountainSelectorObservable | async) !== undefined"
>
<div class="centering">
<button mat-mini-fab color="basic" (click)="returnToMap()" class="mat-elevation-z4">
<mat-icon>close</mat-icon>
Expand Down
29 changes: 13 additions & 16 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import { IssueService } from './issues/issue.service';
import { SubscriptionService } from './core/subscription.service';
import { LayoutService } from './core/layout.service';
import { FountainService } from './fountain/fountain.service';
import { of } from 'rxjs';
import { MatSidenav } from '@angular/material/sidenav';
import { filterUndefined } from './shared/ObservableExtensions';

@Component({
selector: 'app-root',
Expand Down Expand Up @@ -109,24 +109,21 @@ export class AppComponent implements OnInit {
}
}),
this.fountainService.selectedProperty
.switchMap(p => {
if (p !== null) {
if (!this.propertyDialogIsOpen) {
this.propertyDialog = this.dialog.open(FountainPropertyDialogComponent, {
maxWidth: 1000,
width: '800px',
});
this.propertyDialogIsOpen = true;
}
return this.propertyDialog.afterClosed().tap(() => {
this.fountainService.deselectProperty();
this.propertyDialogIsOpen = false;
.pipe(filterUndefined())
.switchMap(_ => {
if (!this.propertyDialogIsOpen) {
this.propertyDialog = this.dialog.open(FountainPropertyDialogComponent, {
maxWidth: 1000,
width: '800px',
});
} else {
return of(undefined);
this.propertyDialogIsOpen = true;
}
return this.propertyDialog.afterClosed().tap(() => {
this.fountainService.deselectProperty();
this.propertyDialogIsOpen = false;
});
})
.subscribe(_ => undefined /* nothing to do in addition as side effect happens in tap */)
.subscribe(_ => undefined /* nothing to do in addition as side effect happens in switchMap and tap */)
);

// intro dialog for
Expand Down
4 changes: 2 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import { LayoutService } from './core/layout.service';
import { DirectionsService } from './directions/directions.service';
import { FountainService } from './fountain/fountain.service';
import { ConfigBasedParserService } from './core/config-based-parser.service';
import { CityService } from './city/city.service';
import { MapService } from './city/map.service';
import { CitySelectorComponent } from './city/city-selector.component';
import { LanguageSelectorComponent } from './core/language-selector.component';

Expand Down Expand Up @@ -149,7 +149,7 @@ import { LanguageSelectorComponent } from './core/language-selector.component';
LayoutService,
DirectionsService,
FountainService,
CityService,
MapService,
ConfigBasedParserService,
],
bootstrap: [AppComponent],
Expand Down
1 change: 1 addition & 0 deletions src/app/city/city-selector.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
[options]="cities"
[valueObservable]="cityObservable"
[changeHook]="changeCity.bind(this)"
pleaseSelectKey="selectCity"
></app-select>
10 changes: 3 additions & 7 deletions src/app/city/city-selector.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Observable } from 'rxjs';
import { LayoutService } from '../core/layout.service';
import { DataService } from '../data.service';
import { City } from '../locations';
import { CityService } from './city.service';
import { MapService } from './map.service';

@Component({
selector: 'app-city-selector',
Expand All @@ -13,14 +13,10 @@ import { CityService } from './city.service';
export class CitySelectorComponent {
@Input() tooltipText!: string;

constructor(
private dataService: DataService,
private cityService: CityService,
private layoutService: LayoutService
) {}
constructor(private dataService: DataService, private mapService: MapService, private layoutService: LayoutService) {}

public cities: City[] = this.dataService.getLocationMetadata()[1];
public cityObservable: Observable<City | undefined> = this.cityService.city;
public cityObservable: Observable<City | undefined> = this.mapService.city;

changeCity(city: City): void {
this.layoutService.flyToCity(city);
Expand Down
103 changes: 0 additions & 103 deletions src/app/city/city.service.ts

This file was deleted.

Loading

0 comments on commit b3315db

Please sign in to comment.