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

remove empty state component from notification center

bsatarnejad89c444e2c008
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index 7266e61b65e..9c5df780952 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -585,7 +585,7 @@ en:
one: 'and 1 other'
other: 'and %{count} others'
no_results:
- at_all: 'New notifications will appear here when there is activity that concerns you'
+ at_all: 'New notifications will appear here when there is activity that concerns you, in the mean time you can also view and modify your notification settings to configure when to be notified.'
with_current_filter: 'There are no notifications in this view at the moment'
mark_all_read: 'Mark all as read'
mark_as_read: 'Mark as read'
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 ee89167870a..ab0c2bc5200 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
@@ -1,31 +1,38 @@
<div class="op-ian-center">
<div class="op-ian-center--content">
- <ng-container *ngIf="(hasNotifications$ | async); else noResults">
- <cdk-virtual-scroll-viewport
- itemSize="100"
- class="op-ian-center--viewport"
- >
- <op-in-app-notification-entry
- *cdkVirtualFor="let records of notifications$ | async; trackBy: trackNotificationGroups; templateCacheSize: 0"
- 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}}"
- [attr.data-qa-ian-read]="records[0].readIAN === true || undefined"
- [attr.data-qa-ian-selected]="(stateChanged$ | async) === records[0]._links.resource.href"
- ></op-in-app-notification-entry>
- </cdk-virtual-scroll-viewport>
+ <ng-container *ngIf="(loading$ | async) === false; else loading">
+ <ng-container *ngIf="(hasNotifications$ | async); else noResults">
+ <cdk-virtual-scroll-viewport
+ itemSize="100"
+ class="op-ian-center--viewport"
+ >
+ <op-in-app-notification-entry
+ *cdkVirtualFor="let records of notifications$ | async; trackBy: trackNotificationGroups; templateCacheSize: 0"
+ 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}}"
+ [attr.data-qa-ian-read]="records[0].readIAN === true || undefined"
+ [attr.data-qa-ian-selected]="(stateChanged$ | async) === records[0]._links.resource.href"
+ ></op-in-app-notification-entry>
+ </cdk-virtual-scroll-viewport>
+ </ng-container>
+ <ng-template #noResults>
+ <div class="op-ian-center--loading-indicator">
+ <img [src]="image.no_notification" class="op-ian-center-loading-image"/>
+ <p class="op-ian-center-loading-text">
+ <span [textContent]="noNotificationText(hasNotifications, (totalCount$ | async))"></span>
+
+ </p>
+ <span [textContent]="noResultText$ | async"></span>
+ </div>
+ </ng-template>
</ng-container>
- <ng-template #noResults>
- <no-results *ngIf="(loading$ | async) === false"
- [title]="noResultText$ | async"
- [description]="text.change_notification_settings"
- [showIcon]="false"
- >
- </no-results>
+ <ng-template #loading>
+ <img [src]="image.loading" class="op-ian-center--loading-indicator op-ian-center-loading-image"/>
</ng-template>
</div>
<div class="op-ian-center--footer">
diff --git a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.sass b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.sass
index a6ea57e081f..a2468f670c5 100644
--- a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.sass
+++ b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.sass
@@ -21,11 +21,23 @@
// While loading, appear to be showing one item row
&--loading-indicator
- height: 100px
- overflow: hidden // FIXME this shouldn't be necessary with proper svg scaling
+ position: absolute
+ left: 50%
+ top: 50%
+ transform: translate(-50%, -50%)
+ text-align: center
:host
.-browser-safari &
// Because of Safari's viewport bug, the address bar overlaps content with height: 100vh
// Check #38082 before changing it
height: 100%
+
+ &-loading-text
+ color: var(--gray-dark)
+ font-size: 18px
+
+ &-loading-image
+ max-height: 130px
+ min-height: 130px
+ margin-bottom: 15px
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 9e95b699ea0..08adc7ed79c 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
@@ -20,6 +20,7 @@ import {
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';
import { IanBellService } from 'core-app/features/in-app-notifications/bell/state/ian-bell.service';
+import { imagePath } from 'core-app/shared/helpers/images/path-helper';
@Component({
selector: 'op-in-app-notification-center',
@@ -62,11 +63,20 @@ export class InAppNotificationCenterComponent implements OnInit {
originalOrder = ():number => 0;
+ image = {
+ no_notification: imagePath('notification-center/empty-state-no-notification.svg'),
+ no_selection: imagePath('notification-center/empty-state-no-selection.svg'),
+ loading: imagePath('notification-center/notification_loading.gif'),
+ };
+
trackNotificationGroups = (i:number, item:InAppNotification[]):string => item
.map((el) => `${el.id}@${el.updatedAt}`)
.join(',');
text = {
+ no_notification: this.I18n.t('js.notifications.center.empty_state.no_notification'),
+ no_notification_with_current_filter: this.I18n.t('js.notifications.center.empty_state.no_notification_with_current_filter'),
+ no_selection: this.I18n.t('js.notifications.center.empty_state.no_selection'),
change_notification_settings: this.I18n.t(
'js.notifications.settings.change_notification_settings',
{ url: this.pathService.myNotificationsSettingsPath() },
@@ -99,4 +109,8 @@ export class InAppNotificationCenterComponent implements OnInit {
name: this.uiRouterGlobals.params.name, // eslint-disable-line @typescript-eslint/no-unsafe-assignment
});
}
+
+ noNotificationText(hasNotifications:boolean, totalNotifications:number):string {
+ return (!hasNotifications && totalNotifications > 0) ? this.text.no_notification_with_current_filter : this.text.no_notification;
+ }
}
diff --git a/frontend/src/app/features/in-app-notifications/in-app-notifications.routes.ts b/frontend/src/app/features/in-app-notifications/in-app-notifications.routes.ts
index aa05a400667..1d78fa13ded 100644
--- a/frontend/src/app/features/in-app-notifications/in-app-notifications.routes.ts
+++ b/frontend/src/app/features/in-app-notifications/in-app-notifications.routes.ts
@@ -64,7 +64,6 @@ export const IAN_ROUTES:Ng2StateDeclaration[] = [
},
views: {
'content-left': { component: InAppNotificationCenterComponent },
- 'content-right': { component: EmptyStateComponent },
},
},
...makeSplitViewRoutes(