diff options
Diffstat (limited to 'client/src/app/shared')
-rw-r--r-- | client/src/app/shared/menu/top-menu-dropdown.component.html | 2 | ||||
-rw-r--r-- | client/src/app/shared/menu/top-menu-dropdown.component.ts | 17 | ||||
-rw-r--r-- | client/src/app/shared/misc/screen.service.ts | 7 |
3 files changed, 16 insertions, 10 deletions
diff --git a/client/src/app/shared/menu/top-menu-dropdown.component.html b/client/src/app/shared/menu/top-menu-dropdown.component.html index d577f757d..07ec1ac97 100644 --- a/client/src/app/shared/menu/top-menu-dropdown.component.html +++ b/client/src/app/shared/menu/top-menu-dropdown.component.html | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | <a *ngIf="menuEntry.routerLink" [routerLink]="menuEntry.routerLink" routerLinkActive="active" class="title-page title-page-settings">{{ menuEntry.label }}</a> | 4 | <a *ngIf="menuEntry.routerLink" [routerLink]="menuEntry.routerLink" routerLinkActive="active" class="title-page title-page-settings">{{ menuEntry.label }}</a> |
5 | 5 | ||
6 | <div *ngIf="!menuEntry.routerLink" ngbDropdown [container]="container" class="parent-entry" | 6 | <div *ngIf="!menuEntry.routerLink" ngbDropdown container="body" class="parent-entry" |
7 | #dropdown="ngbDropdown" (mouseleave)="closeDropdownIfHovered(dropdown)"> | 7 | #dropdown="ngbDropdown" (mouseleave)="closeDropdownIfHovered(dropdown)"> |
8 | <span | 8 | <span |
9 | *ngIf="isInSmallView" | 9 | *ngIf="isInSmallView" |
diff --git a/client/src/app/shared/menu/top-menu-dropdown.component.ts b/client/src/app/shared/menu/top-menu-dropdown.component.ts index f98240804..3f121e785 100644 --- a/client/src/app/shared/menu/top-menu-dropdown.component.ts +++ b/client/src/app/shared/menu/top-menu-dropdown.component.ts | |||
@@ -11,6 +11,7 @@ import { Subscription } from 'rxjs' | |||
11 | import { NgbDropdown, NgbModal } from '@ng-bootstrap/ng-bootstrap' | 11 | import { NgbDropdown, NgbModal } from '@ng-bootstrap/ng-bootstrap' |
12 | import { GlobalIconName } from '@app/shared/images/global-icon.component' | 12 | import { GlobalIconName } from '@app/shared/images/global-icon.component' |
13 | import { ScreenService } from '@app/shared/misc/screen.service' | 13 | import { ScreenService } from '@app/shared/misc/screen.service' |
14 | import { MenuService } from '@app/core/menu' | ||
14 | 15 | ||
15 | export type TopMenuDropdownParam = { | 16 | export type TopMenuDropdownParam = { |
16 | label: string | 17 | label: string |
@@ -36,7 +37,6 @@ export class TopMenuDropdownComponent implements OnInit, OnDestroy { | |||
36 | 37 | ||
37 | suffixLabels: { [ parentLabel: string ]: string } | 38 | suffixLabels: { [ parentLabel: string ]: string } |
38 | hasIcons = false | 39 | hasIcons = false |
39 | container: undefined | 'body' = undefined | ||
40 | isModalOpened = false | 40 | isModalOpened = false |
41 | currentMenuEntryIndex: number | 41 | currentMenuEntryIndex: number |
42 | 42 | ||
@@ -46,11 +46,17 @@ export class TopMenuDropdownComponent implements OnInit, OnDestroy { | |||
46 | constructor ( | 46 | constructor ( |
47 | private router: Router, | 47 | private router: Router, |
48 | private modalService: NgbModal, | 48 | private modalService: NgbModal, |
49 | private screen: ScreenService | 49 | private screen: ScreenService, |
50 | private menuService: MenuService | ||
50 | ) { } | 51 | ) { } |
51 | 52 | ||
52 | get isInSmallView () { | 53 | get isInSmallView () { |
53 | return this.screen.isInSmallView() | 54 | let marginLeft = 0 |
55 | if (this.menuService.isMenuDisplayed) { | ||
56 | marginLeft = this.menuService.menuWidth | ||
57 | } | ||
58 | |||
59 | return this.screen.isInSmallView(marginLeft) | ||
54 | } | 60 | } |
55 | 61 | ||
56 | ngOnInit () { | 62 | ngOnInit () { |
@@ -63,11 +69,6 @@ export class TopMenuDropdownComponent implements OnInit, OnDestroy { | |||
63 | this.hasIcons = this.menuEntries.some( | 69 | this.hasIcons = this.menuEntries.some( |
64 | e => e.children && e.children.some(c => !!c.iconName) | 70 | e => e.children && e.children.some(c => !!c.iconName) |
65 | ) | 71 | ) |
66 | |||
67 | // We have to set body for the container to avoid scroll overflow on mobile and small views | ||
68 | if (this.isInSmallView) { | ||
69 | this.container = 'body' | ||
70 | } | ||
71 | } | 72 | } |
72 | 73 | ||
73 | ngOnDestroy () { | 74 | ngOnDestroy () { |
diff --git a/client/src/app/shared/misc/screen.service.ts b/client/src/app/shared/misc/screen.service.ts index 9c71a8c83..fa9c71e5b 100644 --- a/client/src/app/shared/misc/screen.service.ts +++ b/client/src/app/shared/misc/screen.service.ts | |||
@@ -10,7 +10,12 @@ export class ScreenService { | |||
10 | this.refreshWindowInnerWidth() | 10 | this.refreshWindowInnerWidth() |
11 | } | 11 | } |
12 | 12 | ||
13 | isInSmallView () { | 13 | isInSmallView (marginLeft = 0) { |
14 | if (marginLeft > 0) { | ||
15 | const contentWidth = this.getWindowInnerWidth() - marginLeft | ||
16 | return contentWidth < 800 | ||
17 | } | ||
18 | |||
14 | return this.getWindowInnerWidth() < 800 | 19 | return this.getWindowInnerWidth() < 800 |
15 | } | 20 | } |
16 | 21 | ||