aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/misc
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-22 13:59:54 +0200
committerChocobozzz <me@florianbigard.com>2019-08-22 13:59:54 +0200
commit6eb62c33908025d877a28f1cfbc527c511ae3103 (patch)
tree90544c222a721e878ee69f0a15a339d4dc67cb18 /client/src/app/shared/misc
parenta3671f0709f3f423819fcfed47a4d4879cf82780 (diff)
downloadPeerTube-6eb62c33908025d877a28f1cfbc527c511ae3103.tar.gz
PeerTube-6eb62c33908025d877a28f1cfbc527c511ae3103.tar.zst
PeerTube-6eb62c33908025d877a28f1cfbc527c511ae3103.zip
Fix video rows overflow
In discover and account channel videos pages
Diffstat (limited to 'client/src/app/shared/misc')
-rw-r--r--client/src/app/shared/misc/screen.service.ts16
1 files changed, 15 insertions, 1 deletions
diff --git a/client/src/app/shared/misc/screen.service.ts b/client/src/app/shared/misc/screen.service.ts
index af75569d9..220d41d59 100644
--- a/client/src/app/shared/misc/screen.service.ts
+++ b/client/src/app/shared/misc/screen.service.ts
@@ -22,8 +22,22 @@ export class ScreenService {
22 return 'ontouchstart' in window || navigator.msMaxTouchPoints 22 return 'ontouchstart' in window || navigator.msMaxTouchPoints
23 } 23 }
24 24
25 getNumberOfAvailableMiniatures () {
26 const screenWidth = this.getWindowInnerWidth()
27
28 let numberOfVideos = 1
29
30 if (screenWidth > 1850) numberOfVideos = 6
31 else if (screenWidth > 1600) numberOfVideos = 5
32 else if (screenWidth > 1370) numberOfVideos = 4
33 else if (screenWidth > 1100) numberOfVideos = 3
34 else if (screenWidth > 850) numberOfVideos = 2
35
36 return numberOfVideos
37 }
38
25 // Cache window inner width, because it's an expensive call 39 // Cache window inner width, because it's an expensive call
26 private getWindowInnerWidth () { 40 getWindowInnerWidth () {
27 if (this.cacheWindowInnerWidthExpired()) this.refreshWindowInnerWidth() 41 if (this.cacheWindowInnerWidthExpired()) this.refreshWindowInnerWidth()
28 42
29 return this.windowInnerWidth 43 return this.windowInnerWidth