Skip to content

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

Task/add activity count to delete menu item and confirmation dialog of activities table component (#7489)

Thomas Kauleb62190c74b4
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 62cbee836d..421a1bd6c3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improved the style of the tabs in the holding detail dialog on mobile
- Improved the style of the tabs in the asset profile dialog of the admin control panel on mobile
- Improved the style of the empty state in the _Fear & Greed Index_ component
+- Added the activity count to the delete menu item of the activities table
+- Added the activity count to the deletion confirmation dialog of the activities table
- Improved the style of the type filter in the activities table component (experimental)
- Improved the performance of the property service by caching the properties in memory
- Improved the language localization for German (`de`)
diff --git a/libs/ui/src/lib/activities-table/activities-table.component.html b/libs/ui/src/lib/activities-table/activities-table.component.html
index 3d91852a0c..1ff8496a9b 100644
--- a/libs/ui/src/lib/activities-table/activities-table.component.html
+++ b/libs/ui/src/lib/activities-table/activities-table.component.html
@@ -84,14 +84,19 @@
<button
class="align-items-center d-flex"
mat-menu-item
- [disabled]="
- dataSource()?.data.length === 0 || !hasPermissionToDeleteActivity
- "
+ [disabled]="!canDeleteActivities()"
(click)="onDeleteActivities()"
>
<span class="align-items-center d-flex">
<ion-icon class="mr-2" name="trash-outline" />
- <span i18n>Delete Activities</span>
+ @if (canDeleteActivities()) {
+ <span i18n
+ >Delete {{ totalItems > 1 ? totalItems : '' }}
+ {totalItems, plural, =1 {Activity} other {Activities}}</span
+ >
+ } @else {
+ <span i18n>Delete Activities</span>
+ }
</span>
</button>
</mat-menu>
diff --git a/libs/ui/src/lib/activities-table/activities-table.component.ts b/libs/ui/src/lib/activities-table/activities-table.component.ts
index 573c8c93a4..a4e7403a7b 100644
--- a/libs/ui/src/lib/activities-table/activities-table.component.ts
+++ b/libs/ui/src/lib/activities-table/activities-table.component.ts
@@ -282,6 +282,13 @@ export class GfActivitiesTableComponent implements AfterViewInit, OnInit {
);
}
+ public canDeleteActivities() {
+ return (
+ (this.dataSource()?.data.length ?? 0) > 0 &&
+ this.hasPermissionToDeleteActivity
+ );
+ }
+
public isExcludedFromAnalysis(activity: Activity) {
return (
(activity.account && isAccountExcluded(activity.account)) ??
@@ -314,7 +321,10 @@ export class GfActivitiesTableComponent implements AfterViewInit, OnInit {
this.activitiesDeleted.emit();
},
confirmType: ConfirmationDialogType.Warn,
- title: $localize`Do you really want to delete these activities?`
+ title:
+ this.totalItems === 1
+ ? $localize`Do you really want to delete this activity?`
+ : $localize`Do you really want to delete these ${this.totalItems}:count: activities?`
});
}