Hide buttons when no routing to sink
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma
2021-04-12 15:10:29 +02:00
parent cbf805e1ff
commit a6d3b208b0
6 changed files with 42 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
<div>
<div (click)="toggle($event)" class="rounded-circle menu-button hidden" [ngClass]="{'hidden':!user}">
<div (click)="toggle($event)" class="rounded-circle menu-button hidden" [ngClass]="{'hidden':!user || noContent}">
<span class="unread badge bg-info notification rounded-pill hidden" [ngClass]="{'hidden':unread==0}">{{unread}}</span>
<span i18n-title title="Notifications"><i class="fas fa-bell" [ngClass]="{'fa-bell-on':unread!=0}" aria-hidden="true"></i></span>
<div class="menu hidden" [ngClass]="{'hidden':!showMenu}">

View File

@@ -1,5 +1,5 @@
import { Component, OnInit, Input } from '@angular/core';
import { Component, OnInit, Input,AfterViewInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { IUser } from '../../models/user';
import {Store} from '@ngrx/store';
@@ -11,17 +11,26 @@ import * as appActions from '../../actions/app-common.actions';
templateUrl: './notification-menu.component.html',
styleUrls: ['./notification-menu.component.scss']
})
export class NotificationMenuComponent implements OnInit {
export class NotificationMenuComponent implements OnInit,AfterViewInit {
@Input() unread:number;
@Input() user:IUser;
@Input() showMenu:boolean;
public noContent: boolean = true;
constructor(private store: Store<appReducers.State>) { }
constructor(private store: Store<appReducers.State>, private route: ActivatedRoute) { }
ngOnInit(): void {
}
ngAfterViewInit() {
this.route.children.forEach((entry) => {
if(entry.outlet=="notification-menu") {
this.noContent=false;
}
});
}
toggle(event:MouseEvent) {
event.stopPropagation();
this.store.dispatch(new appActions.ToggleNotificationMenu());