From 3ee2b387ae5ac15954bfee89e8cc857f37370b0b Mon Sep 17 00:00:00 2001 From: Bartosz Sekula Date: Fri, 26 May 2023 12:22:10 +0200 Subject: [PATCH] [AAE-14030] Fix header custom color (#8595) --- lib/core/src/lib/app-config/app-config.service.ts | 6 +++--- .../layout/components/header/header.component.ts | 14 +++++--------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/core/src/lib/app-config/app-config.service.ts b/lib/core/src/lib/app-config/app-config.service.ts index 47d8c453fd..03faa4fb6c 100644 --- a/lib/core/src/lib/app-config/app-config.service.ts +++ b/lib/core/src/lib/app-config/app-config.service.ts @@ -18,7 +18,7 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { ObjectUtils } from '../common/utils/object-utils'; -import { Observable, ReplaySubject } from 'rxjs'; +import { Observable, Subject } from 'rxjs'; import { map, distinctUntilChanged, take } from 'rxjs/operators'; import { ExtensionConfig, ExtensionService, mergeObjects } from '@alfresco/adf-extensions'; import { OpenidConfiguration } from '../auth/interfaces/openid-configuration.interface'; @@ -70,11 +70,11 @@ export class AppConfigService { }; status: Status = Status.INIT; - protected onLoadSubject: ReplaySubject; + protected onLoadSubject: Subject; onLoad: Observable; constructor(protected http: HttpClient, protected extensionService: ExtensionService) { - this.onLoadSubject = new ReplaySubject(); + this.onLoadSubject = new Subject(); this.onLoad = this.onLoadSubject.asObservable(); extensionService.setup$.subscribe((config) => { diff --git a/lib/core/src/lib/layout/components/header/header.component.ts b/lib/core/src/lib/layout/components/header/header.component.ts index 532fed34ce..704069eed8 100644 --- a/lib/core/src/lib/layout/components/header/header.component.ts +++ b/lib/core/src/lib/layout/components/header/header.component.ts @@ -18,7 +18,6 @@ import { Component, Input, Output, EventEmitter, ViewEncapsulation, OnInit } from '@angular/core'; import { ThemePalette } from '@angular/material/core'; import { AppConfigService } from '../../../app-config/app-config.service'; -import { filter, take } from 'rxjs/operators'; @Component({ selector: 'adf-layout-header', @@ -64,14 +63,6 @@ export class HeaderLayoutComponent implements OnInit { constructor( private appConfigService: AppConfigService ) { - this.appConfigService.select('headerTextColor') - .pipe( - filter((textColor) => !!textColor), - take(1) - ) - .subscribe((textColor) => { - document.documentElement.style.setProperty('--theme-header-text-color', textColor); - }); } toggleMenu() { @@ -80,6 +71,11 @@ export class HeaderLayoutComponent implements OnInit { } ngOnInit() { + const textColor = this.appConfigService.get('headerTextColor'); + if (textColor) { + document.documentElement.style.setProperty('--theme-header-text-color', textColor); + } + if (!this.logo) { this.logo = './assets/images/logo.png'; }