Skip to content

Commit

Permalink
Limit thumbnail sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocobozzz committed Jun 11, 2020
1 parent 7e4022a commit cf78883
Show file tree
Hide file tree
Showing 15 changed files with 151 additions and 123 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@import '_miniature';

.margin-content {
@include adapt-margin-content-width;
@include fluid-videos-miniature-layout;
}

.section {
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/search/search.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
13 changes: 12 additions & 1 deletion client/src/app/search/search.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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

Expand Down
10 changes: 5 additions & 5 deletions client/src/app/shared/misc/screen.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
16 changes: 9 additions & 7 deletions client/src/app/shared/video/abstract-video-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@
{{ 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>
23 changes: 3 additions & 20 deletions client/src/app/shared/video/abstract-video-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -74,15 +56,16 @@
}
}

: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) {
.videos-header {
flex-direction: column;
align-items: center;
height: auto;
margin-bottom: 10px;

.title-page {
margin-bottom: 10px;
Expand Down
7 changes: 6 additions & 1 deletion client/src/app/shared/video/abstract-video-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 () {
Expand Down
22 changes: 12 additions & 10 deletions client/src/app/shared/video/video-miniature.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
14 changes: 10 additions & 4 deletions client/src/app/shared/video/video-miniature.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -37,7 +43,7 @@ $more-margin-right: 15px;
@include ellipsis;

display: block;
font-size: 95%;
font-size: 13px;
color: pvar(--greyForegroundColor);

&:hover {
Expand Down
8 changes: 8 additions & 0 deletions client/src/app/shared/video/video-miniature.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
24 changes: 15 additions & 9 deletions client/src/app/videos/video-list/video-overview.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand All @@ -34,8 +38,10 @@
</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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion client/src/sass/include/_bootstrap-variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $grid-breakpoints: (
xxl: 1600px,

// SCREEN GROUP
fhd: 1920px,
fhd: 1800px,
qhd: 2560px,
uhd: 3840px
);
Expand Down
Loading

0 comments on commit cf78883

Please sign in to comment.