Skip to content

Commit

Permalink
[#1182] Fix modal display on live mode exit
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkryska committed Jul 21, 2021
1 parent 236dceb commit 63d3632
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {SceneStore} from './scene.store.service';
import {SceneQuery} from './scene.query';
import environment from '../../../../../environments/environment';
import {interval, Subscription} from 'rxjs';
import {compareSegments} from '@angular/compiler-cli/src/ngtsc/sourcemaps/src/segment_marker';

@Injectable({providedIn: 'root'})
export class TimelineService {
Expand Down Expand Up @@ -53,9 +54,10 @@ export class TimelineService {
this._sceneStore.setLoading(false);
}

async confirmTurningOfLiveMode(): Promise<boolean> {
this._sceneStore.setLoading(true);
async confirmTurningOffLiveMode(): Promise<boolean> {
console.trace();

this._sceneStore.setLoading(true);
const isLiveMode = this._sceneQuery.getValue().isLiveMode;
if (!isLiveMode) {
this._sceneStore.setLoading(false);
Expand Down
26 changes: 10 additions & 16 deletions s4e-web/src/app/views/map-view/timeline/timeline.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {
of,
ReplaySubject
} from 'rxjs';
import {map, switchMap, tap} from 'rxjs/operators';
import {map, skip, switchMap, tap} from 'rxjs/operators';
import {Scene, SceneWithUI} from '../state/scene/scene.model';
import {yyyymmdd} from '../../../utils/miscellaneous/date-utils';
import {AkitaGuidService} from '../state/search-results/guid.service';
Expand Down Expand Up @@ -191,10 +191,9 @@ export class TimelineComponent
}

datepickerFc = new FormControl<Date>();

@Input('currentDate') set _currentDate(v: string) {
this.currentDate = v;
this.datepickerFc.setValue(new Date(v), {emitEvent: false});
this.datepickerFc.setValue(new Date(v), {emitEvent: false, onlySelf: true});
}

bsDatePickerUtils!: BsDatePickerUtils;
Expand All @@ -221,16 +220,11 @@ export class TimelineComponent
}

async selectDate(date: Date) {
const turnOfLiveMode = await this.timelineService.confirmTurningOfLiveMode();
if (!turnOfLiveMode || date == null) {
return;
}

this.dateSelected.emit(yyyymmdd(date));
}

async goToPreviousDay() {
const turnOfLiveMode = await this.timelineService.confirmTurningOfLiveMode();
const turnOfLiveMode = await this.timelineService.confirmTurningOffLiveMode();
if (!turnOfLiveMode) {
return;
}
Expand All @@ -239,7 +233,7 @@ export class TimelineComponent
}

async goToNextDay() {
const turnOfLiveMode = await this.timelineService.confirmTurningOfLiveMode();
const turnOfLiveMode = await this.timelineService.confirmTurningOffLiveMode();
if (!turnOfLiveMode) {
return;
}
Expand All @@ -248,7 +242,7 @@ export class TimelineComponent
}

async goToPreviousScene() {
const turnOfLiveMode = await this.timelineService.confirmTurningOfLiveMode();
const turnOfLiveMode = await this.timelineService.confirmTurningOffLiveMode();
if (!turnOfLiveMode) {
return;
}
Expand All @@ -257,7 +251,7 @@ export class TimelineComponent
}

async goToNextScene() {
const turnOfLiveMode = await this.timelineService.confirmTurningOfLiveMode();
const turnOfLiveMode = await this.timelineService.confirmTurningOffLiveMode();
if (!turnOfLiveMode) {
return;
}
Expand All @@ -267,7 +261,7 @@ export class TimelineComponent

async setPickerOpenState(open: boolean) {
if (open) {
const turnOfLiveMode = await this.timelineService.confirmTurningOfLiveMode();
const turnOfLiveMode = await this.timelineService.confirmTurningOffLiveMode();
if (!turnOfLiveMode) {
return;
}
Expand All @@ -278,7 +272,7 @@ export class TimelineComponent
}

async selectScene(scene: Scene) {
const turnOfLiveMode = await this.timelineService.confirmTurningOfLiveMode();
const turnOfLiveMode = await this.timelineService.confirmTurningOffLiveMode();
if (!turnOfLiveMode) {
return;
}
Expand All @@ -288,7 +282,7 @@ export class TimelineComponent
}

async goToLastAvailableScene() {
const turnOfLiveMode = await this.timelineService.confirmTurningOfLiveMode();
const turnOfLiveMode = await this.timelineService.confirmTurningOffLiveMode();
if (!turnOfLiveMode) {
return;
}
Expand All @@ -313,7 +307,7 @@ export class TimelineComponent
this.hourmarks.length < TimelineComponent.HOURMARKS_COUNT;
i += this.resolution / TimelineComponent.HOURMARKS_COUNT
) {
let date = moment(this.startTime);
const date = moment(this.startTime);
date.add(i, 'hours');
this.hourmarks.push(date.format('HH:mm'));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('ViewManagerComponent', () => {
const product = ProductFactory.build();
productStore.set([product]);
const spy = spyOn(productService, 'setActive$').and.returnValue(of());
spyOn(timelineService, 'confirmTurningOfLiveMode').and.returnValue(
spyOn(timelineService, 'confirmTurningOffLiveMode').and.returnValue(
of(true).toPromise()
);
await component.selectProduct(product.id);
Expand All @@ -71,7 +71,7 @@ describe('ViewManagerComponent', () => {
productStore.set([product]);
productStore.setActive(product.id);
const spy = spyOn(productService, 'setActive$').and.returnValue(of());
spyOn(timelineService, 'confirmTurningOfLiveMode').and.returnValue(
spyOn(timelineService, 'confirmTurningOffLiveMode').and.returnValue(
of(true).toPromise()
);
await component.selectProduct(product.id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export class ViewManagerComponent implements OnInit, OnDestroy {
}

async selectProduct(productId: number) {
const turnOfLiveMode = await this.timelineService.confirmTurningOfLiveMode();
const turnOfLiveMode = await this.timelineService.confirmTurningOffLiveMode();
if (!turnOfLiveMode) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion s4e-web/src/scss/_datepicker.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

bs-datepicker-container {
z-index: 20000;
z-index: 3;
}

.bs-datepicker.theme-blank {
Expand Down

0 comments on commit 63d3632

Please sign in to comment.