From 1fec49fbc2fd590a515ec92091d77a438ed1431a Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Tue, 13 Feb 2024 19:44:17 +0100 Subject: [PATCH] Improve states (#3000) --- .../portfolio/fire/fire-page.component.ts | 19 ++++++++++--------- .../app/pages/portfolio/fire/fire-page.html | 10 +++++++++- .../fire-calculator.component.scss | 2 +- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/apps/client/src/app/pages/portfolio/fire/fire-page.component.ts b/apps/client/src/app/pages/portfolio/fire/fire-page.component.ts index 36f9f69fc..36bc385f6 100644 --- a/apps/client/src/app/pages/portfolio/fire/fire-page.component.ts +++ b/apps/client/src/app/pages/portfolio/fire/fire-page.component.ts @@ -48,11 +48,9 @@ export class FirePageComponent implements OnDestroy, OnInit { .fetchPortfolioDetails() .pipe(takeUntil(this.unsubscribeSubject)) .subscribe(({ summary }) => { - if (summary.cash === null || summary.currentValue === null) { - return; - } - - this.fireWealth = new Big(summary.fireWealth); + this.fireWealth = summary.fireWealth + ? new Big(summary.fireWealth) + : new Big(10000); this.withdrawalRatePerYear = this.fireWealth.mul(4).div(100); this.withdrawalRatePerMonth = this.withdrawalRatePerYear.div(12); @@ -94,10 +92,13 @@ export class FirePageComponent implements OnDestroy, OnInit { permissions.createOrder ); - this.hasPermissionToUpdateUserSettings = hasPermission( - this.user.permissions, - permissions.updateUserSettings - ); + this.hasPermissionToUpdateUserSettings = + this.user.subscription?.type === 'Basic' + ? false + : hasPermission( + this.user.permissions, + permissions.updateUserSettings + ); this.changeDetectorRef.markForCheck(); } diff --git a/apps/client/src/app/pages/portfolio/fire/fire-page.html b/apps/client/src/app/pages/portfolio/fire/fire-page.html index aa3c33a74..82f32d683 100644 --- a/apps/client/src/app/pages/portfolio/fire/fire-page.html +++ b/apps/client/src/app/pages/portfolio/fire/fire-page.html @@ -18,6 +18,10 @@ [fireWealth]="fireWealth?.toNumber()" [hasPermissionToUpdateUserSettings]="!hasImpersonationId && hasPermissionToUpdateUserSettings" [locale]="user?.settings?.locale" + [ngStyle]="{ + opacity: user?.subscription?.type === 'Basic' ? '0.67' : 'initial', + 'pointer-events': user?.subscription?.type === 'Basic' ? 'none' : 'initial' + }" [projectedTotalAmount]="user?.settings?.projectedTotalAmount" [retirementDate]="user?.settings?.retirementDate" [savingsRate]="user?.settings?.savingsRate" @@ -54,7 +58,11 @@ }" /> -