From 37545606a09b21341776361b3d0e13e7be503608 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Mon, 12 Dec 2022 16:16:47 +0200 Subject: [PATCH] Fix a bug with replace header in navbar. Page content add header and actions class in order to handle border bottom in tabs --- .../page-content/page-content.component.ts | 12 ++++++++---- .../sharedComponents/sidebar/layout.service.ts | 4 ++++ sharedComponents/navigationBar.component.ts | 18 ++++++++++++++---- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/dashboard/sharedComponents/page-content/page-content.component.ts b/dashboard/sharedComponents/page-content/page-content.component.ts index 02451c54..6ba03726 100644 --- a/dashboard/sharedComponents/page-content/page-content.component.ts +++ b/dashboard/sharedComponents/page-content/page-content.component.ts @@ -30,16 +30,20 @@ declare var ResizeObserver; [attr.uk-sticky]="(headerSticky && shouldSticky)?'media: @m':null" [attr.offset]="offset" [attr.style]="'margin-top: '+(footer_height? '-'+footer_height+'px': '0')">
-
- +
+
+ +
-
- +
+
+ +
diff --git a/dashboard/sharedComponents/sidebar/layout.service.ts b/dashboard/sharedComponents/sidebar/layout.service.ts index 569f1dd4..f39048df 100644 --- a/dashboard/sharedComponents/sidebar/layout.service.ts +++ b/dashboard/sharedComponents/sidebar/layout.service.ts @@ -208,6 +208,10 @@ export class LayoutService { return this.replaceHeaderSubject.asObservable(); } + get replaceHeaderValue(): boolean { + return this.replaceHeaderSubject.getValue(); + } + setReplaceHeader(value: boolean) { this.replaceHeaderSubject.next(value); } diff --git a/sharedComponents/navigationBar.component.ts b/sharedComponents/navigationBar.component.ts index 6c6d9026..a24eb2d0 100644 --- a/sharedComponents/navigationBar.component.ts +++ b/sharedComponents/navigationBar.component.ts @@ -1,4 +1,4 @@ -import {Component, Input, OnDestroy, OnInit} from '@angular/core'; +import {ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {Session, User} from '../login/utils/helper.class'; import {ConfigurationService} from '../utils/configuration/configuration.service'; @@ -29,7 +29,7 @@ export interface Header { selector: 'navbar', templateUrl: 'navigationBar.component.html' }) -export class NavigationBarComponent implements OnInit, OnDestroy { +export class NavigationBarComponent implements OnInit, OnDestroy, OnChanges { @Input() portal: string = 'connect'; @Input() onlyTop: boolean = false; @Input() logoPath: string = 'assets/common-assets/'; @@ -77,6 +77,12 @@ export class NavigationBarComponent implements OnInit, OnDestroy { sub.unsubscribe(); } } + + ngOnChanges(changes: SimpleChanges) { + if(changes.header) { + this.setHeader(this.layoutService.replaceHeaderValue); + } + } closeCanvas(element) { UIkit.offcanvas(element).hide(); @@ -135,11 +141,15 @@ export class NavigationBarComponent implements OnInit, OnDestroy { ); } this.subs.push(this.layoutService.replaceHeader.subscribe(replaceHeader => { - this.replaceHeader = this.header.replaceHeader && replaceHeader; - this.activeHeader = this.replaceHeader?this.header.replaceHeader:this.header; + this.setHeader(replaceHeader); })); } + setHeader(replaceHeader: boolean) { + this.replaceHeader = this.header.replaceHeader && replaceHeader; + this.activeHeader = this.replaceHeader?this.header.replaceHeader:this.header; + } + isEnabled(required, enabled) { if (!required) { return true;