Skip to content

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

Improve notifications design

Chocobozzz1c94e97923dd
diff --git a/client/src/app/+my-account/my-account-notifications/my-account-notifications.component.html b/client/src/app/+my-account/my-account-notifications/my-account-notifications.component.html
index 11eca2f05f..0328546350 100644
--- a/client/src/app/+my-account/my-account-notifications/my-account-notifications.component.html
+++ b/client/src/app/+my-account/my-account-notifications/my-account-notifications.component.html
@@ -26,4 +26,6 @@
</button>
</div>
-<my-user-notifications #userNotification></my-user-notifications>
+<div class="user-notifications-container">
+ <my-user-notifications #userNotification></my-user-notifications>
+</div>
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 c6ffc709bf..b381e34e1c 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
@@ -1,7 +1,7 @@
-@use '_variables' as *;
-@use '_mixins' as *;
-@use '_button-mixins' as *;
-@use '_form-mixins' as *;
+@use "_variables" as *;
+@use "_mixins" as *;
+@use "_button-mixins" as *;
+@use "_form-mixins" as *;
.header {
display: flex;
@@ -13,3 +13,8 @@
@include peertube-select-container(auto);
}
}
+
+.user-notifications-container {
+ padding: 1rem;
+ background-color: pvar(--bg-secondary-400);
+}
diff --git a/client/src/app/header/notification-dropdown.component.html b/client/src/app/header/notification-dropdown.component.html
index f1ece7fe67..8e4660654b 100644
--- a/client/src/app/header/notification-dropdown.component.html
+++ b/client/src/app/header/notification-dropdown.component.html
@@ -16,9 +16,13 @@
@if (isInMobileView) {
<a
- i18n-title title="View your notifications"
+ i18n-title
+ title="View your notifications"
class="peertube-button tertiary-button rounded-icon-button notification-inbox-link"
- routerLink="/my-account/notifications" routerLinkActive="active" #link (click)="onNavigate(link)"
+ routerLink="/my-account/notifications"
+ routerLinkActive="active"
+ #link
+ (click)="onNavigate(link)"
>
<ng-container *ngTemplateOutlet="notificationNumber"></ng-container>
@@ -26,11 +30,18 @@
</a>
} @else {
<div
- ngbDropdown autoClose="outside" placement="bottom-end auto" container="body" dropdownClass="dropdown-notifications"
- #dropdown="ngbDropdown" (openChange)="$event === true ? onDropdownShown() : onDropdownHidden()"
+ ngbDropdown
+ autoClose="outside"
+ placement="bottom-end auto"
+ container="body"
+ dropdownClass="dropdown-notifications"
+ #dropdown="ngbDropdown"
+ (openChange)="$event === true ? onDropdownShown() : onDropdownHidden()"
>
<button
- i18n-title title="View your notifications" class="peertube-button tertiary-button rounded-icon-button disable-dropdown-caret notification-inbox-dropdown"
+ i18n-title
+ title="View your notifications"
+ class="peertube-button tertiary-button rounded-icon-button disable-dropdown-caret notification-inbox-dropdown"
[ngClass]="{ 'shown': opened, 'hidden': isInMobileView }"
ngbDropdownToggle
>
@@ -40,33 +51,21 @@
<div ngbDropdownMenu>
<div class="content" [ngClass]="{ loaded: loaded }">
- <div class="notifications-header">
- <div i18n>Notifications</div>
+ <header>
+ <div class="title" i18n>Notifications</div>
- <div>
- <button
- *ngIf="unreadNotifications"
- i18n-title title="Mark all as read" class="me-2 peertube-button tertiary-button rounded-icon-button"
- (click)="markAllAsRead()"
- >
- <my-global-icon iconName="tick"></my-global-icon>
- </button>
-
- <a
- class="peertube-button-link tertiary-button rounded-icon-button"
- i18n-title title="Update your notification preferences"
- routerLink="/my-account/settings" fragment="notifications"
- #settingsNotifications (click)="onNavigate(settingsNotifications)"
- >
- <my-global-icon iconName="cog"></my-global-icon>
- </a>
- </div>
- </div>
+ @if (unreadNotifications > 0) {
+ <my-button i18n-label label="Mark all as read" icon="circle-tick" small="true" (click)="markAllAsRead()" theme="secondary"></my-button>
+ }
+ </header>
@defer (when opened) {
<my-user-notifications
- [ignoreLoadingBar]="true" [infiniteScroll]="false" [itemsPerPage]="10"
- [markAllAsReadSubject]="markAllAsReadSubject" (notificationsLoaded)="onNotificationLoaded()"
+ [ignoreLoadingBar]="true"
+ [infiniteScroll]="false"
+ [itemsPerPage]="10"
+ [markAllAsReadSubject]="markAllAsReadSubject"
+ (notificationsLoaded)="onNotificationLoaded()"
[userNotificationReload]="userNotificationReload"
></my-user-notifications>
}
@@ -75,13 +74,30 @@
<my-loader size="xl" loading="true"></my-loader>
</div>
- <div class="all-notifications">
- <a *ngIf="loaded" class="text-decoration-underline" routerLink="/my-account/notifications" #notifications (click)="onNavigate(notifications)" i18n>
- View all
+ <footer>
+ <a
+ class="text-decoration-underline"
+ i18n-title
+ title="Update your notification preferences"
+ routerLink="/my-account/settings"
+ fragment="notifications"
+ #settingsNotifications
+ (click)="onNavigate(settingsNotifications)"
+ >
+ <my-global-icon iconName="cog" class="me-1 secondary-icon-color"></my-global-icon>
+
+ <ng-container i18n>Settings</ng-container>
</a>
- </div>
+
+ @if (loaded) {
+ <a class="peertube-button-link secondary-button" routerLink="/my-account/notifications">
+ <ng-container i18n>View all</ng-container>
+
+ <my-global-icon iconName="arrow-left" class="rotate-180 ms-2"></my-global-icon>
+ </a>
+ }
+ </footer>
</div>
</div>
-
</div>
}
diff --git a/client/src/app/header/notification-dropdown.component.scss b/client/src/app/header/notification-dropdown.component.scss
index 4ca79f3f77..6fe1dfca28 100644
--- a/client/src/app/header/notification-dropdown.component.scss
+++ b/client/src/app/header/notification-dropdown.component.scss
@@ -1,17 +1,41 @@
-@use '_variables' as *;
-@use '_mixins' as *;
+@use "_variables" as *;
+@use "_mixins" as *;
.content {
scrollbar-color: auto;
+ background: pvar(--bg-secondary-400);
+
+ @include padding(2rem);
+}
+
+header,
+footer {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+}
+
+header {
+ @include margin-bottom(1.5rem);
+
+ .title {
+ color: pvar(--fg-300);
+ font-size: 22px;
+ font-weight: $font-bold;
+ }
+}
+
+footer {
+ @include margin-top(1.5rem);
}
::ng-deep {
.dropdown-notifications {
.dropdown-menu {
padding: 0;
- font-size: 14px;
font-family: $main-fonts;
- width: 400px;
+ width: 550px;
+ max-width: 75vw;
.loader {
display: flex;
@@ -22,7 +46,7 @@
}
.content {
- max-height: 150px;
+ max-height: 250px;
transition: max-height 0.15s ease-out;
display: flex;
height: 500px;
@@ -37,27 +61,6 @@
flex-grow: 1;
}
}
-
- .notifications-header {
- display: flex;
- justify-content: space-between;
-
- border-bottom: 1px solid $separator-border-color-on-secondary;
- align-items: center;
- padding: 0 12px;
- font-size: 14px;
- line-height: normal;
- font-weight: bold;
- text-transform: uppercase;
- min-height: 50px;
- }
-
- .all-notifications {
- border-top: 1px solid $separator-border-color-on-secondary;
- margin-top: -1px; // To not have 2 borders with the last notification
- text-align: center;
- padding: 0.75rem 0;
- }
}
}
}
diff --git a/client/src/app/header/notification-dropdown.component.ts b/client/src/app/header/notification-dropdown.component.ts
index 6ed5f32582..fa880ddd43 100644
--- a/client/src/app/header/notification-dropdown.component.ts
+++ b/client/src/app/header/notification-dropdown.component.ts
@@ -9,6 +9,7 @@ import { UserNotificationsComponent } from '@app/shared/standalone-notifications
import { NgbDropdown, NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'
import { Subject, Subscription } from 'rxjs'
import { filter } from 'rxjs/operators'
+import { ButtonComponent } from '@app/shared/shared-main/buttons/button.component'
@Component({
selector: 'my-notification-dropdown',
@@ -21,7 +22,8 @@ import { filter } from 'rxjs/operators'
LoaderComponent,
RouterLink,
RouterLinkActive,
- NgbDropdownModule
+ NgbDropdownModule,
+ ButtonComponent
]
})
export class NotificationDropdownComponent implements OnInit, OnDestroy {
@@ -33,8 +35,6 @@ export class NotificationDropdownComponent implements OnInit, OnDestroy {
readonly dropdown = viewChild<NgbDropdown>('dropdown')
- readonly navigate = output<HTMLAnchorElement>()
-
unreadNotifications = 0
loaded = false
opened = false
@@ -91,7 +91,6 @@ export class NotificationDropdownComponent implements OnInit, OnDestroy {
onNavigate (link: HTMLAnchorElement) {
this.closeDropdown()
- this.navigate.emit(link)
}
markAllAsRead () {
diff --git a/client/src/app/shared/shared-actor-image/account-on-channel-avatar.component.scss b/client/src/app/shared/shared-actor-image/account-on-channel-avatar.component.scss
index ab22034288..d28d75d174 100644
--- a/client/src/app/shared/shared-actor-image/account-on-channel-avatar.component.scss
+++ b/client/src/app/shared/shared-actor-image/account-on-channel-avatar.component.scss
@@ -1,3 +1,4 @@
+@use "_variables" as *;
@use "_mixins" as *;
.root {
@@ -11,5 +12,9 @@
bottom: -5px;
right: -5px;
background-color: rgba(0, 0, 0, 0);
+ border: 2px solid pvar(--bg-secondary-350);
+ background: pvar(--bg-secondary-350);
+ border-radius: 100%;
+ line-height: 1;
}
}
diff --git a/client/src/app/shared/standalone-notifications/user-notification-content.component.html b/client/src/app/shared/standalone-notifications/user-notification-content.component.html
index 871957c00c..8edbd4d82a 100644
--- a/client/src/app/shared/standalone-notifications/user-notification-content.component.html
+++ b/client/src/app/shared/standalone-notifications/user-notification-content.component.html
@@ -1,4 +1,4 @@
-<div class="root">
+<div class="root" [ngClass]="{ unread: !n.payload.read }">
@switch (n.payload.type) {
@case (1) { <!-- UserNotificationType.NEW_VIDEO_FROM_SUBSCRIPTION -->
@if (n.payload.video) {
@@ -232,26 +232,26 @@
<div i18n>
<strong>{{ n.payload.videoChannelCollaborator.channelOwner.displayName }}</strong> invited you to become an editor of their channel <strong>{{ n.payload.videoChannelCollaborator.channel.displayName }}</strong>
</div>
-
- @if (isChannelCollabRejected(n)) {
- <div class="d-flex gap-1 mt-2 align-items-center">
- <my-global-icon iconName="cross"></my-global-icon>
-
- <div i18n>Invitation declined</div>
- </div>
- } @else if (isChannelCollabInvitation(n)) {
- <div class="d-flex gap-1 mt-2">
- <my-button small="true" icon="tick" (click)="acceptChannelCollab()" i18n>Accept</my-button>
- <my-button small="true" icon="cross" (click)="rejectChannelCollab()" i18n>Decline</my-button>
- </div>
- } @else if (isChannelCollabAccepted(n)) {
- <div class="d-flex gap-1 mt-2 align-items-center">
- <my-global-icon iconName="tick"></my-global-icon>
-
- <div i18n>Invitation accepted</div>
- </div>
- }
</div>
+
+ @if (isChannelCollabRejected(n)) {
+ <div class="action-button">
+ <my-global-icon iconName="cross"></my-global-icon>
+
+ <div i18n>Invitation declined</div>
+ </div>
+ } @else if (isChannelCollabInvitation(n)) {
+ <div class="action-button">
+ <my-button small="true" icon="tick" (click)="acceptChannelCollab()" i18n theme="primary">Accept</my-button>
+ <my-button small="true" icon="cross" (click)="rejectChannelCollab()" i18n theme="secondary">Decline</my-button>
+ </div>
+ } @else if (isChannelCollabAccepted(n)) {
+ <div class="action-button">
+ <my-global-icon iconName="tick"></my-global-icon>
+
+ <div i18n>Invitation accepted</div>
+ </div>
+ }
}
@case (24) { <!-- UserNotificationType.ACCEPTED_TO_COLLABORATE_TO_CHANNEL -->
diff --git a/client/src/app/shared/standalone-notifications/user-notification-content.component.scss b/client/src/app/shared/standalone-notifications/user-notification-content.component.scss
index 689a7aaf87..d0cc110242 100644
--- a/client/src/app/shared/standalone-notifications/user-notification-content.component.scss
+++ b/client/src/app/shared/standalone-notifications/user-notification-content.component.scss
@@ -2,56 +2,113 @@
@use "_mixins" as *;
.root {
- display: flex;
- align-items: center;
- font-size: inherit;
- padding: 1rem 0.5rem;
+ display: grid;
+ grid-template-columns: auto 1fr auto;
+ padding: 1rem 1.5rem;
word-break: break-word;
> my-actor-avatar,
- > my-account-on-channel-avatar {
- display: inline-block;
+ > my-account-on-channel-avatar,
+ > my-global-icon {
+ grid-row: 1;
+ grid-column: 1;
+ }
- @include margin-right(10px);
+ > my-account-on-channel-avatar {
+ // 35px
+ @include margin-right(1rem);
}
> my-global-icon {
color: pvar(--secondary-icon-color);
- @include margin-right(11px);
- @include margin-left(3px);
+ // Icons are smaller than my-account-on-channel-avatar (24px)
+ @include margin-right(calc(1rem + 11px));
}
-}
-my-global-icon {
- color: pvar(--secondary-icon-color);
+ > my-actor-avatar {
+ // Avatars are smaller than my-account-on-channel-avatar (30px)
+ @include margin-right(calc(1rem + 5px));
+ }
}
.message {
- flex-grow: 1;
-
- a {
- font-weight: $font-semibold;
- text-decoration: underline;
- }
+ grid-row: 1;
+ grid-column: 2;
+ min-width: 1px;
}
.from-date {
- font-size: 0.85em;
- color: pvar(--fg-200);
- min-width: 70px;
+ grid-row: 1;
+ grid-column: 3;
+ font-size: 0.85rem;
text-align: end;
- text-decoration: none;
+ white-space: nowrap;
+ line-height: 1.5rem; // Align with message line height
- @include padding-left(5px);
+ @include padding-left(0.5rem);
@include margin-left(auto);
}
+.root.unread {
+ .message,
+ .action-button {
+ color: pvar(--fg-400);
+ }
+
+ .from-date {
+ color: pvar(--fg-200);
+ font-weight: $font-bold;
+ }
+}
+
+.root:not(.unread) {
+ .message,
+ .action-button {
+ color: pvar(--fg-200);
+ }
+
+ .from-date {
+ color: pvar(--secondary-icon-color);
+ }
+}
+
+.action-button {
+ grid-column: 1 / 4;
+ display: flex;
+ gap: 0.5rem;
+ margin-top: 0.5rem;
+ justify-content: flex-end;
+ align-items: center;
+
+ @include font-size(14px);
+}
+
.limit-characters {
display: inline-block;
- max-width: 800px;
+ max-width: 100%;
vertical-align: bottom;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
+
+@include on-small-main-col {
+ .root {
+ grid-template-columns: auto 1fr;
+ }
+
+ .message {
+ grid-row: 2;
+ grid-column: 1 / 3;
+ }
+
+ .action-button {
+ grid-row: 3;
+ grid-column: 1 / 3;
+ }
+
+ .from-date {
+ grid-column: 2;
+ }
+}
diff --git a/client/src/app/shared/standalone-notifications/user-notifications.component.scss b/client/src/app/shared/standalone-notifications/user-notifications.component.scss
index bc34f6f45a..3d271a886c 100644
--- a/client/src/app/shared/standalone-notifications/user-notifications.component.scss
+++ b/client/src/app/shared/standalone-notifications/user-notifications.component.scss
@@ -19,19 +19,21 @@ li {
.notification {
display: block;
- border-bottom: 1px solid $separator-border-color-on-secondary;
+ margin-bottom: 0.5rem;
text-decoration: none;
&.unread {
- background-color: pvar(--bg-secondary-400);
+ border-top: 2px solid pvar(--primary);
+ background-color: pvar(--bg);
+ }
- &:hover {
- opacity: 1;
- }
+ &:not(.unread) {
+ background-color: pvar(--bg-secondary-350);
}
&:hover {
- background-color: pvar(--bg-secondary-350);
+ opacity: 1;
+ background-color: pvar(--bg-secondary-300);
}
&.button-unstyle {
diff --git a/client/src/sass/class-helpers/_images.scss b/client/src/sass/class-helpers/_images.scss
index c504c57f48..2f6dcbe9d7 100644
--- a/client/src/sass/class-helpers/_images.scss
+++ b/client/src/sass/class-helpers/_images.scss
@@ -1,8 +1,8 @@
-@use '_variables' as *;
-@use '_mixins' as *;
+@use "_variables" as *;
+@use "_mixins" as *;
.banner {
- @include block-ratio('img', $banner-inverted-ratio);
+ @include block-ratio("img", $banner-inverted-ratio);
img {
border-radius: 15px;
@@ -12,3 +12,7 @@
.pt-icon {
@include icon(24px);
}
+
+.secondary-icon-color {
+ color: pvar(--secondary-icon-color);
+}