Skip to content

Commit

Permalink
Don't hide sidebar while on same page
Browse files Browse the repository at this point in the history
  • Loading branch information
cjmalloy committed Sep 12, 2024
1 parent a7a21a5 commit 70cc25c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/app/component/sidebar/sidebar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { AuthzService } from '../../service/authz.service';
import { ConfigService } from '../../service/config.service';
import { QueryStore } from '../../store/query';
import { Store } from '../../store/store';
import { View } from '../../store/view';
import { memo, MemoCache } from '../../util/memo';
import { hasPrefix, localTag, tagOrigin, topAnds } from '../../util/tag';

Expand Down Expand Up @@ -62,6 +63,7 @@ export class SidebarComponent implements OnInit, OnChanges, OnDestroy {
@HostBinding('class.expanded')
private _expanded = false;
private _ext?: Ext;
private lastView = this.store.view.current;

constructor(
public router: Router,
Expand All @@ -80,10 +82,12 @@ export class SidebarComponent implements OnInit, OnChanges, OnDestroy {
} else {
this.expanded = !!window.matchMedia('(min-width: 1024px)').matches;
}

router.events.pipe(
filter(event => event instanceof NavigationEnd),
).subscribe(() => {
if (this.config.mobile || this.store.view.current === 'ref/summary' && !window.matchMedia('(min-width: 1024px)').matches) {
if (this.config.mobile && this.lastView != this.store.view.current || this.store.view.current === 'ref/summary' && !window.matchMedia('(min-width: 1024px)').matches) {
this.lastView = this.store.view.current;
this.expanded = false;
}
});
Expand Down

0 comments on commit 70cc25c

Please sign in to comment.