create hasQuickContact behaviour subject for disabling in specific routes

This commit is contained in:
Alex Martzios 2022-10-12 15:30:39 +03:00
parent 09706515ba
commit 427e910514
1 changed files with 19 additions and 1 deletions

View File

@ -36,10 +36,14 @@ export class LayoutService {
* Add isSmallScreen: true on data of route config, if screen is small.
*/
private isSmallScreenSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
/**
* Add hasQuickContact: false on data of route config, if the quick-contact fixed button is not needed.
*/
private hasQuickContactSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(true);
/**
* Add activeMenuItem: string on data of route config, if page should activate a specific MenuItem and route url does not match.
*/
private activeMenuItemSubject: BehaviorSubject<string> = new BehaviorSubject<string>("");
/**
@ -100,6 +104,12 @@ export class LayoutService {
this.setSmallScreen(true);
} else {
this.setSmallScreen(false);
}
if (data['hasQuickContact'] !== undefined &&
data['hasQuickContact'] === false) {
this.setHasQuickContact(false);
} else {
this.setHasQuickContact(true);
}
if (data['activeMenuItem'] !== undefined &&
data['activeMenuItem'] !== null) {
@ -168,6 +178,14 @@ export class LayoutService {
this.isSmallScreenSubject.next(value);
}
get hasQuickContact(): Observable<boolean> {
return this.hasQuickContactSubject.asObservable();
}
setHasQuickContact(value: boolean) {
this.hasQuickContactSubject.next(value);
}
get activeMenuItem(): string {
return this.activeMenuItemSubject.getValue();
}