Browse Source

feat(client): migrate isLoading to input signal

pull/7265/head
KenTandrian 1 week ago
parent
commit
9c4a037ddf
  1. 10
      apps/client/src/app/components/portfolio-performance/portfolio-performance.component.html
  2. 4
      apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts

10
apps/client/src/app/components/portfolio-performance/portfolio-performance.component.html

@ -1,7 +1,7 @@
<div class="container p-0">
<div class="no-gutters row">
<div class="status-container text-muted text-right">
@if (errors()?.length > 0 && !isLoading) {
@if (errors()?.length > 0 && !isLoading()) {
<ion-icon
i18n-title
name="time-outline"
@ -10,7 +10,7 @@
/>
}
</div>
@if (isLoading) {
@if (isLoading()) {
<div class="align-items-center d-flex">
<ngx-skeleton-loader
animation="pulse"
@ -24,7 +24,7 @@
}
<div
class="display-4 font-weight-bold m-0 text-center value-container"
[hidden]="isLoading"
[hidden]="isLoading()"
>
<span #value id="value"></span>
</div>
@ -40,7 +40,7 @@
[isCurrency]="true"
[locale]="locale"
[value]="
isLoading
isLoading()
? undefined
: performance?.netPerformanceWithCurrencyEffect
"
@ -52,7 +52,7 @@
[isPercent]="true"
[locale]="locale"
[value]="
isLoading
isLoading()
? undefined
: performance?.netPerformancePercentageWithCurrencyEffect
"

4
apps/client/src/app/components/portfolio-performance/portfolio-performance.component.ts

@ -35,7 +35,6 @@ import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
templateUrl: './portfolio-performance.component.html'
})
export class GfPortfolioPerformanceComponent implements OnChanges {
@Input() isLoading: boolean;
@Input() locale = getLocale();
@Input() performance: PortfolioPerformance;
@Input() precision: number;
@ -43,6 +42,7 @@ export class GfPortfolioPerformanceComponent implements OnChanges {
@Input() unit: string;
public readonly errors = input<ResponseError['errors']>();
public readonly isLoading = input<boolean>();
private readonly value =
viewChild.required<ElementRef<HTMLSpanElement>>('value');
@ -56,7 +56,7 @@ export class GfPortfolioPerformanceComponent implements OnChanges {
public ngOnChanges() {
this.precision = this.precision >= 0 ? this.precision : 2;
if (this.isLoading) {
if (this.isLoading()) {
if (this.value().nativeElement) {
this.value().nativeElement.innerHTML = '';
}

Loading…
Cancel
Save