close navbar on a selection

This commit is contained in:
Chneemann 2024-05-17 20:19:32 +02:00
parent 4b940d046f
commit 809a9766d0
3 changed files with 6 additions and 4 deletions

View file

@ -87,7 +87,7 @@
</div>
</div>
</div>
} @if (isMobileNavbarOpen) {
} @if (sharedService.isMobileNavbarOpen) {
<app-contact-nav
[deleteContact]="deleteContact"
[openEditDialog]="openEditDialog"

View file

@ -24,8 +24,6 @@ import { TranslateModule } from '@ngx-translate/core';
export class ContactDetailComponent {
@Input() currentUserId!: string | undefined;
isMobileNavbarOpen: boolean = false;
constructor(
private router: Router,
public sharedService: SharedService,
@ -44,17 +42,20 @@ export class ContactDetailComponent {
}
toggleNav() {
this.isMobileNavbarOpen = !this.isMobileNavbarOpen;
this.sharedService.isMobileNavbarOpen =
!this.sharedService.isMobileNavbarOpen;
}
openEditDialog() {
this.sharedService.isAnyDialogOpen = true;
this.sharedService.isEditContactDialogOpen = true;
this.sharedService.isMobileNavbarOpen = false;
}
deleteContact() {
this.sharedService.isAnyDialogOpen = true;
this.sharedService.isDeleteContactDialogOpen = true;
this.sharedService.isMobileNavbarOpen = false;
}
convertTimestamp(timestamp: number) {

View file

@ -6,6 +6,7 @@ import { Injectable } from '@angular/core';
export class SharedService {
isBtnDisabled: boolean = false;
isAnyDialogOpen: boolean = false;
isMobileNavbarOpen: boolean = false;
isEditContactDialogOpen: boolean = false;
isDeleteContactDialogOpen: boolean = false;
isPageViewMedia: boolean = window.innerWidth <= 650;