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}}
</button>
</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 class="tb-dashboard-action-panel">
<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%'};
rightLayoutSize: {width: string; height: string} = {width: '100%', height: '100%'};
dashboardLogoUrl = this.getDashboardLogoUrl();
dashboardLogoLink = this.getDashboardLogoLink();
private dashboardLogoCache: SafeUrl;
private defaultDashboardLogo = 'assets/logo_title_white.svg';
@ -1829,7 +1829,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
return false;
}
private getDashboardLogoUrl(): UrlTree {
private getDashboardLogoLink(): UrlTree {
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">
<mat-toolbar color="primary" class="tb-nav-header-toolbar">
<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>
</mat-toolbar>
</header>

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

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

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

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

Loading…
Cancel
Save