.section {
@include miniature-rows;
- overflow: visible; // For the subscribe dropdown
padding-top: 0 !important;
.section-title {
import { VideoService } from '@app/shared/video/video.service'
import { VideoSortField } from '@app/shared/video/sort-field.type'
import { ComponentPagination, hasMoreItems } from '@app/shared/rest/component-pagination.model'
+import { ScreenService } from '@app/shared/misc/screen.service'
@Component({
selector: 'my-account-video-channels',
private authService: AuthService,
private accountService: AccountService,
private videoChannelService: VideoChannelService,
- private videoService: VideoService
+ private videoService: VideoService,
+ private screenService: ScreenService
) { }
get user () {
}
getVideosOf (videoChannel: VideoChannel) {
- return this.videos[ videoChannel.id ]
+ const numberOfVideos = this.screenService.getNumberOfAvailableMiniatures()
+
+ // 2 rows
+ return this.videos[ videoChannel.id ].slice(0, numberOfVideos * 2)
}
onNearOfBottom () {
return 'ontouchstart' in window || navigator.msMaxTouchPoints
}
+ getNumberOfAvailableMiniatures () {
+ const screenWidth = this.getWindowInnerWidth()
+
+ 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
+
+ return numberOfVideos
+ }
+
// Cache window inner width, because it's an expensive call
- private getWindowInnerWidth () {
+ getWindowInnerWidth () {
if (this.cacheWindowInnerWidthExpired()) this.refreshWindowInnerWidth()
return this.windowInnerWidth
<a routerLink="/search" [queryParams]="{ categoryOneOf: [ object.category.id ] }">{{ object.category.label }}</a>
</div>
- <my-video-miniature *ngFor="let video of object.videos" [video]="video" [user]="user" [displayVideoActions]="false"></my-video-miniature>
+ <my-video-miniature *ngFor="let video of buildVideos(object.videos)" [video]="video" [user]="user" [displayVideoActions]="false">
+ </my-video-miniature>
</div>
<div class="section" *ngFor="let object of overview.tags">
<a routerLink="/search" [queryParams]="{ tagsOneOf: [ object.tag ] }">#{{ object.tag }}</a>
</div>
- <my-video-miniature *ngFor="let video of object.videos" [video]="video" [user]="user" [displayVideoActions]="false"></my-video-miniature>
+ <my-video-miniature *ngFor="let video of buildVideos(object.videos)" [video]="video" [user]="user" [displayVideoActions]="false">
+ </my-video-miniature>
</div>
<div class="section channel" *ngFor="let object of overview.channels">
</a>
</div>
- <my-video-miniature *ngFor="let video of object.videos" [video]="video" [user]="user" [displayVideoActions]="false"></my-video-miniature>
+ <my-video-miniature *ngFor="let video of buildVideos(object.videos)" [video]="video" [user]="user" [displayVideoActions]="false">
+ </my-video-miniature>
</div>
</div>
import { VideosOverview } from '@app/shared/overview/videos-overview.model'
import { OverviewService } from '@app/shared/overview'
import { Video } from '@app/shared/video/video.model'
+import { ScreenService } from '@app/shared/misc/screen.service'
@Component({
selector: 'my-video-overview',
private i18n: I18n,
private notifier: Notifier,
private authService: AuthService,
- private overviewService: OverviewService
+ private overviewService: OverviewService,
+ private screenService: ScreenService
) { }
get user () {
buildVideoChannelAvatarUrl (object: { videos: Video[] }) {
return object.videos[0].videoChannelAvatarUrl
}
+
+ buildVideos (videos: Video[]) {
+ const numberOfVideos = this.screenService.getNumberOfAvailableMiniatures()
+
+ return videos.slice(0, numberOfVideos * 2)
+ }
}
}
@mixin miniature-rows {
- max-height: 540px; // 2 rows max
- overflow: hidden;
-
&:first-child {
padding-top: 30px;