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',
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
return false
}, undefined, this.i18n('Toggle Dark theme'))
])
+
+ fromEvent(window, 'resize')
+ .pipe(debounceTime(200))
+ .subscribe(() => this.onResize())
}
isUserLoggedIn () {
toggleMenu () {
this.isMenuDisplayed = !this.isMenuDisplayed
+ this.isMenuChangedByUser = true
+ }
+
+ onResize () {
+ this.isMenuDisplayed = window.innerWidth >= 800 && !this.isMenuChangedByUser
}
}