Browse Source

feat(client): migrate performance to input signal

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

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

@ -42,7 +42,7 @@
[value]=" [value]="
isLoading() isLoading()
? undefined ? undefined
: performance?.netPerformanceWithCurrencyEffect : performance().netPerformanceWithCurrencyEffect
" "
/> />
</div> </div>
@ -54,7 +54,7 @@
[value]=" [value]="
isLoading() isLoading()
? undefined ? undefined
: performance?.netPerformancePercentageWithCurrencyEffect : performance().netPerformancePercentageWithCurrencyEffect
" "
/> />
</div> </div>

8
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' templateUrl: './portfolio-performance.component.html'
}) })
export class GfPortfolioPerformanceComponent implements OnChanges { export class GfPortfolioPerformanceComponent implements OnChanges {
@Input() performance: PortfolioPerformance;
@Input() precision: number; @Input() precision: number;
@Input() showDetails: boolean; @Input() showDetails: boolean;
@Input() unit: string; @Input() unit: string;
@ -43,6 +42,7 @@ export class GfPortfolioPerformanceComponent implements OnChanges {
public readonly errors = input<ResponseError['errors']>(); public readonly errors = input<ResponseError['errors']>();
public readonly isLoading = input<boolean>(); public readonly isLoading = input<boolean>();
public readonly locale = input<string>(getLocale()); public readonly locale = input<string>(getLocale());
public readonly performance = input.required<PortfolioPerformance>();
private readonly value = private readonly value =
viewChild.required<ElementRef<HTMLSpanElement>>('value'); viewChild.required<ElementRef<HTMLSpanElement>>('value');
@ -61,8 +61,8 @@ export class GfPortfolioPerformanceComponent implements OnChanges {
this.value().nativeElement.innerHTML = ''; this.value().nativeElement.innerHTML = '';
} }
} else { } else {
if (isNumber(this.performance?.currentValueInBaseCurrency)) { if (isNumber(this.performance().currentValueInBaseCurrency)) {
new CountUp('value', this.performance?.currentValueInBaseCurrency, { new CountUp('value', this.performance().currentValueInBaseCurrency, {
decimal: getNumberFormatDecimal(this.locale()), decimal: getNumberFormatDecimal(this.locale()),
decimalPlaces: this.precision, decimalPlaces: this.precision,
duration: 1, duration: 1,
@ -71,7 +71,7 @@ export class GfPortfolioPerformanceComponent implements OnChanges {
} else if (this.showDetails === false) { } else if (this.showDetails === false) {
new CountUp( new CountUp(
'value', 'value',
this.performance?.netPerformancePercentageWithCurrencyEffect * 100, this.performance().netPerformancePercentageWithCurrencyEffect * 100,
{ {
decimal: getNumberFormatDecimal(this.locale()), decimal: getNumberFormatDecimal(this.locale()),
decimalPlaces: 2, decimalPlaces: 2,

Loading…
Cancel
Save