[AAE-14030] Fix header custom color (#8595)

This commit is contained in:
Bartosz Sekula
2023-05-26 12:22:10 +02:00
committed by GitHub
parent fb3dee86bf
commit 3ee2b387ae
2 changed files with 8 additions and 12 deletions

View File

@@ -18,7 +18,7 @@
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { ObjectUtils } from '../common/utils/object-utils'; 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 { map, distinctUntilChanged, take } from 'rxjs/operators';
import { ExtensionConfig, ExtensionService, mergeObjects } from '@alfresco/adf-extensions'; import { ExtensionConfig, ExtensionService, mergeObjects } from '@alfresco/adf-extensions';
import { OpenidConfiguration } from '../auth/interfaces/openid-configuration.interface'; import { OpenidConfiguration } from '../auth/interfaces/openid-configuration.interface';
@@ -70,11 +70,11 @@ export class AppConfigService {
}; };
status: Status = Status.INIT; status: Status = Status.INIT;
protected onLoadSubject: ReplaySubject<any>; protected onLoadSubject: Subject<any>;
onLoad: Observable<any>; onLoad: Observable<any>;
constructor(protected http: HttpClient, protected extensionService: ExtensionService) { constructor(protected http: HttpClient, protected extensionService: ExtensionService) {
this.onLoadSubject = new ReplaySubject(); this.onLoadSubject = new Subject();
this.onLoad = this.onLoadSubject.asObservable(); this.onLoad = this.onLoadSubject.asObservable();
extensionService.setup$.subscribe((config) => { extensionService.setup$.subscribe((config) => {

View File

@@ -18,7 +18,6 @@
import { Component, Input, Output, EventEmitter, ViewEncapsulation, OnInit } from '@angular/core'; import { Component, Input, Output, EventEmitter, ViewEncapsulation, OnInit } from '@angular/core';
import { ThemePalette } from '@angular/material/core'; import { ThemePalette } from '@angular/material/core';
import { AppConfigService } from '../../../app-config/app-config.service'; import { AppConfigService } from '../../../app-config/app-config.service';
import { filter, take } from 'rxjs/operators';
@Component({ @Component({
selector: 'adf-layout-header', selector: 'adf-layout-header',
@@ -64,14 +63,6 @@ export class HeaderLayoutComponent implements OnInit {
constructor( constructor(
private appConfigService: AppConfigService 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() { toggleMenu() {
@@ -80,6 +71,11 @@ export class HeaderLayoutComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
const textColor = this.appConfigService.get<string | undefined>('headerTextColor');
if (textColor) {
document.documentElement.style.setProperty('--theme-header-text-color', textColor);
}
if (!this.logo) { if (!this.logo) {
this.logo = './assets/images/logo.png'; this.logo = './assets/images/logo.png';
} }