Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Task/improve type safety in pricing page component (#6806)

Kenrick Tandrian1daa672f27e2
diff --git a/apps/client/src/app/pages/pricing/pricing-page.component.ts b/apps/client/src/app/pages/pricing/pricing-page.component.ts
index 08c561fc8a..0b76fcd1d0 100644
--- a/apps/client/src/app/pages/pricing/pricing-page.component.ts
+++ b/apps/client/src/app/pages/pricing/pricing-page.component.ts
@@ -13,6 +13,7 @@ import {
Component,
CUSTOM_ELEMENTS_SCHEMA,
DestroyRef,
+ inject,
OnInit
} from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@@ -48,35 +49,28 @@ import { catchError } from 'rxjs/operators';
templateUrl: './pricing-page.html'
})
export class GfPricingPageComponent implements OnInit {
- public baseCurrency: string;
- public coupon: number;
- public couponId: string;
- public durationExtension: StringValue;
- public hasPermissionToCreateUser: boolean;
- public hasPermissionToUpdateUserSettings: boolean;
-
- public importAndExportTooltipBasic = translate(
+ protected baseCurrency: string;
+ protected coupon: number | undefined;
+ protected durationExtension: StringValue | undefined;
+ protected hasPermissionToCreateUser: boolean;
+ protected hasPermissionToUpdateUserSettings: boolean;
+
+ protected readonly importAndExportTooltipBasic = translate(
'DATA_IMPORT_AND_EXPORT_TOOLTIP_BASIC'
);
- public importAndExportTooltipOSS = translate(
+ protected readonly importAndExportTooltipOSS = translate(
'DATA_IMPORT_AND_EXPORT_TOOLTIP_OSS'
);
- public importAndExportTooltipPremium = translate(
- 'DATA_IMPORT_AND_EXPORT_TOOLTIP_PREMIUM'
- );
-
- public isLoggedIn: boolean;
- public label: string;
- public price: number;
- public priceId: string;
+ protected label: string | undefined;
+ protected price: number | undefined;
- public professionalDataProviderTooltipPremium = translate(
+ protected readonly professionalDataProviderTooltipPremium = translate(
'PROFESSIONAL_DATA_PROVIDER_TOOLTIP_PREMIUM'
);
- public referralBrokers = [
+ protected readonly referralBrokers = [
'Alpian',
'DEGIRO',
'finpension',
@@ -87,19 +81,22 @@ export class GfPricingPageComponent implements OnInit {
'Swissquote',
'VIAC',
'Zak'
- ];
-
- public routerLinkFeatures = publicRoutes.features.routerLink;
- public routerLinkRegister = publicRoutes.register.routerLink;
- public user: User;
-
- public constructor(
- private changeDetectorRef: ChangeDetectorRef,
- private dataService: DataService,
- private destroyRef: DestroyRef,
- private notificationService: NotificationService,
- private userService: UserService
- ) {
+ ] as const;
+
+ protected readonly routerLinkFeatures = publicRoutes.features.routerLink;
+ protected readonly routerLinkRegister = publicRoutes.register.routerLink;
+ protected user: User;
+
+ private couponId: string | undefined;
+ private priceId: string;
+
+ private readonly changeDetectorRef = inject(ChangeDetectorRef);
+ private readonly dataService = inject(DataService);
+ private readonly destroyRef = inject(DestroyRef);
+ private readonly notificationService = inject(NotificationService);
+ private readonly userService = inject(UserService);
+
+ public constructor() {
addIcons({
checkmarkCircleOutline,
checkmarkOutline,
@@ -147,7 +144,7 @@ export class GfPricingPageComponent implements OnInit {
});
}
- public onCheckout() {
+ protected onCheckout() {
this.dataService
.createStripeCheckoutSession({
couponId: this.couponId,
diff --git a/libs/ui/src/lib/i18n.ts b/libs/ui/src/lib/i18n.ts
index e23b375905..c7d8b7c8bb 100644
--- a/libs/ui/src/lib/i18n.ts
+++ b/libs/ui/src/lib/i18n.ts
@@ -11,7 +11,6 @@ const locales = {
CLOSE: $localize`Close`,
DATA_IMPORT_AND_EXPORT_TOOLTIP_BASIC: $localize`Switch to Ghostfolio Premium or Ghostfolio Open Source easily`,
DATA_IMPORT_AND_EXPORT_TOOLTIP_OSS: $localize`Switch to Ghostfolio Premium easily`,
- DATA_IMPORT_AND_EXPORT_TOOLTIP_PREMIUM: $localize`Switch to Ghostfolio Open Source or Ghostfolio Basic easily`,
DATA_SOURCE: $localize`Data Source`,
EMERGENCY_FUND: $localize`Emergency Fund`,
EXCLUDE_FROM_ANALYSIS: $localize`Exclude from Analysis`,