Browse Source

Refactor `tb-logo` inputs for consistency (`logoUrl` to `link`, `logoSrc` to `src`).

pull/14057/head
deaflynx 11 months ago
parent
commit
f2c5f5aadf
  1. 2
      ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.html
  2. 4
      ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts
  3. 2
      ui-ngx/src/app/modules/home/home.component.html
  4. 4
      ui-ngx/src/app/shared/components/logo.component.html
  5. 8
      ui-ngx/src/app/shared/components/logo.component.ts

2
ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.html

@ -74,7 +74,7 @@
{{'dashboard.states-short' | translate}} {{'dashboard.states-short' | translate}}
</button> </button>
</ng-container> </ng-container>
<tb-logo *ngIf="showDashboardLogo()" [logoUrl]="dashboardLogoUrl" [logoSrc]="dashboardLogo | image | async" class="dashboard_logo"></tb-logo> <tb-logo *ngIf="showDashboardLogo()" [link]="dashboardLogoLink" [src]="dashboardLogo | image | async" class="dashboard_logo"></tb-logo>
</div> </div>
<div class="tb-dashboard-action-panel"> <div class="tb-dashboard-action-panel">
<button [class.!hidden]="!showCloseToolbar()" mat-icon-button class="close-action" <button [class.!hidden]="!showCloseToolbar()" mat-icon-button class="close-action"

4
ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts

@ -272,7 +272,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
{width: '100%', height: '100%', maxWidth: '100%', minWidth: '100%'}; {width: '100%', height: '100%', maxWidth: '100%', minWidth: '100%'};
rightLayoutSize: {width: string; height: string} = {width: '100%', height: '100%'}; rightLayoutSize: {width: string; height: string} = {width: '100%', height: '100%'};
dashboardLogoUrl = this.getDashboardLogoUrl(); dashboardLogoLink = this.getDashboardLogoLink();
private dashboardLogoCache: SafeUrl; private dashboardLogoCache: SafeUrl;
private defaultDashboardLogo = 'assets/logo_title_white.svg'; private defaultDashboardLogo = 'assets/logo_title_white.svg';
@ -1829,7 +1829,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
return false; return false;
} }
private getDashboardLogoUrl(): UrlTree { private getDashboardLogoLink(): UrlTree {
return this.forceFullscreen ? null : this.router.createUrlTree([], {relativeTo: this.route}); return this.forceFullscreen ? null : this.router.createUrlTree([], {relativeTo: this.route});
} }
} }

2
ui-ngx/src/app/modules/home/home.component.html

@ -24,7 +24,7 @@
<header class="tb-nav-header"> <header class="tb-nav-header">
<mat-toolbar color="primary" class="tb-nav-header-toolbar"> <mat-toolbar color="primary" class="tb-nav-header-toolbar">
<div class="flex flex-auto"> <div class="flex flex-auto">
<tb-logo [logoSrc]="logo" class="tb-logo-title"></tb-logo> <tb-logo [src]="logo" class="tb-logo-title"></tb-logo>
</div> </div>
</mat-toolbar> </mat-toolbar>
</header> </header>

4
ui-ngx/src/app/shared/components/logo.component.html

@ -20,12 +20,12 @@
<ng-container *ngTemplateOutlet="logo"></ng-container> <ng-container *ngTemplateOutlet="logo"></ng-container>
</a> </a>
} @else { } @else {
<a [routerLink]="logoUrl"> <a [routerLink]="link">
<ng-container *ngTemplateOutlet="logo"></ng-container> <ng-container *ngTemplateOutlet="logo"></ng-container>
</a> </a>
} }
<ng-template #logo> <ng-template #logo>
<img [src]="logoSrc" aria-label="logo" alt="Logo"/> <img [src]="src" aria-label="logo" alt="Logo"/>
</ng-template> </ng-template>

8
ui-ngx/src/app/shared/components/logo.component.ts

@ -35,19 +35,19 @@ export class LogoComponent implements OnInit {
isLogin: boolean = false; isLogin: boolean = false;
@Input() @Input()
logoSrc: string | UrlHolder = 'assets/logo_title_white.svg'; src: string | UrlHolder = 'assets/logo_title_white.svg';
@Input() @Input()
logoUrl: string | UrlTree; link: string | UrlTree;
constructor(private authService: AuthService, constructor(private authService: AuthService,
private store: Store<AppState>) { private store: Store<AppState>) {
} }
ngOnInit() { ngOnInit() {
if (!this.isLogin && !this.logoUrl) { if (!this.isLogin && !this.link) {
const authState = getCurrentAuthState(this.store); const authState = getCurrentAuthState(this.store);
this.logoUrl = this.authService.defaultUrl(true, authState); this.link = this.authService.defaultUrl(true, authState);
} }
} }
} }

Loading…
Cancel
Save