From c60f5905334f2bfa9aeaf09e11042288db5c422d Mon Sep 17 00:00:00 2001 From: alexcibotari Date: Fri, 18 Oct 2024 23:23:40 +0200 Subject: [PATCH] Add Google Analytics Improve Messages --- src/app/app.component.ts | 6 +++++- src/app/app.module.ts | 2 ++ src/app/features/admin/spaces/spaces.component.ts | 2 +- src/app/features/spaces/assets/assets.component.ts | 13 +++++++++++-- .../features/spaces/contents/contents.component.ts | 13 +++++++++++-- .../features/spaces/schemas/schemas.component.ts | 2 +- .../confirmation-dialog.component.html | 6 +++++- 7 files changed, 36 insertions(+), 8 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index eba2b35b..d60ebbbd 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,5 +1,6 @@ import { Component } from '@angular/core'; import { Performance } from '@angular/fire/performance'; +import { Analytics } from '@angular/fire/analytics'; @Component({ selector: 'll-root', @@ -7,5 +8,8 @@ import { Performance } from '@angular/fire/performance'; styleUrls: ['./app.component.scss'], }) export class AppComponent { - constructor(private readonly performance: Performance) {} + constructor( + private readonly performance: Performance, + private readonly analytics: Analytics, + ) {} } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index ae72de06..d7e52c44 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -27,6 +27,7 @@ import { IMAGE_LOADER, ImageLoaderConfig } from '@angular/common'; import { MarkdownModule } from 'ngx-markdown'; import { provideHttpClient, withFetch, withInterceptorsFromDi } from '@angular/common/http'; import { MatIconRegistry } from '@angular/material/icon'; +import { getAnalytics, provideAnalytics } from '@angular/fire/analytics'; @NgModule({ declarations: [AppComponent], @@ -83,6 +84,7 @@ import { MatIconRegistry } from '@angular/material/icon'; } return functions; }), + provideAnalytics(() => getAnalytics()), providePerformance(() => { return getPerformance(); }), diff --git a/src/app/features/admin/spaces/spaces.component.ts b/src/app/features/admin/spaces/spaces.component.ts index 980f6aa0..4fd68cc0 100644 --- a/src/app/features/admin/spaces/spaces.component.ts +++ b/src/app/features/admin/spaces/spaces.component.ts @@ -106,7 +106,7 @@ export class SpacesComponent implements OnInit { .open(ConfirmationDialogComponent, { data: { title: 'Delete Space', - content: `Are you sure about deleting Space with name '${element.name}'.`, + content: `Are you sure about deleting Space with name '${element.name}'.\n This action can not be undone.`, }, }) .afterClosed() diff --git a/src/app/features/spaces/assets/assets.component.ts b/src/app/features/spaces/assets/assets.component.ts index db2efb97..5b9a237a 100644 --- a/src/app/features/spaces/assets/assets.component.ts +++ b/src/app/features/spaces/assets/assets.component.ts @@ -214,11 +214,20 @@ export class AssetsComponent implements OnInit { // Prevent Default event.preventDefault(); event.stopImmediatePropagation(); + let title = ''; + let content = ''; + if (element.kind === AssetKind.FOLDER) { + title = 'Delete Folder'; + content = `Are you sure about deleting Folder with name: ${element.name}.\n All sub folders and assets will be deleted.`; + } else if (element.kind === AssetKind.FILE) { + title = 'Delete Asset'; + content = `Are you sure about deleting Asset with name: ${element.name}.`; + } this.dialog .open(ConfirmationDialogComponent, { data: { - title: 'Delete Asset', - content: `Are you sure about deleting Asset with name: ${element.name}.`, + title: title, + content: content, }, }) .afterClosed() diff --git a/src/app/features/spaces/contents/contents.component.ts b/src/app/features/spaces/contents/contents.component.ts index fb7687c3..9d300e3c 100644 --- a/src/app/features/spaces/contents/contents.component.ts +++ b/src/app/features/spaces/contents/contents.component.ts @@ -186,11 +186,20 @@ export class ContentsComponent { // Prevent Default event.preventDefault(); event.stopImmediatePropagation(); + let title = ''; + let content = ''; + if (element.kind === ContentKind.FOLDER) { + title = 'Delete Folder'; + content = `Are you sure about deleting Folder with name: ${element.name}.\n All sub folders and documents will be deleted.`; + } else if (element.kind === ContentKind.DOCUMENT) { + title = 'Delete Document'; + content = `Are you sure about deleting Document with name: ${element.name}.`; + } this.dialog .open(ConfirmationDialogComponent, { data: { - title: 'Delete Content', - content: `Are you sure about deleting Content with name: ${element.name}.`, + title: title, + content: content, }, }) .afterClosed() diff --git a/src/app/features/spaces/schemas/schemas.component.ts b/src/app/features/spaces/schemas/schemas.component.ts index 59749804..055fee97 100644 --- a/src/app/features/spaces/schemas/schemas.component.ts +++ b/src/app/features/spaces/schemas/schemas.component.ts @@ -200,7 +200,7 @@ export class SchemasComponent implements OnInit { .open(ConfirmationDialogComponent, { data: { title: 'Delete Schema', - content: `Are you sure about deleting Schema with name '${element.id}'.`, + content: `Are you sure about deleting Schema with name '${element.id}'.\n Any Content document associated with the Schema will not work anymore.`, }, }) .afterClosed() diff --git a/src/app/shared/components/confirmation-dialog/confirmation-dialog.component.html b/src/app/shared/components/confirmation-dialog/confirmation-dialog.component.html index 426efeda..dadc80cf 100644 --- a/src/app/shared/components/confirmation-dialog/confirmation-dialog.component.html +++ b/src/app/shared/components/confirmation-dialog/confirmation-dialog.component.html @@ -1,5 +1,9 @@

{{ data.title }}

- {{ data.content }} + +

+ {{ data.content }} +

+