]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts
Rename studio to editor
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-main / misc / top-menu-dropdown.component.ts
index ba55685956b3497a0b13f38a93eace996ace8701..a8cc9b593fa9d263536eb7f0bac5afba676622a6 100644 (file)
@@ -3,6 +3,7 @@ import { filter } from 'rxjs/operators'
 import { Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core'
 import { NavigationEnd, Router } from '@angular/router'
 import { MenuService, ScreenService } from '@app/core'
+import { scrollToTop } from '@app/helpers'
 import { GlobalIconName } from '@app/shared/shared-icons'
 import { NgbDropdown, NgbModal } from '@ng-bootstrap/ng-bootstrap'
 
@@ -65,7 +66,7 @@ export class TopMenuDropdownComponent implements OnInit, OnDestroy {
       .subscribe(() => this.updateChildLabels(window.location.pathname))
 
     this.hasIcons = this.menuEntries.some(
-      e => e.children && e.children.some(c => !!c.iconName)
+      e => e.children?.some(c => !!c.iconName)
     )
   }
 
@@ -83,8 +84,9 @@ export class TopMenuDropdownComponent implements OnInit, OnDestroy {
 
     this.modalService.open(this.modal, {
       centered: true,
-      beforeDismiss: async () => {
+      beforeDismiss: () => {
         this.onModalDismiss()
+
         return true
       }
     })
@@ -96,11 +98,7 @@ export class TopMenuDropdownComponent implements OnInit, OnDestroy {
 
   onActiveLinkScrollToTop (link: HTMLAnchorElement) {
     if (!this.isBroadcastMessageDisplayed && this.router.url.includes(link.getAttribute('href'))) {
-      window.scrollTo({
-        left: 0,
-        top: 0,
-        behavior: 'smooth'
-      })
+      scrollToTop('smooth')
     }
   }