mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-08-02 20:42:24 +00:00
feat: hide side nav when opening route or changing project
This commit is contained in:
parent
1e133e30b0
commit
e65bc2e245
1 changed files with 18 additions and 20 deletions
|
|
@ -2,6 +2,7 @@ import {Injectable} from '@angular/core';
|
|||
import {
|
||||
hideAddTaskBar,
|
||||
hideNotes,
|
||||
hideSideNav,
|
||||
showAddTaskBar,
|
||||
toggleAddTaskBar,
|
||||
toggleShowNotes,
|
||||
|
|
@ -10,10 +11,10 @@ import {
|
|||
import {merge, Observable, of} from 'rxjs';
|
||||
import {select, Store} from '@ngrx/store';
|
||||
import {LayoutState, selectIsShowAddTaskBar, selectIsShowNotes, selectIsShowSideNav} from './store/layout.reducer';
|
||||
import {filter, map, switchMap, tap, withLatestFrom} from 'rxjs/operators';
|
||||
import {filter, map, switchMap, withLatestFrom} from 'rxjs/operators';
|
||||
import {BreakpointObserver} from '@angular/cdk/layout';
|
||||
import {NoteService} from '../../features/note/note.service';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {ActivatedRoute, NavigationStart, Router} from '@angular/router';
|
||||
import {ProjectService} from '../../features/project/project.service';
|
||||
|
||||
const BOTH__ALWAYS_VISIBLE = 1400;
|
||||
|
|
@ -74,23 +75,20 @@ export class LayoutService {
|
|||
private _projectService: ProjectService,
|
||||
private _breakPointObserver: BreakpointObserver,
|
||||
) {
|
||||
// this.isNavOver$.pipe(
|
||||
// filter(v => v),
|
||||
// switchMap(() => merge(
|
||||
// // this._router.events.pipe(filter((ev)=> ev.)),
|
||||
// this._activatedRoute.params,
|
||||
// this._projectService.onProjectChange$
|
||||
// ).pipe(
|
||||
// withLatestFrom(
|
||||
// this._isShowSideNav$,
|
||||
// ),
|
||||
// tap((v) => console.log(v)),
|
||||
// filter(([url, isShowSideNav]) => isShowSideNav),
|
||||
// ))
|
||||
// ).subscribe(([url]) => {
|
||||
// console.log(url);
|
||||
// this.toggleSideNav();
|
||||
// });
|
||||
this.isNavOver$.pipe(
|
||||
filter(v => v),
|
||||
switchMap(() => merge(
|
||||
this._router.events.pipe(
|
||||
filter((ev) => ev instanceof NavigationStart)
|
||||
),
|
||||
this._projectService.onProjectChange$
|
||||
).pipe(
|
||||
withLatestFrom(this._isShowSideNav$),
|
||||
filter(([, isShowSideNav]) => isShowSideNav),
|
||||
))
|
||||
).subscribe(() => {
|
||||
this.hideSideNav();
|
||||
});
|
||||
}
|
||||
|
||||
showAddTaskBar() {
|
||||
|
|
@ -110,7 +108,7 @@ export class LayoutService {
|
|||
}
|
||||
|
||||
hideSideNav() {
|
||||
this._store$.dispatch(toggleSideNav());
|
||||
this._store$.dispatch(hideSideNav());
|
||||
}
|
||||
|
||||
public toggleNotes() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue