Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Highlight selected notification in the center

Henriette Darge93182d7f019d
diff --git a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.html b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.html
index 677425ea599..44fc0b4dbed 100644
--- a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.html
+++ b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.html
@@ -15,6 +15,7 @@
class="op-ian-item"
[class.op-ian-item_expanded]="records[0].expanded"
[class.op-ian-item_read]="records[0].readIAN === true"
+ [class.op-ian-item_selected]="(stateChanged$ | async) === records[0]._links.resource.href"
[notification]="records[0]"
[aggregatedNotifications]="records"
attr.data-qa-selector="op-ian-notification-item-{{records[0].id}}"
diff --git a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts
index b92e9bf92dd..674b1ab4cbb 100644
--- a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts
+++ b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts
@@ -7,17 +7,21 @@ import {
} from '@angular/core';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import {
+ distinctUntilChanged,
filter,
map,
+ pluck,
+ share,
} from 'rxjs/operators';
import { StateService } from '@uirouter/angular';
-import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import { UIRouterGlobals } from '@uirouter/core';
import { IanCenterService } from 'core-app/features/in-app-notifications/center/state/ian-center.service';
import {
InAppNotification,
NOTIFICATIONS_MAX_SIZE,
} from 'core-app/core/state/in-app-notifications/in-app-notification.model';
+import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
+import { APIV3Service } from 'core-app/core/apiv3/api-v3.service';
@Component({
selector: 'op-in-app-notification-center',
@@ -25,7 +29,7 @@ import {
styleUrls: ['./in-app-notification-center.component.sass'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
-export class InAppNotificationCenterComponent implements OnInit {
+export class InAppNotificationCenterComponent extends UntilDestroyedMixin implements OnInit {
maxSize = NOTIFICATIONS_MAX_SIZE;
hasMoreThanPageSize$ = this.storeService.query.hasMoreThanPageSize$;
@@ -56,6 +60,14 @@ export class InAppNotificationCenterComponent implements OnInit {
)),
);
+ stateChanged$ = this.uiRouterGlobals.params$?.pipe(
+ this.untilDestroyed(),
+ pluck('workPackageId'),
+ distinctUntilChanged(),
+ map((workPackageId:string) => (workPackageId ? this.apiV3.work_packages.id(workPackageId).path : undefined)),
+ share(),
+ );
+
originalOrder = ():number => 0;
trackNotificationGroups = (i:number, item:InAppNotification[]):string => item
@@ -71,6 +83,8 @@ export class InAppNotificationCenterComponent implements OnInit {
},
};
+ selectedNotification:InAppNotification|undefined;
+
constructor(
readonly cdRef:ChangeDetectorRef,
readonly elementRef:ElementRef,
@@ -78,16 +92,12 @@ export class InAppNotificationCenterComponent implements OnInit {
readonly storeService:IanCenterService,
readonly uiRouterGlobals:UIRouterGlobals,
readonly state:StateService,
+ readonly apiV3:APIV3Service,
) {
+ super();
}
ngOnInit():void {
this.storeService.setFacet('unread');
}
-
- openSplitView($event:WorkPackageResource):void {
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
- const baseRoute = this.uiRouterGlobals.current.data.baseRoute as string;
- void this.state.go(`${baseRoute}.details`, { workPackageId: $event.id });
- }
}
diff --git a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.sass b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.sass
index 0dc2b0cc596..63f658bb868 100644
--- a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.sass
+++ b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.sass
@@ -27,7 +27,7 @@ $subject-font-size: 14px
&_selected
background: $ian-bg-selected-color
-
+
&_selected:hover
background: $ian-bg-selected-hover-color