diff options
Diffstat (limited to 'client/src/app/menu')
-rw-r--r-- | client/src/app/menu/avatar-notification.component.html | 29 | ||||
-rw-r--r-- | client/src/app/menu/avatar-notification.component.scss | 20 | ||||
-rw-r--r-- | client/src/app/menu/avatar-notification.component.ts | 9 |
3 files changed, 46 insertions, 12 deletions
diff --git a/client/src/app/menu/avatar-notification.component.html b/client/src/app/menu/avatar-notification.component.html index 4ef3f0e89..a5ef43d42 100644 --- a/client/src/app/menu/avatar-notification.component.html +++ b/client/src/app/menu/avatar-notification.component.html | |||
@@ -1,6 +1,6 @@ | |||
1 | <div | 1 | <div |
2 | [ngbPopover]="popContent" autoClose="outside" placement="bottom-left" container="body" popoverClass="popover-notifications" | 2 | [ngbPopover]="popContent" autoClose="outside" placement="bottom-left" container="body" popoverClass="popover-notifications" |
3 | i18n-title title="View your notifications" class="notification-avatar" #popover="ngbPopover" | 3 | i18n-title title="View your notifications" class="notification-avatar" #popover="ngbPopover" (hidden)="onPopoverHidden()" |
4 | > | 4 | > |
5 | <div *ngIf="unreadNotifications > 0" class="unread-notifications">{{ unreadNotifications }}</div> | 5 | <div *ngIf="unreadNotifications > 0" class="unread-notifications">{{ unreadNotifications }}</div> |
6 | 6 | ||
@@ -8,16 +8,25 @@ | |||
8 | </div> | 8 | </div> |
9 | 9 | ||
10 | <ng-template #popContent> | 10 | <ng-template #popContent> |
11 | <div class="notifications-header"> | 11 | <div class="content" [ngClass]="{ loaded: loaded }"> |
12 | <div i18n>Notifications</div> | 12 | <div class="notifications-header"> |
13 | <div i18n>Notifications</div> | ||
13 | 14 | ||
14 | <a | 15 | <a |
15 | i18n-title title="Update your notification preferences" class="glyphicon glyphicon-cog" | 16 | i18n-title title="Update your notification preferences" class="glyphicon glyphicon-cog" |
16 | routerLink="/my-account/settings" fragment="notifications" | 17 | routerLink="/my-account/settings" fragment="notifications" |
17 | ></a> | 18 | ></a> |
18 | </div> | 19 | </div> |
20 | |||
21 | <div *ngIf="!loaded" class="loader"> | ||
22 | <my-loader [loading]="!loaded"></my-loader> | ||
23 | </div> | ||
19 | 24 | ||
20 | <my-user-notifications [ignoreLoadingBar]="true" [infiniteScroll]="false" itemsPerPage="10"></my-user-notifications> | 25 | <my-user-notifications |
26 | [ignoreLoadingBar]="true" [infiniteScroll]="false" itemsPerPage="10" | ||
27 | (notificationsLoaded)="onNotificationLoaded()" | ||
28 | ></my-user-notifications> | ||
21 | 29 | ||
22 | <a class="all-notifications" routerLink="/my-account/notifications" i18n>See all your notifications</a> | 30 | <a *ngIf="loaded" class="all-notifications" routerLink="/my-account/notifications" i18n>See all your notifications</a> |
31 | </div> | ||
23 | </ng-template> | 32 | </ng-template> |
diff --git a/client/src/app/menu/avatar-notification.component.scss b/client/src/app/menu/avatar-notification.component.scss index e785db788..201668b6e 100644 --- a/client/src/app/menu/avatar-notification.component.scss +++ b/client/src/app/menu/avatar-notification.component.scss | |||
@@ -9,11 +9,27 @@ | |||
9 | padding: 0; | 9 | padding: 0; |
10 | font-size: 14px; | 10 | font-size: 14px; |
11 | font-family: $main-fonts; | 11 | font-family: $main-fonts; |
12 | overflow-y: auto; | 12 | overflow-y: scroll; |
13 | max-height: 500px; | ||
14 | width: 400px; | 13 | width: 400px; |
15 | box-shadow: 0 6px 14px rgba(0, 0, 0, 0.30); | 14 | box-shadow: 0 6px 14px rgba(0, 0, 0, 0.30); |
16 | 15 | ||
16 | .loader { | ||
17 | display: flex; | ||
18 | align-items: center; | ||
19 | justify-content: center; | ||
20 | |||
21 | padding: 5px 0; | ||
22 | } | ||
23 | |||
24 | .content { | ||
25 | max-height: 150px; | ||
26 | transition: max-height 0.15s ease-out; | ||
27 | |||
28 | &.loaded { | ||
29 | max-height: 500px; | ||
30 | } | ||
31 | } | ||
32 | |||
17 | .notifications-header { | 33 | .notifications-header { |
18 | display: flex; | 34 | display: flex; |
19 | justify-content: space-between; | 35 | justify-content: space-between; |
diff --git a/client/src/app/menu/avatar-notification.component.ts b/client/src/app/menu/avatar-notification.component.ts index 878c5c88c..a77a001ca 100644 --- a/client/src/app/menu/avatar-notification.component.ts +++ b/client/src/app/menu/avatar-notification.component.ts | |||
@@ -17,6 +17,7 @@ export class AvatarNotificationComponent implements OnInit, OnDestroy { | |||
17 | @Input() user: User | 17 | @Input() user: User |
18 | 18 | ||
19 | unreadNotifications = 0 | 19 | unreadNotifications = 0 |
20 | loaded = false | ||
20 | 21 | ||
21 | private notificationSub: Subscription | 22 | private notificationSub: Subscription |
22 | private routeSub: Subscription | 23 | private routeSub: Subscription |
@@ -54,6 +55,14 @@ export class AvatarNotificationComponent implements OnInit, OnDestroy { | |||
54 | this.popover.close() | 55 | this.popover.close() |
55 | } | 56 | } |
56 | 57 | ||
58 | onPopoverHidden () { | ||
59 | this.loaded = false | ||
60 | } | ||
61 | |||
62 | onNotificationLoaded () { | ||
63 | this.loaded = true | ||
64 | } | ||
65 | |||
57 | private async subscribeToNotifications () { | 66 | private async subscribeToNotifications () { |
58 | const obs = await this.userNotificationSocket.getMyNotificationsSocket() | 67 | const obs = await this.userNotificationSocket.getMyNotificationsSocket() |
59 | 68 | ||