X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fapp.component.ts;h=7583fdee88712a0b1e0a5655646b8eaa61100a9d;hb=6d28a5056efc68da51c7ef00d563f3557a72bc49;hp=7cd0fff1baf041c4246913ea279b691366c22cb8;hpb=e33f888b86734f7e050a5e3d6f73f852b6de955a;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index 7cd0fff1b..7583fdee8 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts @@ -4,9 +4,10 @@ import { GuardsCheckStart, NavigationEnd, Router } from '@angular/router' import { AuthService, RedirectService, ServerService, ThemeService } from '@app/core' import { is18nPath } from '../../../shared/models/i18n' import { ScreenService } from '@app/shared/misc/screen.service' -import { skip } from 'rxjs/operators' +import { skip, debounceTime } from 'rxjs/operators' import { HotkeysService, Hotkey } from 'angular2-hotkeys' import { I18n } from '@ngx-translate/i18n-polyfill' +import { fromEvent } from 'rxjs' @Component({ selector: 'my-app', @@ -14,20 +15,8 @@ import { I18n } from '@ngx-translate/i18n-polyfill' styleUrls: [ './app.component.scss' ] }) export class AppComponent implements OnInit { - notificationOptions = { - timeOut: 5000, - lastOnBottom: true, - clickToClose: true, - maxLength: 0, - maxStack: 7, - showProgressBar: false, - pauseOnHover: false, - preventDuplicates: false, - preventLastDuplicates: 'visible', - rtl: false - } - isMenuDisplayed = true + isMenuChangedByUser = false customCSS: SafeHtml @@ -165,6 +154,10 @@ export class AppComponent implements OnInit { return false }, undefined, this.i18n('Toggle Dark theme')) ]) + + fromEvent(window, 'resize') + .pipe(debounceTime(200)) + .subscribe(() => this.onResize()) } isUserLoggedIn () { @@ -173,5 +166,10 @@ export class AppComponent implements OnInit { toggleMenu () { this.isMenuDisplayed = !this.isMenuDisplayed + this.isMenuChangedByUser = true + } + + onResize () { + this.isMenuDisplayed = window.innerWidth >= 800 && !this.isMenuChangedByUser } }