Browse Source

feat(client): convert summary to signal

pull/6926/head
KenTandrian 3 days ago
parent
commit
de666b48ea
  1. 8
      apps/client/src/app/components/home-summary/home-summary.component.ts
  2. 2
      apps/client/src/app/components/home-summary/home-summary.html

8
apps/client/src/app/components/home-summary/home-summary.component.ts

@ -33,7 +33,7 @@ export class GfHomeSummaryComponent implements OnInit {
protected readonly hasImpersonationId = signal<boolean>(false); protected readonly hasImpersonationId = signal<boolean>(false);
protected hasPermissionToUpdateUserSettings: boolean; protected hasPermissionToUpdateUserSettings: boolean;
protected readonly isLoading = signal(true); protected readonly isLoading = signal(true);
protected summary: PortfolioSummary; protected readonly summary = signal<PortfolioSummary | undefined>(undefined);
protected user: User; protected user: User;
private readonly changeDetectorRef = inject(ChangeDetectorRef); private readonly changeDetectorRef = inject(ChangeDetectorRef);
@ -95,14 +95,10 @@ export class GfHomeSummaryComponent implements OnInit {
.pipe(takeUntilDestroyed(this.destroyRef)) .pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(({ summary }) => { .subscribe(({ summary }) => {
if (summary) { if (summary) {
this.summary = summary; this.summary.set(summary);
} }
this.isLoading.set(false); this.isLoading.set(false);
this.changeDetectorRef.markForCheck();
}); });
this.changeDetectorRef.markForCheck();
} }
} }

2
apps/client/src/app/components/home-summary/home-summary.html

@ -14,7 +14,7 @@
[isLoading]="isLoading()" [isLoading]="isLoading()"
[language]="user?.settings?.language" [language]="user?.settings?.language"
[locale]="user?.settings?.locale" [locale]="user?.settings?.locale"
[summary]="summary" [summary]="summary()"
[user]="user" [user]="user"
(emergencyFundChanged)="onChangeEmergencyFund($event)" (emergencyFundChanged)="onChangeEmergencyFund($event)"
/> />

Loading…
Cancel
Save