|
|
@ -14,22 +14,35 @@ |
|
|
/// limitations under the License.
|
|
|
/// limitations under the License.
|
|
|
///
|
|
|
///
|
|
|
|
|
|
|
|
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core'; |
|
|
import { |
|
|
|
|
|
ChangeDetectionStrategy, |
|
|
|
|
|
ChangeDetectorRef, |
|
|
|
|
|
Component, DestroyRef, |
|
|
|
|
|
effect, |
|
|
|
|
|
EventEmitter, |
|
|
|
|
|
OnInit, |
|
|
|
|
|
viewChild |
|
|
|
|
|
} from '@angular/core'; |
|
|
import { MenuService } from '@core/services/menu.service'; |
|
|
import { MenuService } from '@core/services/menu.service'; |
|
|
import { BreakpointObserver, BreakpointState } from '@angular/cdk/layout'; |
|
|
import { BreakpointObserver, BreakpointState } from '@angular/cdk/layout'; |
|
|
import { MediaBreakpoints } from '@shared/models/constants'; |
|
|
import { MediaBreakpoints } from '@shared/models/constants'; |
|
|
import { HomeSection } from '@core/services/menu.models'; |
|
|
import { HomeSection } from '@core/services/menu.models'; |
|
|
import { ActivatedRoute } from '@angular/router'; |
|
|
import { ActivatedRoute } from '@angular/router'; |
|
|
import { HomeDashboard } from '@shared/models/dashboard.models'; |
|
|
import { HomeDashboard } from '@shared/models/dashboard.models'; |
|
|
|
|
|
import { MainToolbarComponent } from '@home/models/main-toolbar.models'; |
|
|
|
|
|
import { DashboardPageComponent } from '@home/components/dashboard-page/dashboard-page.component'; |
|
|
|
|
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; |
|
|
|
|
|
|
|
|
@Component({ |
|
|
@Component({ |
|
|
selector: 'tb-home-links', |
|
|
selector: 'tb-home-links', |
|
|
templateUrl: './home-links.component.html', |
|
|
templateUrl: './home-links.component.html', |
|
|
styleUrls: ['./home-links.component.scss'], |
|
|
styleUrls: ['./home-links.component.scss'], |
|
|
changeDetection: ChangeDetectionStrategy.OnPush, |
|
|
changeDetection: ChangeDetectionStrategy.OnPush, |
|
|
standalone: false |
|
|
standalone: false |
|
|
}) |
|
|
}) |
|
|
export class HomeLinksComponent implements OnInit { |
|
|
export class HomeLinksComponent implements MainToolbarComponent, OnInit { |
|
|
|
|
|
|
|
|
|
|
|
private dashboardPage = viewChild<DashboardPageComponent>('dashboardPage'); |
|
|
|
|
|
|
|
|
homeSections$ = this.menuService.homeSections(); |
|
|
homeSections$ = this.menuService.homeSections(); |
|
|
|
|
|
|
|
|
@ -37,10 +50,25 @@ export class HomeLinksComponent implements OnInit { |
|
|
|
|
|
|
|
|
homeDashboard: HomeDashboard = this.route.snapshot.data.homeDashboard; |
|
|
homeDashboard: HomeDashboard = this.route.snapshot.data.homeDashboard; |
|
|
|
|
|
|
|
|
|
|
|
hideMainToolbar = false; |
|
|
|
|
|
toggleSideBar = new EventEmitter<void>(); |
|
|
|
|
|
|
|
|
constructor(private menuService: MenuService, |
|
|
constructor(private menuService: MenuService, |
|
|
public breakpointObserver: BreakpointObserver, |
|
|
public breakpointObserver: BreakpointObserver, |
|
|
private cd: ChangeDetectorRef, |
|
|
private cd: ChangeDetectorRef, |
|
|
private route: ActivatedRoute) { |
|
|
private route: ActivatedRoute, |
|
|
|
|
|
private destroyRef: DestroyRef) { |
|
|
|
|
|
effect(() => { |
|
|
|
|
|
const dashboardPage = this.dashboardPage(); |
|
|
|
|
|
if (dashboardPage) { |
|
|
|
|
|
dashboardPage.toggleSideBar.pipe( |
|
|
|
|
|
takeUntilDestroyed(this.destroyRef) |
|
|
|
|
|
).subscribe(() => { |
|
|
|
|
|
this.toggleSideBar.emit(); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
this.hideMainToolbar = (!!this.homeDashboard && !this.homeDashboard.isSystemDashboard); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
ngOnInit() { |
|
|
ngOnInit() { |
|
|
|