Limit thumbnail sizes
authorChocobozzz <me@florianbigard.com>
Thu, 11 Jun 2020 12:33:33 +0000 (14:33 +0200)
committerChocobozzz <me@florianbigard.com>
Thu, 11 Jun 2020 14:41:51 +0000 (16:41 +0200)
15 files changed:
client/src/app/+accounts/account-video-channels/account-video-channels.component.scss
client/src/app/search/search.component.html
client/src/app/search/search.component.ts
client/src/app/shared/misc/screen.service.ts
client/src/app/shared/video/abstract-video-list.html
client/src/app/shared/video/abstract-video-list.scss
client/src/app/shared/video/abstract-video-list.ts
client/src/app/shared/video/video-miniature.component.html
client/src/app/shared/video/video-miniature.component.scss
client/src/app/shared/video/video-miniature.component.ts
client/src/app/videos/video-list/video-overview.component.html
client/src/app/videos/video-list/video-overview.component.scss
client/src/sass/include/_bootstrap-variables.scss
client/src/sass/include/_miniature.scss
client/src/sass/include/_variables.scss

index 0422908092723979f685ca8dfc9c094555f6ff90..4957e91d722ce8a70388a10947f4eb7d55167750 100644 (file)
@@ -3,7 +3,7 @@
 @import '_miniature';
 
 .margin-content {
-  @include adapt-margin-content-width;
+  @include fluid-videos-miniature-layout;
 }
 
 .section {
index d723606db969afeb23c367b915f8b26083303cdf..6acdedf92b3157d3569a763ed1bba595ede44921 100644 (file)
@@ -54,7 +54,7 @@
     <div *ngIf="isVideo(result)" class="entry video">
       <my-video-miniature
         [video]="result" [user]="user" [displayAsRow]="true" [displayVideoActions]="!hideActions()"
-        [useLazyLoadUrl]="advancedSearch.searchTarget === 'search-index'"
+        [displayOptions]="videoDisplayOptions" [useLazyLoadUrl]="advancedSearch.searchTarget === 'search-index'"
         (videoBlocked)="removeVideoFromArray(result)" (videoRemoved)="removeVideoFromArray(result)"
       ></my-video-miniature>
     </div>
index 7ab0ed9d6ea5c225cbe1ec0615a7ea0098cc973c..0439fdf512b03e54fa50fd8311f6af08b4877b98 100644 (file)
@@ -8,11 +8,11 @@ import { SearchService } from '@app/search/search.service'
 import { immutableAssign } from '@app/shared/misc/utils'
 import { ComponentPagination } from '@app/shared/rest/component-pagination.model'
 import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
+import { MiniatureDisplayOptions } from '@app/shared/video/video-miniature.component'
 import { Video } from '@app/shared/video/video.model'
 import { MetaService } from '@ngx-meta/core'
 import { I18n } from '@ngx-translate/i18n-polyfill'
 import { ServerConfig } from '@shared/models'
-import { UserService } from '@app/shared'
 import { SearchTargetType } from '@shared/models/search/search-target-query.model'
 
 @Component({
@@ -32,6 +32,17 @@ export class SearchComponent implements OnInit, OnDestroy {
   isSearchFilterCollapsed = true
   currentSearch: string
 
+  videoDisplayOptions: MiniatureDisplayOptions = {
+    date: true,
+    views: true,
+    by: true,
+    avatar: false,
+    privacyLabel: false,
+    privacyText: false,
+    state: false,
+    blacklistInfo: false
+  }
+
   errorMessage: string
   serverConfig: ServerConfig
 
index fa9c71e5bfd94800f228d4054838133be41f1ae9..a69fad31df46e45e931c2d8f05e0c61f07eec9ac 100644 (file)
@@ -36,11 +36,11 @@ export class ScreenService {
 
     let numberOfVideos = 1
 
-    if (screenWidth > 1850) numberOfVideos = 6
-    else if (screenWidth > 1600) numberOfVideos = 5
-    else if (screenWidth > 1370) numberOfVideos = 4
-    else if (screenWidth > 1100) numberOfVideos = 3
-    else if (screenWidth > 850) numberOfVideos = 2
+    if (screenWidth > 1850) numberOfVideos = 7
+    else if (screenWidth > 1600) numberOfVideos = 6
+    else if (screenWidth > 1370) numberOfVideos = 5
+    else if (screenWidth > 1100) numberOfVideos = 4
+    else if (screenWidth > 850) numberOfVideos = 3
 
     return numberOfVideos
   }
index 8ce3b25b0245649a572fab4bc7c7a3456a5d8d0a..9e551c1c85b488d7c1dbe94e370e2cae76da9262 100644 (file)
         {{ getCurrentGroupedDateLabel(video) }}
       </div>
 
-      <my-video-miniature
-        [fitWidth]="true"
-        [video]="video" [user]="user" [ownerDisplayType]="ownerDisplayType"
-        [displayVideoActions]="displayVideoActions" [displayOptions]="displayOptions"
-        (videoBlocked)="removeVideoFromArray(video)" (videoRemoved)="removeVideoFromArray(video)"
-      >
-      </my-video-miniature>
+      <div class="video-wrapper">
+        <my-video-miniature
+          [fitWidth]="true"
+          [video]="video" [user]="user" [ownerDisplayType]="ownerDisplayType"
+          [displayVideoActions]="displayVideoActions" [displayOptions]="displayOptions"
+          (videoBlocked)="removeVideoFromArray(video)" (videoRemoved)="removeVideoFromArray(video)"
+        >
+        </my-video-miniature>
+      </div>
     </ng-container>
   </div>
 </div>
index 982204e21d99bb9a23b52c7b6eefa634fd8ffefb..7f23098aa4ef536147c25bb2855d2e548e5311bc 100644 (file)
@@ -3,24 +3,6 @@
 @import '_mixins';
 @import '_miniature';
 
-.videos {
-  $column-width: #{$video-thumbnail-width - 25px};
-
-  display: grid;
-  column-gap: calc(10px + .2%);
-  grid-template-columns: repeat(
-    auto-fill,
-    minmax(
-      var(--miniature-min-width, #{$column-width}),
-      1fr
-    )
-  );
-
-  @media screen and (min-width: #{breakpoint(fhd)}) {
-    --miniature-min-width: #{$column-width + 100px};
-  }
-}
-
 .videos-header {
   display: flex;
   justify-content: space-between;
@@ -74,8 +56,8 @@
   }
 }
 
-:host-context(.main-col:not(.expanded)) .margin-content {
-  @include adapt-margin-content-width($fluid: true);
+.margin-content {
+  @include fluid-videos-miniature-layout;
 }
 
 @media screen and (max-width: $mobile-view) {
@@ -83,6 +65,7 @@
     flex-direction: column;
     align-items: center;
     height: auto;
+    margin-bottom: 10px;
 
     .title-page {
       margin-bottom: 10px;
index 69d5c001096c85967fed6c912526ece94b91d954..76aa683fcb13c772b0b10d40bd5171e9a28d2251 100644 (file)
@@ -56,7 +56,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor
     date: true,
     views: true,
     by: true,
-    avatar: true,
+    avatar: false,
     privacyLabel: true,
     privacyText: false,
     state: false,
@@ -139,6 +139,11 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor
         if (this.hasDoneFirstQuery) this.reloadVideos()
       }
     )
+
+    // Display avatar in mobile view
+    if (this.screenService.isInMobileView()) {
+      this.displayOptions.avatar = true
+    }
   }
 
   ngOnDestroy () {
index 575505f63cb9f3e88fc9b160ef1bd96a181941f5..d37ab478dcd67ddbb7a829a87f78728abf5f7847 100644 (file)
@@ -9,32 +9,34 @@
 
   <div class="video-bottom">
     <div class="video-miniature-information">
-      <a
-        tabindex="-1"
-        class="video-miniature-name"
-        [routerLink]="videoLink" [attr.title]="video.name" [ngClass]="{ 'blur-filter': isVideoBlur }"
-      >{{ video.name }}</a>
-
       <div class="d-inline-flex">
-        <avatar-channel *ngIf="displayOptions.avatar" class="mr-1 pt-1" [video]="video" size="sm"></avatar-channel>
+        <div *ngIf="displayOptions.avatar" class="avatar">
+          <img [src]="getAvatarUrl()" alt="Avatar" />
+        </div>
 
         <div class="d-flex flex-column">
+          <a
+            tabindex="-1"
+            class="video-miniature-name"
+            [routerLink]="videoLink" [attr.title]="video.name" [ngClass]="{ 'blur-filter': isVideoBlur }"
+          >{{ video.name }}</a>
+
           <span class="video-miniature-created-at-views">
             <my-date-toggle *ngIf="displayOptions.date" [date]="video.publishedAt"></my-date-toggle>
-    
+
             <span class="views">
               <ng-container *ngIf="displayOptions.date && displayOptions.views"> • </ng-container>
               <ng-container i18n *ngIf="displayOptions.views">{video.views, plural, =1 {1 view} other {{{ video.views | myNumberFormatter }} views}}</ng-container>
             </span>
           </span>
-    
+
           <a tabindex="-1" *ngIf="displayOptions.by && displayOwnerAccount()" class="video-miniature-account" [routerLink]="[ '/accounts', video.byAccount ]">
             {{ video.byAccount }}
           </a>
           <a tabindex="-1" *ngIf="displayOptions.by && displayOwnerVideoChannel()" class="video-miniature-channel" [routerLink]="[ '/video-channels', video.byVideoChannel ]">
             {{ video.byVideoChannel }}
           </a>
-    
+
           <div class="video-info-privacy">
             <ng-container *ngIf="displayOptions.privacyText">{{ video.privacy.label }}</ng-container>
             <ng-container *ngIf="displayOptions.privacyText && displayOptions.state && getStateLabel(video)"> - </ng-container>
index 1e5580b9aabeb7b7396d565fe5806a5de1689511..4e7c9fb57835ab74fbca02652e25324336ebd9dc 100644 (file)
@@ -19,16 +19,22 @@ $more-margin-right: 15px;
     .video-miniature-information {
       width: $video-miniature-width - $more-button-width - $more-margin-right;
       line-height: normal;
-      font-size: 13px;
+
+      .avatar {
+        margin: 10px 10px 0 0;
+
+        img {
+          @include avatar(40px);
+        }
+      }
 
       .video-miniature-name {
         @include miniature-name;
-        font-size: 110%;
       }
 
       .video-miniature-created-at-views {
         display: block;
-        font-size: 95%;
+        font-size: 13px;
       }
 
       .video-miniature-account,
@@ -37,7 +43,7 @@ $more-margin-right: 15px;
         @include ellipsis;
 
         display: block;
-        font-size: 95%;
+        font-size: 13px;
         color: pvar(--greyForegroundColor);
 
         &:hover {
index f0b0992e2ad4eb3056a7390f629f3d6c1ca73613..ccf90af54ead80b0624c77efbf3c38be23c5eec3 100644 (file)
@@ -178,6 +178,14 @@ export class VideoMiniatureComponent implements OnInit {
     return ''
   }
 
+  getAvatarUrl () {
+    if (this.ownerDisplayTypeChosen === 'account') {
+      return this.video.accountAvatarUrl
+    }
+
+    return this.video.videoChannelAvatarUrl
+  }
+
   loadActions () {
     if (this.displayVideoActions) this.showActions = true
 
index 72e101558978a6b92d3a8c808a993460cff3226c..999628de4472f62361ca7d749b276cffd1137e8d 100644 (file)
@@ -7,25 +7,29 @@
   >
     <ng-container *ngFor="let overview of overviews">
 
-      <div class="section" *ngFor="let object of overview.categories">
+      <div class="section videos" *ngFor="let object of overview.categories">
         <div class="section-title">
           <a routerLink="/search" [queryParams]="{ categoryOneOf: [ object.category.id ] }">{{ object.category.label }}</a>
         </div>
 
-        <my-video-miniature class="pr-2" *ngFor="let video of buildVideos(object.videos)" [video]="video" [user]="user" [displayVideoActions]="false">
-        </my-video-miniature>
+        <div class="video-wrapper" *ngFor="let video of buildVideos(object.videos)">
+          <my-video-miniature [video]="video" [fitWidth]="true" [user]="user" [displayVideoActions]="false">
+          </my-video-miniature>
+        </div>
       </div>
 
-      <div class="section" *ngFor="let object of overview.tags">
+      <div class="section videos" *ngFor="let object of overview.tags">
         <div class="section-title">
           <a routerLink="/search" [queryParams]="{ tagsOneOf: [ object.tag ] }">#{{ object.tag }}</a>
         </div>
 
-        <my-video-miniature class="pr-2" *ngFor="let video of buildVideos(object.videos)" [video]="video" [user]="user" [displayVideoActions]="false">
-        </my-video-miniature>
+        <div class="video-wrapper" *ngFor="let video of buildVideos(object.videos)">
+          <my-video-miniature [video]="video" [fitWidth]="true" [user]="user" [displayVideoActions]="false">
+          </my-video-miniature>
+        </div>
       </div>
 
-      <div class="section channel" *ngFor="let object of overview.channels">
+      <div class="section channel videos" *ngFor="let object of overview.channels">
         <div class="section-title">
           <a [routerLink]="[ '/video-channels', buildVideoChannelBy(object) ]">
             <img [src]="buildVideoChannelAvatarUrl(object)" alt="Avatar" />
           </a>
         </div>
 
-        <my-video-miniature class="pr-2" *ngFor="let video of buildVideos(object.videos)" [video]="video" [user]="user" [displayVideoActions]="false">
-        </my-video-miniature>
+        <div class="video-wrapper" *ngFor="let video of buildVideos(object.videos)">
+          <my-video-miniature [video]="video" [fitWidth]="true" [user]="user" [displayVideoActions]="false">
+          </my-video-miniature>
+        </div>
       </div>
 
     </ng-container>
index ade6f53b7d20e99551962e54c9695e3554d4bdb9..c1d10188ae257774fc92342b7c7215e05b1b9f9d 100644 (file)
@@ -2,8 +2,13 @@
 @import '_mixins';
 @import '_miniature';
 
+.section-title {
+  // make the element span a full grid row within .videos grid
+  grid-column: 1 / -1;
+}
+
 .margin-content {
-  @include adapt-margin-content-width;
+  @include fluid-videos-miniature-layout;
 }
 
 .section {
index 09c58a69770e02d85f59003307c23bfa87f60635..41a1448c40324c4bc75fe8e8381609e2ace75e52 100644 (file)
@@ -18,7 +18,7 @@ $grid-breakpoints: (
   xxl: 1600px,
 
   // SCREEN GROUP
-  fhd: 1920px,
+  fhd: 1800px,
   qhd: 2560px,
   uhd: 3840px
 );
index d89d6f9ffac097f825403fd852bf92bab9bb7172..d79086723000a78fac7f9081950369a0c36cb0be 100644 (file)
@@ -108,38 +108,6 @@ $play-overlay-width: 18px;
   color: #fff;
 }
 
-@mixin video-miniature-small-screen {
-  text-align: center;
-
-  ::ng-deep .video-miniature {
-    padding-right: 0;
-    height: auto;
-    width: 100%;
-    margin-bottom: 20px;
-
-    .video-miniature-information {
-      width: 100% !important;
-      text-align: left;
-
-      span {
-        width: 100%;
-      }
-    }
-
-    .video-thumbnail {
-      margin-bottom: 10px;
-      width: 100%;
-      height: calc(100% / #{$video-thumbnail-ratio});
-      border-radius: 0;
-
-      img {
-        width: 100%;
-        height: 100%;
-      }
-    }
-  }
-}
-
 @mixin miniature-rows {
   &:first-child {
     padding-top: 30px;
@@ -149,10 +117,6 @@ $play-overlay-width: 18px;
     }
   }
 
-  my-video-miniature {
-    text-align: left;
-  }
-
   .section-title {
     font-size: 24px;
     font-weight: $font-semibold;
@@ -213,44 +177,81 @@ $play-overlay-width: 18px;
     max-height: initial;
     overflow: initial;
 
-    @include video-miniature-small-screen;
-
     .section-title {
       font-size: 17px;
+      margin-left: 10px;
     }
   }
 }
 
-@mixin adapt-margin-content-width($fluid: false) {
-  @if $fluid {
-    margin-left: 3vw !important;
-    margin-right: 3vw !important;
-  } @else {
-    width: $video-miniature-width * 6;
-    margin: auto !important;
+@mixin fluid-videos-miniature-layout {
+  margin-left: 3vw !important;
+  margin-right: 3vw !important;
 
-    @media screen and (max-width: 1800px) {
-      width: $video-miniature-width * 5;
-    }
+  @media screen and (max-width: $mobile-view) {
+    width: auto;
+    margin: 0 !important;
 
-    @media screen and (max-width: 1800px - $video-miniature-width) {
-      width: $video-miniature-width * 4;
-    }
+    .videos {
+      text-align: center;
 
-    @media screen and (max-width: 1800px - (2* $video-miniature-width)) {
-      width: $video-miniature-width * 3;
-    }
+      ::ng-deep .video-miniature {
+        padding-right: 0;
+        height: auto;
+        width: 100%;
+        margin-bottom: 25px;
 
-    @media screen and (max-width: 1800px - (3* $video-miniature-width)) {
-      width: $video-miniature-width * 2;
+        .video-miniature-information {
+          width: 100% !important;
+          text-align: left;
+
+          span {
+            width: 100%;
+          }
+        }
+
+        .video-thumbnail {
+          border-radius: 0;
+        }
+      }
     }
+  }
+
+  @media screen and (min-width: #{breakpoint(fhd)}) {
+    margin-left: 6vw !important;
+    margin-right: 6vw !important;
+  }
 
-    @media screen and (max-width: $mobile-view) {
-      width: auto;
-      margin: 0 !important;
+  @media screen and (min-width: $mobile-view) {
+
+    .videos {
+      --miniature-min-width: #{$video-thumbnail-width - 15px};
+      --miniature-max-width: #{$video-thumbnail-width};
+
+      display: grid;
+      column-gap: 5px;
+      grid-template-columns: repeat(
+        auto-fill,
+        minmax(
+          var(--miniature-min-width),
+          1fr
+        )
+      );
+
+      @media screen and (min-width: #{breakpoint(fhd)}) {
+        column-gap: 1%;
+        --miniature-min-width: #{$video-thumbnail-width};
+      }
+
+      .video-wrapper {
+        margin: 0 auto;
+        width: 100%;
 
-      .videos {
-        @include video-miniature-small-screen;
+        my-video-miniature {
+          display: block;
+          min-width: var(--miniature-min-width);
+          max-width: var(--miniature-max-width);
+        }
       }
     }
   }
index 14f1ae76c399ab16ec11dfbd931d854cf4ad1e59..56b1ff884c5c4b16648860d6fdfad698345a1eb1 100644 (file)
@@ -59,7 +59,6 @@ $video-miniature-width: 238px;
 $video-miniature-margin-bottom: 30px;
 $video-thumbnail-height: 122px;
 $video-thumbnail-width: 223px;
-$video-thumbnail-ratio: $video-thumbnail-width / $video-thumbnail-height;
 
 $theater-bottom-space: 115px;