diff --git a/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts b/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts index cac21c069..db23d10b1 100644 --- a/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts +++ b/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts @@ -1,3 +1,4 @@ +import { NotificationService } from '@ghostfolio/client/core/notification/notification.service'; import { getDateFnsLocale, getLocale } from '@ghostfolio/common/helper'; import { PortfolioSummary, User } from '@ghostfolio/common/interfaces'; import { translate } from '@ghostfolio/ui/i18n'; @@ -34,6 +35,8 @@ export class PortfolioSummaryComponent implements OnChanges { ); public timeInMarket: string; + constructor(private notificationService: NotificationService) {} + public ngOnChanges() { if (this.summary) { if (this.summary.firstOrderDate) { @@ -49,14 +52,17 @@ export class PortfolioSummaryComponent implements OnChanges { } public onEditEmergencyFund() { - const emergencyFundInput = prompt( - $localize`Please enter the amount of your emergency fund:`, - this.summary.emergencyFund?.total?.toString() ?? '0' - ); - const emergencyFund = parseFloat(emergencyFundInput?.trim()); - - if (emergencyFund >= 0) { - this.emergencyFundChanged.emit(emergencyFund); - } + this.notificationService.prompt({ + confirmFn: (value) => { + const emergencyFund = parseFloat(value.trim()); + if (emergencyFund >= 0) { + this.emergencyFundChanged.emit(emergencyFund); + } + }, + confirmLabel: $localize`Save`, + defaultValue: this.summary.emergencyFund?.total?.toString() ?? '0', + title: $localize`Please enter the amount of your emergency fund:`, + valueLabel: $localize`Emergency fund` + }); } }