diff --git a/src/app/layout/app.layout.component.ts b/src/app/layout/app.layout.component.ts index 6ffab31..e6a392e 100644 --- a/src/app/layout/app.layout.component.ts +++ b/src/app/layout/app.layout.component.ts @@ -1,7 +1,6 @@ import { Component, OnDestroy, Renderer2, ViewChild } from '@angular/core'; import { NavigationEnd, Router } from '@angular/router'; import { filter, Subscription } from 'rxjs'; -import { MenuService } from './app.menu.service'; import { LayoutService } from "./service/app.layout.service"; import { AppSidebarComponent } from "./app.sidebar.component"; import { AppTopBarComponent } from './app.topbar.component'; @@ -22,12 +21,12 @@ export class AppLayoutComponent implements OnDestroy { @ViewChild(AppTopBarComponent) appTopbar!: AppTopBarComponent; - constructor(private menuService: MenuService, public layoutService: LayoutService, public renderer: Renderer2, public router: Router) { + constructor(public layoutService: LayoutService, public renderer: Renderer2, public router: Router) { this.overlayMenuOpenSubscription = this.layoutService.overlayOpen$.subscribe(() => { if (!this.menuOutsideClickListener) { this.menuOutsideClickListener = this.renderer.listen('document', 'click', event => { const isOutsideClicked = !(this.appSidebar.el.nativeElement.isSameNode(event.target) || this.appSidebar.el.nativeElement.contains(event.target) - || event.target.classList.contains('p-trigger') || event.target.parentNode.classList.contains('p-trigger')); + || this.appTopbar.menuButton.nativeElement.isSameNode(event.target) || this.appTopbar.menuButton.nativeElement.contains(event.target)); if (isOutsideClicked) { this.hideMenu(); @@ -38,7 +37,7 @@ export class AppLayoutComponent implements OnDestroy { if (!this.profileMenuOutsideClickListener) { this.profileMenuOutsideClickListener = this.renderer.listen('document', 'click', event => { const isOutsideClicked = !(this.appTopbar.menu.nativeElement.isSameNode(event.target) || this.appTopbar.menu.nativeElement.contains(event.target) - || event.target.classList.contains('p-trigger') || event.target.parentNode.classList.contains('p-trigger')); + || this.appTopbar.topbarMenuButton.nativeElement.isSameNode(event.target) || this.appTopbar.topbarMenuButton.nativeElement.contains(event.target)); if (isOutsideClicked) { this.hideProfileMenu(); diff --git a/src/app/layout/app.topbar.component.html b/src/app/layout/app.topbar.component.html index efc269a..c748da9 100644 --- a/src/app/layout/app.topbar.component.html +++ b/src/app/layout/app.topbar.component.html @@ -4,15 +4,15 @@ SAKAI - - -
+