diff options
author | Kim <1877318+kimsible@users.noreply.github.com> | 2020-08-17 10:13:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-17 10:13:31 +0200 |
commit | 30d55e75cae1adec3fc43c84691975bf8b97db34 (patch) | |
tree | 74df7fabda72d88b60d6d8d20ba9cd95d1cf4858 /client/src/app/menu/avatar-notification.component.ts | |
parent | 28fbb88f93859a7f6bbf124cb8df1e1a37fd1285 (diff) | |
download | PeerTube-30d55e75cae1adec3fc43c84691975bf8b97db34.tar.gz PeerTube-30d55e75cae1adec3fc43c84691975bf8b97db34.tar.zst PeerTube-30d55e75cae1adec3fc43c84691975bf8b97db34.zip |
Add restore scroll position on user-dropdown anchors links and scroll to top on active sub-menu links (#3066)
* Add restore scroll position on router same url
* Remove settings top anchor
* Add scrollToTop on active links fixed sub-menu
* Add restore scroll position on notification avatar links
* Toggle menu and close pophover when click on active dropdown menu-left link
* Add onSameUrlRestoreScrollPosition on user dropdown channels link
* Same behavior scrollTop and scroll to anchor everywhere
Co-authored-by: kimsible <kimsible@users.noreply.github.com>
Diffstat (limited to 'client/src/app/menu/avatar-notification.component.ts')
-rw-r--r-- | client/src/app/menu/avatar-notification.component.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/client/src/app/menu/avatar-notification.component.ts b/client/src/app/menu/avatar-notification.component.ts index 9a64faa6a..8b9955069 100644 --- a/client/src/app/menu/avatar-notification.component.ts +++ b/client/src/app/menu/avatar-notification.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Subject, Subscription } from 'rxjs' | 1 | import { Subject, Subscription } from 'rxjs' |
2 | import { filter } from 'rxjs/operators' | 2 | import { filter } from 'rxjs/operators' |
3 | import { Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core' | 3 | import { Component, EventEmitter, Input, Output, OnDestroy, OnInit, ViewChild } from '@angular/core' |
4 | import { NavigationEnd, Router } from '@angular/router' | 4 | import { NavigationEnd, Router } from '@angular/router' |
5 | import { Notifier, User, UserNotificationSocket } from '@app/core' | 5 | import { Notifier, User, UserNotificationSocket } from '@app/core' |
6 | import { UserNotificationService } from '@app/shared/shared-main' | 6 | import { UserNotificationService } from '@app/shared/shared-main' |
@@ -15,6 +15,7 @@ export class AvatarNotificationComponent implements OnInit, OnDestroy { | |||
15 | @ViewChild('popover', { static: true }) popover: NgbPopover | 15 | @ViewChild('popover', { static: true }) popover: NgbPopover |
16 | 16 | ||
17 | @Input() user: User | 17 | @Input() user: User |
18 | @Output() navigate = new EventEmitter<HTMLAnchorElement>() | ||
18 | 19 | ||
19 | unreadNotifications = 0 | 20 | unreadNotifications = 0 |
20 | loaded = false | 21 | loaded = false |
@@ -65,6 +66,10 @@ export class AvatarNotificationComponent implements OnInit, OnDestroy { | |||
65 | this.loaded = true | 66 | this.loaded = true |
66 | } | 67 | } |
67 | 68 | ||
69 | onNavigate (link: HTMLAnchorElement) { | ||
70 | this.navigate.emit(link) | ||
71 | } | ||
72 | |||
68 | markAllAsRead () { | 73 | markAllAsRead () { |
69 | this.markAllAsReadSubject.next(true) | 74 | this.markAllAsReadSubject.next(true) |
70 | } | 75 | } |