diff --git a/frontend/src/app/components/resizer/main-menu-toggle.component.ts b/frontend/src/app/components/resizer/main-menu-toggle.component.ts
index 88150b0021..fd1ede8315 100644
--- a/frontend/src/app/components/resizer/main-menu-toggle.component.ts
+++ b/frontend/src/app/components/resizer/main-menu-toggle.component.ts
@@ -33,12 +33,13 @@ import {untilComponentDestroyed} from 'ng2-rx-componentdestroyed';
import {MainMenuResizerComponent} from "core-components/resizer/main-menu-resizer.component";
import {DynamicBootstrapper} from "core-app/globals/dynamic-bootstrapper";
import {CurrentProjectService} from "core-components/projects/current-project.service";
+import {DeviceService} from "app/modules/common/browser/device.service";
import {Injector} from "@angular/core";
@Component({
selector: 'main-menu-toggle',
template: `
-
Groesse der Sidebar setzen
-* collapsed boolean setzen, label im resizer und hamburger icon setzen
-*
-*/
export class MainMenuToggleComponent implements OnInit, OnDestroy {
toggleTitle:string = "";
currentProject:CurrentProjectService = this.injector.get(CurrentProjectService);
constructor(readonly toggleService:MainMenuToggleService,
readonly cdRef:ChangeDetectorRef,
+ readonly deviceService:DeviceService,
protected injector:Injector) {
}
diff --git a/frontend/src/app/components/resizer/main-menu-toggle.service.ts b/frontend/src/app/components/resizer/main-menu-toggle.service.ts
index c794478379..db50908abd 100644
--- a/frontend/src/app/components/resizer/main-menu-toggle.service.ts
+++ b/frontend/src/app/components/resizer/main-menu-toggle.service.ts
@@ -30,6 +30,7 @@ import {Injectable} from '@angular/core';
import {BehaviorSubject, fromEvent, Observable, Subscription} from 'rxjs';
import {I18nService} from "core-app/modules/common/i18n/i18n.service";
import {CurrentProjectService} from "core-components/projects/current-project.service";
+import {DeviceService} from "app/modules/common/browser/device.service";
import {Injector} from "@angular/core";
@Injectable()
@@ -58,7 +59,8 @@ export class MainMenuToggleService {
private resizeSubscription$:Subscription;
constructor(protected I18n:I18nService,
- protected injector:Injector) {
+ protected injector:Injector,
+ readonly deviceService:DeviceService) {
}
public initializeMenu():void {
@@ -78,7 +80,7 @@ export class MainMenuToggleService {
}
// mobile version default: hide menu on initialization
- if (this.isMobile) {
+ if (this.deviceService.isMobile) {
this.closeMenu();
}
}
@@ -91,7 +93,7 @@ export class MainMenuToggleService {
}
if (!this.showNavigation) { // sidebar is hidden -> show menu
- if (this.isMobile) { // mobile version
+ if (this.deviceService.isMobile) { // mobile version
this.setWidth(window.innerWidth);
// On mobile the main menu shall close whenever you click outside the menu.
this.setupAutocloseMainMenu();
@@ -113,7 +115,7 @@ export class MainMenuToggleService {
}
public closeMenu():void {
- if (this.isMobile) {
+ if (this.deviceService.isMobile) {
this.saveWidth(0);
} else {
this.setWidth(0);
@@ -122,7 +124,7 @@ export class MainMenuToggleService {
}
public closeWhenOnMobile():void {
- if (this.isMobile) {
+ if (this.deviceService.isMobile) {
this.closeMenu()
};
}
@@ -206,10 +208,6 @@ export class MainMenuToggleService {
}
}
- public get isMobile():boolean {
- return (window.innerWidth < 680);
- }
-
public get showNavigation():boolean {
return (this.elementWidth > 10);
}