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

Show gif animation when loading notification center

Henriette Darge9d691f48eff3
diff --git a/frontend/src/app/features/in-app-notifications/center/empty-state/empty-state.component.html b/frontend/src/app/features/in-app-notifications/center/empty-state/empty-state.component.html
index 124c84e0039..81bb151fb9d 100644
--- a/frontend/src/app/features/in-app-notifications/center/empty-state/empty-state.component.html
+++ b/frontend/src/app/features/in-app-notifications/center/empty-state/empty-state.component.html
@@ -3,17 +3,22 @@
data-qa-selector="op-empty-state"
>
<div class="work-packages-tab-view--overflow op-empty-state--content">
- <ng-container *ngIf="(hasNotifications$ | async); else noNotification">
- <img [src]="image.no_selection" class="op-empty-state--content--image"/>
- <p class="op-empty-state--content--text">
- <span>{{ text.no_selection }}</span>
- </p>
+ <ng-container *ngIf="loading; else finishedLoading">
+ <img [src]="image.loading" class="op-empty-state--content--image"/>
</ng-container>
- <ng-template #noNotification>
- <img [src]="image.no_notification" class="op-empty-state--content--image"/>
- <p class="op-empty-state--content--text">
- <span> {{ text.no_notification }}</span>
- </p>
+ <ng-template #finishedLoading>
+ <ng-container *ngIf="hasNotifications; else noNotification">
+ <img [src]="image.no_selection" class="op-empty-state--content--image"/>
+ <p class="op-empty-state--content--text">
+ <span>{{ text.no_selection }}</span>
+ </p>
+ </ng-container>
+ <ng-template #noNotification>
+ <img [src]="image.no_notification" class="op-empty-state--content--image"/>
+ <p class="op-empty-state--content--text">
+ <span> {{ text.no_notification }}</span>
+ </p>
+ </ng-template>
</ng-template>
</div>
</div>
diff --git a/frontend/src/app/features/in-app-notifications/center/empty-state/empty-state.component.sass b/frontend/src/app/features/in-app-notifications/center/empty-state/empty-state.component.sass
index 70e112fc4b8..79faee04a37 100644
--- a/frontend/src/app/features/in-app-notifications/center/empty-state/empty-state.component.sass
+++ b/frontend/src/app/features/in-app-notifications/center/empty-state/empty-state.component.sass
@@ -17,4 +17,6 @@
font-size: larger
&--image
- margin-bottom: 15px
\ No newline at end of file
+ max-height: 130px
+ min-height: 130px
+ margin-bottom: 15px
diff --git a/frontend/src/app/features/in-app-notifications/center/empty-state/empty-state.component.ts b/frontend/src/app/features/in-app-notifications/center/empty-state/empty-state.component.ts
index 93275b16f2d..78e3a53451a 100644
--- a/frontend/src/app/features/in-app-notifications/center/empty-state/empty-state.component.ts
+++ b/frontend/src/app/features/in-app-notifications/center/empty-state/empty-state.component.ts
@@ -28,11 +28,14 @@
import {
ChangeDetectionStrategy,
+ ChangeDetectorRef,
Component,
+ OnInit,
} from '@angular/core';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { imagePath } from 'core-app/shared/helpers/images/path-helper';
import { IanCenterService } from '../state/ian-center.service';
+import { debounceTime } from 'rxjs/operators';
@Component({
templateUrl: './empty-state.component.html',
@@ -40,10 +43,11 @@ import { IanCenterService } from '../state/ian-center.service';
styleUrls: ['./empty-state.component.sass'],
selector: 'op-empty-state',
})
-export class EmptyStateComponent {
+export class EmptyStateComponent implements OnInit {
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'),
};
text = {
@@ -51,11 +55,26 @@ export class EmptyStateComponent {
no_selection: this.I18n.t('js.notifications.center.empty_state.no_selection'),
};
- hasNotifications$ = this.storeService.query.hasNotifications$;
+ hasNotifications:boolean;
+
+ loading = true;
+
+ private hasNotifications$ = this.storeService.query.hasNotifications$;
constructor(
readonly I18n:I18nService,
readonly storeService:IanCenterService,
+ readonly cdRef:ChangeDetectorRef,
) {
}
+
+ ngOnInit():void {
+ this.hasNotifications$.pipe(
+ debounceTime(700),
+ ).subscribe((val:boolean) => {
+ this.loading = false;
+ this.hasNotifications = val;
+ this.cdRef.detectChanges();
+ });
+ }
}
diff --git a/frontend/src/assets/images/notification-center/notification_loading.gif b/frontend/src/assets/images/notification-center/notification_loading.gif
new file mode 100644
index 00000000000..003ee9c2b87
Binary files /dev/null and b/frontend/src/assets/images/notification-center/notification_loading.gif differ