fix(console): header image fallback (#3735)

fix: fallback icon in header

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
Max Peintner 2022-05-31 09:14:52 +02:00 committed by GitHub
parent f9e9b4b64b
commit 47feced1cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -10,20 +10,20 @@
alt="home logo" alt="home logo"
*ngIf="isDarkTheme; else customlighttheme" *ngIf="isDarkTheme; else customlighttheme"
[src]="labelpolicy?.iconUrlDark ? labelpolicy.iconUrlDark : './assets/images/zitadel-logo-solo-light.svg'" [src]="labelpolicy?.iconUrlDark ? labelpolicy.iconUrlDark : './assets/images/zitadel-logo-solo-light.svg'"
onerror="this.src='./assets/images/zitadel-logo-solo-light.svg';this.onerror='';" (error)="errorHandler($event, './assets/images/zitadel-logo-solo-light.svg')"
/> />
<ng-template #customlighttheme> <ng-template #customlighttheme>
<img <img
alt="home logo" alt="home logo"
class="logo" class="logo"
[src]="labelpolicy?.iconUrl ? labelpolicy.iconUrl : './assets/images/zitadel-logo-solo-dark.svg'" [src]="labelpolicy?.iconUrl ? labelpolicy.iconUrl : './assets/images/zitadel-logo-solo-dark.svg'"
onerror="this.src='./assets/images/zitadel-logo-solo-dark.svg';this.onerror='';" (error)="errorHandler($event, './assets/images/zitadel-logo-solo-dark.svg')"
/> />
</ng-template> </ng-template>
</a> </a>
<ng-template #defaultHome> <ng-template #defaultHome>
<a *ngIf="org" class="title" [routerLink]="['/']"> <a class="title" [routerLink]="['/']">
<img <img
class="logo" class="logo"
alt="zitadel logo" alt="zitadel logo"
@ -31,7 +31,7 @@
src="./assets/images/zitadel-logo-solo-light.svg" src="./assets/images/zitadel-logo-solo-light.svg"
/> />
<ng-template #lighttheme> <ng-template #lighttheme>
<img alt="zitadel logo" class="logo" src="../assets/images/zitadel-logo-solo-dark.svg" /> <img alt="zitadel logo" class="logo" src="./assets/images/zitadel-logo-solo-dark.svg" />
</ng-template> </ng-template>
</a> </a>
</ng-template> </ng-template>

View File

@ -67,6 +67,10 @@ export class HeaderComponent implements OnDestroy {
return this.router.url === '/users/me'; return this.router.url === '/users/me';
} }
public errorHandler(event: any, fallbackSrc: string) {
(event.target as HTMLImageElement).src = fallbackSrc;
}
public get isOnInstance(): boolean { public get isOnInstance(): boolean {
const pages: string[] = [ const pages: string[] = [
'/instance', '/instance',