Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Group notifications

Chocobozzz728d32ddb217
diff --git a/client/src/app/+my-account/my-account-notifications/my-account-notifications.component.scss b/client/src/app/+my-account/my-account-notifications/my-account-notifications.component.scss
index daaafc79cf..fa3b6998a2 100644
--- a/client/src/app/+my-account/my-account-notifications/my-account-notifications.component.scss
+++ b/client/src/app/+my-account/my-account-notifications/my-account-notifications.component.scss
@@ -7,5 +7,5 @@
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
- margin-bottom: 1.25rem;
+ margin-bottom: 1.5rem;
}
diff --git a/client/src/app/shared/shared-notifications/user-notifications.component.html b/client/src/app/shared/shared-notifications/user-notifications.component.html
index a2daa13054..72de6820a2 100644
--- a/client/src/app/shared/shared-notifications/user-notifications.component.html
+++ b/client/src/app/shared/shared-notifications/user-notifications.component.html
@@ -7,6 +7,10 @@
myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()"
>
@for (notification of notifications; track notification.payload.id) {
+ @if (!inPopup()) {
+ <my-date-group-label [date]="notification.payload.createdAt" [store]="groupByDateStore" [groupedDateLabels]="groupedDateLabels"></my-date-group-label>
+ }
+
<li>
@if (notification.externalUrl) {
<a
diff --git a/client/src/app/shared/shared-notifications/user-notifications.component.scss b/client/src/app/shared/shared-notifications/user-notifications.component.scss
index 2ab7d26258..236e498a55 100644
--- a/client/src/app/shared/shared-notifications/user-notifications.component.scss
+++ b/client/src/app/shared/shared-notifications/user-notifications.component.scss
@@ -55,3 +55,19 @@ li {
}
}
}
+
+my-date-group-label.date-displayed {
+ font-weight: $font-bold;
+ color: pvar(--fg-300);
+ padding-bottom: 1.5rem;
+ display: block;
+ line-height: normal;
+
+ @include font-size(18px);
+
+ &:not(:first-child) {
+ padding-top: 1.5rem;
+ margin-top: 1.5rem;
+ border-top: 1px solid var(--bg-secondary);
+ }
+}
diff --git a/client/src/app/shared/shared-notifications/user-notifications.component.ts b/client/src/app/shared/shared-notifications/user-notifications.component.ts
index bd594fc260..bcca93240a 100644
--- a/client/src/app/shared/shared-notifications/user-notifications.component.ts
+++ b/client/src/app/shared/shared-notifications/user-notifications.component.ts
@@ -4,6 +4,7 @@ import { RouterLink } from '@angular/router'
import { ComponentPagination, hasMoreItems, Notifier } from '@app/core'
import { Subject } from 'rxjs'
import { InfiniteScrollerDirective } from '../shared-main/common/infinite-scroller.directive'
+import { DateGroupLabelComponent, GroupDate, GroupDateLabels } from '../shared-main/date/date-group-label.component'
import { UserNotification } from '../shared-main/users/user-notification.model'
import { UserNotificationService } from '../shared-main/users/user-notification.service'
import { UserNotificationContentComponent } from './user-notification-content.component'
@@ -16,7 +17,8 @@ import { UserNotificationContentComponent } from './user-notification-content.co
CommonModule,
RouterLink,
InfiniteScrollerDirective,
- UserNotificationContentComponent
+ UserNotificationContentComponent,
+ DateGroupLabelComponent
]
})
export class UserNotificationsComponent implements OnInit {
@@ -32,6 +34,16 @@ export class UserNotificationsComponent implements OnInit {
readonly notificationsLoaded = output()
+ groupByDateStore = new Set<number>()
+ groupedDateLabels: GroupDateLabels = {
+ [GroupDate.TODAY]: $localize`Today`,
+ [GroupDate.YESTERDAY]: $localize`Yesterday`,
+ [GroupDate.THIS_WEEK]: $localize`This week`,
+ [GroupDate.THIS_MONTH]: $localize`This month`,
+ [GroupDate.LAST_MONTH]: $localize`Last month`,
+ [GroupDate.OLDER]: $localize`Older`
+ }
+
notifications: UserNotification[] = []
sortField = 'createdAt'