aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/misc
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-02-13 10:41:43 +0100
committerChocobozzz <me@florianbigard.com>2020-02-13 10:41:43 +0100
commit68ca61941e3a7ca4c018566d2c496afd27dbd76d (patch)
tree481e2bb156f39e4983f02ab4b5ed1093ce3b4fdd /client/src/app/shared/misc
parent72ab1bc82d4357ed869b8828badb33258aea942d (diff)
downloadPeerTube-68ca61941e3a7ca4c018566d2c496afd27dbd76d.tar.gz
PeerTube-68ca61941e3a7ca4c018566d2c496afd27dbd76d.tar.zst
PeerTube-68ca61941e3a7ca4c018566d2c496afd27dbd76d.zip
Fix list overflow when refreshing the page
Diffstat (limited to 'client/src/app/shared/misc')
-rw-r--r--client/src/app/shared/misc/list-overflow.component.ts23
1 files changed, 14 insertions, 9 deletions
diff --git a/client/src/app/shared/misc/list-overflow.component.ts b/client/src/app/shared/misc/list-overflow.component.ts
index 4f92c0f7c..c493ab795 100644
--- a/client/src/app/shared/misc/list-overflow.component.ts
+++ b/client/src/app/shared/misc/list-overflow.component.ts
@@ -1,17 +1,18 @@
1import { 1import {
2 AfterViewInit,
3 ChangeDetectionStrategy,
4 ChangeDetectorRef,
2 Component, 5 Component,
6 ElementRef,
7 HostListener,
3 Input, 8 Input,
9 QueryList,
4 TemplateRef, 10 TemplateRef,
5 ViewChildren,
6 ViewChild, 11 ViewChild,
7 QueryList, 12 ViewChildren
8 ChangeDetectionStrategy,
9 ElementRef,
10 ChangeDetectorRef,
11 HostListener
12} from '@angular/core' 13} from '@angular/core'
13import { NgbModal, NgbDropdown } from '@ng-bootstrap/ng-bootstrap' 14import { NgbDropdown, NgbModal } from '@ng-bootstrap/ng-bootstrap'
14import { uniqueId, lowerFirst } from 'lodash-es' 15import { lowerFirst, uniqueId } from 'lodash-es'
15import { ScreenService } from './screen.service' 16import { ScreenService } from './screen.service'
16import { take } from 'rxjs/operators' 17import { take } from 'rxjs/operators'
17 18
@@ -26,7 +27,7 @@ export interface ListOverflowItem {
26 styleUrls: [ './list-overflow.component.scss' ], 27 styleUrls: [ './list-overflow.component.scss' ],
27 changeDetection: ChangeDetectionStrategy.OnPush 28 changeDetection: ChangeDetectionStrategy.OnPush
28}) 29})
29export class ListOverflowComponent<T extends ListOverflowItem> { 30export class ListOverflowComponent<T extends ListOverflowItem> implements AfterViewInit {
30 @ViewChild('modal', { static: true }) modal: ElementRef 31 @ViewChild('modal', { static: true }) modal: ElementRef
31 @ViewChild('itemsParent', { static: true }) parent: ElementRef<HTMLDivElement> 32 @ViewChild('itemsParent', { static: true }) parent: ElementRef<HTMLDivElement>
32 @ViewChildren('itemsRendered') itemsRendered: QueryList<ElementRef> 33 @ViewChildren('itemsRendered') itemsRendered: QueryList<ElementRef>
@@ -46,6 +47,10 @@ export class ListOverflowComponent<T extends ListOverflowItem> {
46 private screenService: ScreenService 47 private screenService: ScreenService
47 ) {} 48 ) {}
48 49
50 ngAfterViewInit () {
51 setTimeout(() => this.onWindowResize(), 0)
52 }
53
49 isMenuDisplayed () { 54 isMenuDisplayed () {
50 return !!this.showItemsUntilIndexExcluded 55 return !!this.showItemsUntilIndexExcluded
51 } 56 }