+ ) {}
+
+ @HostListener('window:keyup', ['$event'])
+ public keyEvent(event: KeyboardEvent) {
+ if (event.key === 'Enter') {
+ this.dialogRef.close('confirm');
+ }
+ }
+
+ public initialize(aParams: IConfirmDialogParams) {
+ this.confirmLabel = aParams.confirmLabel;
+ this.confirmType = aParams.confirmType;
+ this.discardLabel = aParams.discardLabel;
+ this.message = aParams.message;
+ this.title = aParams.title;
+ }
+}
diff --git a/apps/client/src/app/core/notification/confirmation-dialog/confirmation-dialog.html b/apps/client/src/app/core/notification/confirmation-dialog/confirmation-dialog.html
new file mode 100644
index 00000000..e9e2b693
--- /dev/null
+++ b/apps/client/src/app/core/notification/confirmation-dialog/confirmation-dialog.html
@@ -0,0 +1,20 @@
+@if (title) {
+
+}
+
+@if (message) {
+
+}
+
+
+
+
+
diff --git a/apps/client/src/app/core/notification/confirmation-dialog/confirmation-dialog.scss b/apps/client/src/app/core/notification/confirmation-dialog/confirmation-dialog.scss
new file mode 100644
index 00000000..dc9093b4
--- /dev/null
+++ b/apps/client/src/app/core/notification/confirmation-dialog/confirmation-dialog.scss
@@ -0,0 +1,2 @@
+:host {
+}
diff --git a/apps/client/src/app/core/notification/confirmation-dialog/confirmation-dialog.type.ts b/apps/client/src/app/core/notification/confirmation-dialog/confirmation-dialog.type.ts
new file mode 100644
index 00000000..1fe1fc7c
--- /dev/null
+++ b/apps/client/src/app/core/notification/confirmation-dialog/confirmation-dialog.type.ts
@@ -0,0 +1,5 @@
+export enum ConfirmationDialogType {
+ Accent = 'accent',
+ Primary = 'primary',
+ Warn = 'warn'
+}
diff --git a/apps/client/src/app/core/notification/confirmation-dialog/interfaces/interfaces.ts b/apps/client/src/app/core/notification/confirmation-dialog/interfaces/interfaces.ts
new file mode 100644
index 00000000..834988ce
--- /dev/null
+++ b/apps/client/src/app/core/notification/confirmation-dialog/interfaces/interfaces.ts
@@ -0,0 +1,9 @@
+import { ConfirmationDialogType } from '../confirmation-dialog.type';
+
+export interface IConfirmDialogParams {
+ confirmLabel?: string;
+ confirmType: ConfirmationDialogType;
+ discardLabel?: string;
+ message?: string;
+ title: string;
+}
diff --git a/apps/client/src/app/core/notification/interfaces/interfaces.ts b/apps/client/src/app/core/notification/interfaces/interfaces.ts
new file mode 100644
index 00000000..f5a526c9
--- /dev/null
+++ b/apps/client/src/app/core/notification/interfaces/interfaces.ts
@@ -0,0 +1,19 @@
+import { ConfirmationDialogType } from '../confirmation-dialog/confirmation-dialog.type';
+
+export interface IAlertParams {
+ discardFn?: () => void;
+ discardLabel?: string;
+ message?: string;
+ title: string;
+}
+
+export interface IConfirmParams {
+ confirmFn: () => void;
+ confirmLabel?: string;
+ confirmType?: ConfirmationDialogType;
+ disableClose?: boolean;
+ discardFn?: () => void;
+ discardLabel?: string;
+ message?: string;
+ title: string;
+}
diff --git a/apps/client/src/app/core/notification/notification.module.ts b/apps/client/src/app/core/notification/notification.module.ts
new file mode 100644
index 00000000..542cae92
--- /dev/null
+++ b/apps/client/src/app/core/notification/notification.module.ts
@@ -0,0 +1,18 @@
+import { CommonModule } from '@angular/common';
+import { NgModule } from '@angular/core';
+import { MatDialogModule } from '@angular/material/dialog';
+
+import { GfAlertDialogComponent } from './alert-dialog/alert-dialog.component';
+import { GfConfirmationDialogComponent } from './confirmation-dialog/confirmation-dialog.component';
+import { NotificationService } from './notification.service';
+
+@NgModule({
+ imports: [
+ CommonModule,
+ GfAlertDialogComponent,
+ GfConfirmationDialogComponent,
+ MatDialogModule
+ ],
+ providers: [NotificationService]
+})
+export class GfNotificationModule {}
diff --git a/apps/client/src/app/core/notification/notification.service.ts b/apps/client/src/app/core/notification/notification.service.ts
new file mode 100644
index 00000000..2e7d9de6
--- /dev/null
+++ b/apps/client/src/app/core/notification/notification.service.ts
@@ -0,0 +1,83 @@
+import { translate } from '@ghostfolio/ui/i18n';
+
+import { Injectable } from '@angular/core';
+import { MatDialog } from '@angular/material/dialog';
+import { isFunction } from 'lodash';
+
+import { GfAlertDialogComponent } from './alert-dialog/alert-dialog.component';
+import { GfConfirmationDialogComponent } from './confirmation-dialog/confirmation-dialog.component';
+import { ConfirmationDialogType } from './confirmation-dialog/confirmation-dialog.type';
+import { IAlertParams, IConfirmParams } from './interfaces/interfaces';
+
+@Injectable()
+export class NotificationService {
+ private dialogMaxWidth: string;
+ private dialogWidth: string;
+
+ public constructor(private matDialog: MatDialog) {}
+
+ public alert(aParams: IAlertParams) {
+ if (!aParams.discardLabel) {
+ aParams.discardLabel = translate('CLOSE');
+ }
+
+ const dialog = this.matDialog.open(GfAlertDialogComponent, {
+ autoFocus: false,
+ maxWidth: this.dialogMaxWidth,
+ width: this.dialogWidth
+ });
+
+ dialog.componentInstance.initialize({
+ discardLabel: aParams.discardLabel,
+ message: aParams.message,
+ title: aParams.title
+ });
+
+ return dialog.afterClosed().subscribe((result) => {
+ if (isFunction(aParams.discardFn)) {
+ aParams.discardFn();
+ }
+ });
+ }
+
+ public confirm(aParams: IConfirmParams) {
+ if (!aParams.confirmLabel) {
+ aParams.confirmLabel = translate('YES');
+ }
+
+ if (!aParams.discardLabel) {
+ aParams.discardLabel = translate('CANCEL');
+ }
+
+ const dialog = this.matDialog.open(GfConfirmationDialogComponent, {
+ autoFocus: false,
+ disableClose: aParams.disableClose || false,
+ maxWidth: this.dialogMaxWidth,
+ width: this.dialogWidth
+ });
+
+ dialog.componentInstance.initialize({
+ confirmLabel: aParams.confirmLabel,
+ confirmType: aParams.confirmType || ConfirmationDialogType.Primary,
+ discardLabel: aParams.discardLabel,
+ message: aParams.message,
+ title: aParams.title
+ });
+
+ return dialog.afterClosed().subscribe((result) => {
+ if (result === 'confirm' && isFunction(aParams.confirmFn)) {
+ aParams.confirmFn();
+ } else if (result === 'discard' && isFunction(aParams.discardFn)) {
+ aParams.discardFn();
+ }
+ });
+ }
+
+ public setDialogMaxWidth(aDialogMaxWidth: string) {
+ this.dialogMaxWidth = aDialogMaxWidth;
+ }
+
+ public setDialogWidth(aDialogWidth: string) {
+ this.dialogWidth = aDialogWidth;
+ }
+}
diff --git a/apps/client/src/styles.scss b/apps/client/src/styles.scss
index 2b864452..1f068da1 100644
--- a/apps/client/src/styles.scss
+++ b/apps/client/src/styles.scss
@@ -359,10 +359,6 @@ ngx-skeleton-loader {
.cdk-global-overlay-wrapper {
justify-content: center !important;
}
-
- .cdk-overlay-pane {
- max-width: 95vw !important;
- }
}
.cursor-default {
diff --git a/libs/ui/src/lib/i18n.ts b/libs/ui/src/lib/i18n.ts
index 2c1fd927..a98cbd70 100644
--- a/libs/ui/src/lib/i18n.ts
+++ b/libs/ui/src/lib/i18n.ts
@@ -6,7 +6,9 @@ const locales = {
ASSET_CLASS: $localize`Asset Class`,
ASSET_SUB_CLASS: $localize`Asset Sub Class`,
BUY_AND_SELL_ACTIVITIES_TOOLTIP: $localize`Buy and sell`,
+ CANCEL: $localize`Cancel`,
CORE: $localize`Core`,
+ 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`,
@@ -26,6 +28,7 @@ const locales = {
TAG: $localize`Tag`,
YEAR: $localize`Year`,
YEARS: $localize`Years`,
+ YES: $localize`Yes`,
// Activity types
BUY: $localize`Buy`,
From 18df8cebeba5b50ac56ee054f2dadbe1d4616a56 Mon Sep 17 00:00:00 2001
From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com>
Date: Tue, 13 Aug 2024 15:31:17 +0200
Subject: [PATCH 5/5] Feature/upgrade zone.js to version 0.14.10 (#3669)
* Upgrade zone.js to version 0.14.10
* Update changelog
---
CHANGELOG.md | 1 +
package-lock.json | 13 +++++++------
package.json | 2 +-
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e600373b..c60c6290 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Refactored the dark theme CSS selector
- Improved the language localization for German (`de`)
+- Upgraded `zone.js` from version `0.14.7` to `0.14.10`
### Fixed
diff --git a/package-lock.json b/package-lock.json
index 49eadc62..38589d68 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "ghostfolio",
- "version": "2.101.0",
+ "version": "2.103.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "ghostfolio",
- "version": "2.101.0",
+ "version": "2.103.0",
"hasInstallScript": true,
"license": "AGPL-3.0",
"dependencies": {
@@ -92,7 +92,7 @@
"twitter-api-v2": "1.14.2",
"uuid": "9.0.1",
"yahoo-finance2": "2.11.3",
- "zone.js": "0.14.7"
+ "zone.js": "0.14.10"
},
"devDependencies": {
"@angular-devkit/build-angular": "18.1.1",
@@ -34390,9 +34390,10 @@
}
},
"node_modules/zone.js": {
- "version": "0.14.7",
- "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.14.7.tgz",
- "integrity": "sha512-0w6DGkX2BPuiK/NLf+4A8FLE43QwBfuqz2dVgi/40Rj1WmqUskCqj329O/pwrqFJLG5X8wkeG2RhIAro441xtg=="
+ "version": "0.14.10",
+ "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.14.10.tgz",
+ "integrity": "sha512-YGAhaO7J5ywOXW6InXNlLmfU194F8lVgu7bRntUF3TiG8Y3nBK0x1UJJuHUP/e8IyihkjCYqhCScpSwnlaSRkQ==",
+ "license": "MIT"
}
}
}
diff --git a/package.json b/package.json
index 0e38d32a..af6bd2a6 100644
--- a/package.json
+++ b/package.json
@@ -136,7 +136,7 @@
"twitter-api-v2": "1.14.2",
"uuid": "9.0.1",
"yahoo-finance2": "2.11.3",
- "zone.js": "0.14.7"
+ "zone.js": "0.14.10"
},
"devDependencies": {
"@angular-devkit/build-angular": "18.1.1",