]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Video previews take all the width on mobile
authorChocobozzz <me@florianbigard.com>
Fri, 9 Feb 2018 08:30:37 +0000 (09:30 +0100)
committerChocobozzz <me@florianbigard.com>
Fri, 9 Feb 2018 08:30:37 +0000 (09:30 +0100)
client/src/app/app.component.ts
client/src/app/shared/forms/markdown-textarea.component.ts
client/src/app/shared/misc/utils.ts
client/src/app/shared/video/abstract-video-list.scss
client/src/app/shared/video/abstract-video-list.ts
client/src/app/shared/video/video-thumbnail.component.html
client/src/app/shared/video/video-thumbnail.component.scss
client/src/app/shared/video/video-thumbnail.component.ts
client/src/manifest.json
client/src/sass/include/_variables.scss

index 121e60ffc1466b714351448ad90414cc80b6fa2a..220b104b7f12f9ebdc0969fd91a0c764216fbaa7 100644 (file)
@@ -1,7 +1,7 @@
 import { Component, OnInit } from '@angular/core'
 import { GuardsCheckStart, NavigationEnd, Router } from '@angular/router'
 import { AuthService, ServerService } from '@app/core'
-import { isInMobileView } from '@app/shared/misc/utils'
+import { isInSmallView } from '@app/shared/misc/utils'
 
 @Component({
   selector: 'my-app',
@@ -54,14 +54,14 @@ export class AppComponent implements OnInit {
     this.serverService.loadVideoPrivacies()
 
     // Do not display menu on small screens
-    if (isInMobileView()) {
+    if (isInSmallView()) {
       this.isMenuDisplayed = false
     }
 
     this.router.events.subscribe(
       e => {
         // User clicked on a link in the menu, change the page
-        if (e instanceof GuardsCheckStart && isInMobileView()) {
+        if (e instanceof GuardsCheckStart && isInSmallView()) {
           this.isMenuDisplayed = false
         }
       }
index 20f13b28c48242e26a77d3e3914234f6814f8b79..2eae1b27e07f8e8e2474e6eb30cbd527210bf57f 100644 (file)
@@ -2,7 +2,7 @@ import { Component, forwardRef, Input, OnInit } from '@angular/core'
 import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
 import 'rxjs/add/operator/debounceTime'
 import 'rxjs/add/operator/distinctUntilChanged'
-import { isInMobileView } from '@app/shared/misc/utils'
+import { isInSmallView } from '@app/shared/misc/utils'
 import { MarkdownService } from '@app/videos/shared'
 import { Subject } from 'rxjs/Subject'
 import truncate from 'lodash-es/truncate'
@@ -74,7 +74,7 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit {
   }
 
   arePreviewsDisplayed () {
-    return isInMobileView() === false
+    return isInSmallView() === false
   }
 
   private updateDescriptionPreviews () {
index 0e6e6b3661eb6fbe4bffcf7989bc98fd374a51e9..6620ac9737f5fe5678c125d32cd6d36d26b4811f 100644 (file)
@@ -55,15 +55,20 @@ function dateToHuman (date: string) {
   return datePipe.transform(date, 'medium')
 }
 
-function isInMobileView () {
+function isInSmallView () {
   return window.innerWidth < 600
 }
 
+function isInMobileView () {
+  return window.innerWidth < 500
+}
+
 export {
   viewportHeight,
   getParameterByName,
   populateAsyncUserVideoChannels,
   getAbsoluteAPIUrl,
   dateToHuman,
+  isInSmallView,
   isInMobileView
 }
index 0f0ff20f0bb3ccb97d80ec349cf96f4455bde15c..3fdfcefa0f1223ddd7d021b06202375b9d3c5489 100644 (file)
@@ -6,23 +6,29 @@
   }
 }
 
-@media screen and (max-width: 400px) and (min-resolution: 1.5dppx) {
+@media screen and (max-width: 500px) {
   .videos {
     text-align: center;
 
     /deep/ .video-miniature {
       padding-right: 0;
-      height: 215px;
+      height: auto;
       width: 100%;
+      margin-bottom: 20px;
 
       .video-miniature-information {
-        width: 100%;
+        width: 100% !important;
+
+        span {
+          width: 100%;
+        }
       }
 
       /deep/ .video-thumbnail {
         width: 100%;
 
         img {
+          height: auto;
           width: 100%;
         }
       }
index bf0827207999ae7d756fef356a7d8718c5c5103c..a25fc532c4b319c37ab4bcd59b45eae16273b5c8 100644 (file)
@@ -1,5 +1,6 @@
 import { OnInit } from '@angular/core'
 import { ActivatedRoute, Router } from '@angular/router'
+import { isInMobileView, isInSmallView } from '@app/shared/misc/utils'
 import { NotificationsService } from 'angular2-notifications'
 import { Observable } from 'rxjs/Observable'
 import { AuthService } from '../../core/auth'
@@ -42,6 +43,10 @@ export abstract class AbstractVideoList implements OnInit {
     const routeParams = this.route.snapshot.params
     this.loadRouteParams(routeParams)
 
+    if (isInMobileView()) {
+      this.pagination.itemsPerPage = 5
+    }
+
     if (this.loadOnInit === true) this.loadMoreVideos('after')
   }
 
index 5c698e8f62e47884beb6c1e8a5c5225f03d1316e..8acfb3c41b3723266f0b163e1fa1fb642658f6b7 100644 (file)
@@ -2,7 +2,7 @@
   [routerLink]="['/videos/watch', video.uuid]" [attr.title]="video.name"
 class="video-thumbnail"
 >
-<img [attr.src]="video.thumbnailUrl" alt="video thumbnail" [ngClass]="{ 'blur-filter': nsfw }" />
+<img [attr.src]="getImageUrl()" alt="video thumbnail" [ngClass]="{ 'blur-filter': nsfw }" />
 
 <div class="video-thumbnail-overlay">
   {{ video.durationLabel }}
index 0fc2df220028fd31975000b71278e9e7711dbe5e..4840a9e4fe553e8ccb0ee78db508720180590122 100644 (file)
     text-decoration: none !important;
   }
 
-  img.blur-filter {
-    filter: blur(5px);
-    transform : scale(1.03);
+  img {
+    width: $video-thumbnail-width;
+    height: $video-thumbnail-height;
+
+    &.blur-filter {
+      filter: blur(5px);
+      transform : scale(1.03);
+    }
   }
 
   .video-thumbnail-overlay {
index e543e9903bbf1855bc7e5d820b07f1f699634c30..e52f7dfb0824f2da18389a7a73a49d6a961c5a6c 100644 (file)
@@ -1,4 +1,5 @@
 import { Component, Input } from '@angular/core'
+import { isInMobileView } from '@app/shared/misc/utils'
 import { Video } from './video.model'
 
 @Component({
@@ -9,4 +10,14 @@ import { Video } from './video.model'
 export class VideoThumbnailComponent {
   @Input() video: Video
   @Input() nsfw = false
+
+  getImageUrl () {
+    if (!this.video) return ''
+
+    if (isInMobileView()) {
+      return this.video.previewUrl
+    }
+
+    return this.video.thumbnailUrl
+  }
 }
index a9e885739202fb89aa0de302962290cc9d69d1d3..4954717db65b85cef39807f49e36bb1b7f4ca934 100644 (file)
@@ -1,5 +1,5 @@
 {
-  "background_color": "gray",
+  "background_color": "white",
   "description": "A federated video streaming platform using P2P",
   "display": "fullscreen",
   "orientation": "portrait",
index 0d310409bbfdc676829278d1af98b18750b0bd5e..e7bed418e4a6ef54c6074d7b5ab1cc1c0f033aa8 100644 (file)
@@ -27,3 +27,6 @@ $footer-height: 30px;
 $footer-margin: 30px;
 
 $footer-border-color: $header-border-color;
+
+$video-thumbnail-height: 110px;
+$video-thumbnail-width: 200px;