diff --git a/client/src/app/menu/menu.component.html b/client/src/app/menu/menu.component.html index 2a849dcb0..2e8fab69e 100644 --- a/client/src/app/menu/menu.component.html +++ b/client/src/app/menu/menu.component.html @@ -79,7 +79,7 @@ @defer (when isLoggedIn) { - + } diff --git a/client/src/app/menu/menu.component.scss b/client/src/app/menu/menu.component.scss index 525dc8b58..9aaacdcb0 100644 --- a/client/src/app/menu/menu.component.scss +++ b/client/src/app/menu/menu.component.scss @@ -116,7 +116,7 @@ nav { } } -my-notification { +my-notification-dropdown { @include margin-left(auto); @include margin-right(15px); } diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts index 1d8b01124..b77cbd298 100644 --- a/client/src/app/menu/menu.component.ts +++ b/client/src/app/menu/menu.component.ts @@ -27,7 +27,7 @@ import debug from 'debug' import { forkJoin, Subscription } from 'rxjs' import { first, switchMap } from 'rxjs/operators' import { LanguageChooserComponent } from './language-chooser.component' -import { NotificationComponent } from './notification.component' +import { NotificationDropdownComponent } from './notification-dropdown.component' import { QuickSettingsModalComponent } from './quick-settings-modal.component' const debugLogger = debug('peertube:menu:MenuComponent') @@ -39,7 +39,7 @@ const debugLogger = debug('peertube:menu:MenuComponent') standalone: true, imports: [ CommonModule, - NotificationComponent, + NotificationDropdownComponent, ActorAvatarComponent, InputSwitchComponent, SignupLabelComponent, diff --git a/client/src/app/menu/notification-dropdown.component.html b/client/src/app/menu/notification-dropdown.component.html new file mode 100644 index 000000000..edc6ef19d --- /dev/null +++ b/client/src/app/menu/notification-dropdown.component.html @@ -0,0 +1,70 @@ + +
{{ unreadNotifications }}
+
99+
+
+ +@if (isInMobileView) { + +} @else { +
+ + +
+
+
+
Notifications
+ +
+ + + + + +
+
+ +
+ +
+ + + + + + See all your notifications + +
+
+ +
+} diff --git a/client/src/app/menu/notification.component.scss b/client/src/app/menu/notification-dropdown.component.scss similarity index 85% rename from client/src/app/menu/notification.component.scss rename to client/src/app/menu/notification-dropdown.component.scss index 15057b6b6..be2dd4ad7 100644 --- a/client/src/app/menu/notification.component.scss +++ b/client/src/app/menu/notification-dropdown.component.scss @@ -5,7 +5,7 @@ scrollbar-color: auto; } -.notification-inbox-popover { +.notification-inbox-dropdown { padding: 10px; } @@ -13,7 +13,7 @@ padding: 13px 10px; } -.notification-inbox-popover, +.notification-inbox-dropdown, .notification-inbox-link a { transition: all .1s ease-in-out; border-radius: 25px; @@ -33,7 +33,7 @@ } } -.notification-inbox-popover.shown, +.notification-inbox-dropdown.shown, .notification-inbox-link a.active { background-color: rgba(255, 255, 255, 0.28); box-shadow: inset 0 3px 5px rgba(0, 0, 0, .325); @@ -41,21 +41,17 @@ @include apply-svg-color(#fff); } -.notification-inbox-popover.hidden { +.notification-inbox-dropdown.hidden { display: none; } ::ng-deep { - .popover-notifications.popover { + .dropdown-notifications { max-width: none; top: -6px !important; left: 7px !important; - .arrow { - display: none; - } - - .popover-body { + .dropdown-menu { padding: 0; font-size: 14px; font-family: $main-fonts; @@ -130,20 +126,23 @@ } .all-notifications { - display: flex; - align-items: center; - justify-content: center; + border-top: 1px solid rgba(0, 0, 0, 0.1); + margin-top: -1px; // To not have 2 borders with the last notification + text-align: center; font-weight: $font-semibold; color: pvar(--mainForegroundColor); - padding: 7px 0; - margin-top: auto; - text-decoration: none; + padding: 0.75rem 0; + text-decoration: underline !important; + + &:hover { + opacity: 0.85; + } } } } } -.notification-inbox-popover, +.notification-inbox-dropdown, .notification-inbox-link { cursor: pointer; position: relative; diff --git a/client/src/app/menu/notification.component.ts b/client/src/app/menu/notification-dropdown.component.ts similarity index 71% rename from client/src/app/menu/notification.component.ts rename to client/src/app/menu/notification-dropdown.component.ts index 067249e3c..aca938eb7 100644 --- a/client/src/app/menu/notification.component.ts +++ b/client/src/app/menu/notification-dropdown.component.ts @@ -6,14 +6,14 @@ import { GlobalIconComponent } from '@app/shared/shared-icons/global-icon.compon import { LoaderComponent } from '@app/shared/shared-main/loaders/loader.component' import { UserNotificationService } from '@app/shared/shared-main/users/user-notification.service' import { UserNotificationsComponent } from '@app/shared/standalone-notifications/user-notifications.component' -import { NgbPopover, NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap' +import { NgbDropdown, NgbDropdownModule, NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap' import { Subject, Subscription } from 'rxjs' import { filter } from 'rxjs/operators' @Component({ - selector: 'my-notification', - templateUrl: './notification.component.html', - styleUrls: [ './notification.component.scss' ], + selector: 'my-notification-dropdown', + templateUrl: './notification-dropdown.component.html', + styleUrls: [ './notification-dropdown.component.scss' ], standalone: true, imports: [ CommonModule, @@ -22,11 +22,12 @@ import { filter } from 'rxjs/operators' GlobalIconComponent, LoaderComponent, RouterLink, - RouterLinkActive + RouterLinkActive, + NgbDropdownModule ] }) -export class NotificationComponent implements OnInit, OnDestroy { - @ViewChild('popover', { static: true }) popover: NgbPopover +export class NotificationDropdownComponent implements OnInit, OnDestroy { + @ViewChild('dropdown', { static: false }) dropdown: NgbDropdown @Output() navigate = new EventEmitter() @@ -61,7 +62,7 @@ export class NotificationComponent implements OnInit, OnDestroy { this.routeSub = this.router.events .pipe(filter(event => event instanceof NavigationEnd)) - .subscribe(() => this.closePopover()) + .subscribe(() => this.closeDropdown()) } ngOnDestroy () { @@ -73,29 +74,17 @@ export class NotificationComponent implements OnInit, OnDestroy { return this.screenService.isInMobileView() } - closePopover () { - this.popover.close() + closeDropdown () { + if (this.dropdown) this.dropdown.close() } - onPopoverShown () { + onDropdownShown () { this.opened = true - - document.querySelector('nav').scrollTo(0, 0) // Reset menu scroll to easy lock - // eslint-disable-next-line @typescript-eslint/unbound-method - document.querySelector('nav').addEventListener('scroll', this.onMenuScrollEvent) } - onPopoverHidden () { + onDropdownHidden () { this.loaded = false this.opened = false - - // eslint-disable-next-line @typescript-eslint/unbound-method - document.querySelector('nav').removeEventListener('scroll', this.onMenuScrollEvent) - } - - // Lock menu scroll when menu scroll to avoid fleeing / detached dropdown - onMenuScrollEvent () { - document.querySelector('nav').scrollTo(0, 0) } onNotificationLoaded () { @@ -103,7 +92,7 @@ export class NotificationComponent implements OnInit, OnDestroy { } onNavigate (link: HTMLAnchorElement) { - this.closePopover() + this.closeDropdown() this.navigate.emit(link) } diff --git a/client/src/app/menu/notification.component.html b/client/src/app/menu/notification.component.html deleted file mode 100644 index 921d7643f..000000000 --- a/client/src/app/menu/notification.component.html +++ /dev/null @@ -1,63 +0,0 @@ - -
{{ unreadNotifications }}
-
99+
-
- - - - - - -
-
-
Notifications
- -
- - - - - -
-
- -
- -
- - - - - - See all your notifications - -
-
diff --git a/client/src/sass/bootstrap.scss b/client/src/sass/bootstrap.scss index 3b3025b0f..b8f47d2be 100644 --- a/client/src/sass/bootstrap.scss +++ b/client/src/sass/bootstrap.scss @@ -102,6 +102,10 @@ body { margin: 0.3rem 0; } +.disable-dropdown-caret::after { + display: none; +} + // --------------------------------------------------------------------------- // Alert // ---------------------------------------------------------------------------