ActivityPub-federated video streaming platform using P2P directly in your web browser
Add max rows to videos list
Chocobozzz5d6395af72e0
diff --git a/client/src/app/+video-channels/video-channel-playlists/video-channel-playlists.component.scss b/client/src/app/+video-channels/video-channel-playlists/video-channel-playlists.component.scssindex 1e82ac765e..b3131de7ed 100644--- a/client/src/app/+video-channels/video-channel-playlists/video-channel-playlists.component.scss+++ b/client/src/app/+video-channels/video-channel-playlists/video-channel-playlists.component.scss@@ -14,7 +14,7 @@}.margin-content {- @include grid-videos-miniature-layout;+ @include grid-videos-miniature-layout-with-margins;}@media screen and (max-width: $mobile-view) {diff --git a/client/src/app/+videos/video-list/overview/video-overview.component.scss b/client/src/app/+videos/video-list/overview/video-overview.component.scssindex cb3ae2b9b0..cb9308dda0 100644--- a/client/src/app/+videos/video-list/overview/video-overview.component.scss+++ b/client/src/app/+videos/video-list/overview/video-overview.component.scss@@ -8,7 +8,7 @@}.margin-content {- @include grid-videos-miniature-layout;+ @include grid-videos-miniature-layout-with-margins;}.section {diff --git a/client/src/app/shared/shared-custom-markup/custom-markup-container.component.scss b/client/src/app/shared/shared-custom-markup/custom-markup-container.component.scssindex 862da7c188..704d908c30 100644--- a/client/src/app/shared/shared-custom-markup/custom-markup-container.component.scss+++ b/client/src/app/shared/shared-custom-markup/custom-markup-container.component.scss@@ -1,20 +1,24 @@.custom-markup-container {::ng-deep .peertube-container {- margin: 30px 0 15px;- h4 {- margin-bottom: 0;- }-- .layout-row {+ &.layout-row {display: flex;flex-direction: row;+ flex-wrap: wrap;}- .layout-column {+ &.layout-column {display: flex;flex-direction: column;}++ .header {+ margin: 30px 0 15px;+ }++ h4 {+ margin-bottom: 0;+ }}}diff --git a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts b/client/src/app/shared/shared-custom-markup/custom-markup.service.tsindex aa5dbe6436..729cd296b7 100644--- a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts+++ b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts@@ -168,11 +168,15 @@ export class CustomMarkupService {const model = {onlyDisplayTitle: this.buildBoolean(data.onlyDisplayTitle) ?? false,+ maxRows: this.buildNumber(data.maxRows) ?? -1,+sort: data.sort || '-publishedAt',+ count: this.buildNumber(data.count) || 10,+categoryOneOf: this.buildArrayNumber(data.categoryOneOf) ?? [],languageOneOf: this.buildArrayString(data.languageOneOf) ?? [],- filter: this.buildBoolean(data.onlyLocal) ? 'local' as VideoFilter : undefined,- count: this.buildNumber(data.count) || 10++ filter: this.buildBoolean(data.onlyLocal) ? 'local' as VideoFilter : undefined}this.dynamicElementService.setModel(component, model)@@ -183,11 +187,16 @@ export class CustomMarkupService {private containerBuilder (el: HTMLElement) {const data = el.dataset as ContainerMarkupData+ // Move inner HTML in the new element we'll create+ const content = el.innerHTML+ el.innerHTML = ''+const root = document.createElement('div')+ root.innerHTML = contentconst layoutClass = data.layout? 'layout-' + data.layout- : 'layout-row'+ : 'layout-column'root.classList.add('peertube-container', layoutClass)@@ -195,16 +204,23 @@ export class CustomMarkupService {root.setAttribute('width', data.width)}- if (data.title) {- const titleElement = document.createElement('h4')- titleElement.innerText = data.title- root.appendChild(titleElement)- }+ if (data.title || data.description) {+ const headerElement = document.createElement('div')+ headerElement.classList.add('header')++ if (data.title) {+ const titleElement = document.createElement('h4')+ titleElement.innerText = data.title+ headerElement.appendChild(titleElement)+ }++ if (data.description) {+ const descriptionElement = document.createElement('div')+ descriptionElement.innerText = data.description+ headerElement.append(descriptionElement)+ }- if (data.description) {- const descriptionElement = document.createElement('div')- descriptionElement.innerText = data.description- root.appendChild(descriptionElement)+ root.insertBefore(headerElement, root.firstChild)}return rootdiff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.html b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.htmlindex a2fd2fe408..15ef9d4182 100644--- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.html+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.html@@ -1,8 +1,13 @@-<div class="videos">- <my-video-miniature- *ngFor="let video of videos"- [video]="video" [user]="getUser()" [displayAsRow]="false"- [displayVideoActions]="false" [displayOptions]="displayOptions"- >- </my-video-miniature>+<div class="root">+ <div class="videos" [ngStyle]="limitRowsStyle()">++ <div class="video-wrapper" *ngFor="let video of videos">+ <my-video-miniature+ [video]="video" [user]="getUser()" [displayAsRow]="false"+ [displayVideoActions]="false" [displayOptions]="displayOptions"+ >+ </my-video-miniature>+ </div>++ </div></div>diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.scss b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.scssindex 6b7274480a..5a9a926fee 100644--- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.scss+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.scss@@ -1,10 +1,7 @@@import '_variables';@import '_mixins';+@import '_miniature';-my-video-miniature {- @include margin-right(15px);-- display: inline-block;- min-width: $video-thumbnail-width;- max-width: $video-thumbnail-width;+.root {+ @include grid-videos-miniature-layout;}diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.tsindex fe084afd90..d4402dd9f7 100644--- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts@@ -20,6 +20,7 @@ export class VideosListMarkupComponent implements OnInit {@Input() count: number@Input() onlyDisplayTitle: boolean@Input() filter: VideoFilter+ @Input() maxRows: numbervideos: Video[]@@ -43,6 +44,16 @@ export class VideosListMarkupComponent implements OnInit {return this.auth.getUser()}+ limitRowsStyle () {+ if (this.maxRows <= 0) return {}++ return {+ 'grid-template-rows': `repeat(${this.maxRows}, 1fr)`,+ 'grid-auto-rows': '0', // Set height to 0 for autogenerated grid rows+ 'overflow-y': 'hidden' // Hide grid items that overflow+ }+ }+ngOnInit () {if (this.onlyDisplayTitle) {for (const key of Object.keys(this.displayOptions)) {diff --git a/client/src/app/shared/shared-video-miniature/abstract-video-list.scss b/client/src/app/shared/shared-video-miniature/abstract-video-list.scssindex dd9ab18a87..c8dda29005 100644--- a/client/src/app/shared/shared-video-miniature/abstract-video-list.scss+++ b/client/src/app/shared/shared-video-miniature/abstract-video-list.scss@@ -51,7 +51,7 @@ $icon-size: 16px;}.margin-content {- @include grid-videos-miniature-layout;+ @include grid-videos-miniature-layout-with-margins;}.display-as-row.videos {diff --git a/client/src/sass/include/_miniature.scss b/client/src/sass/include/_miniature.scssindex f782d374a2..0d3f2b6e05 100644--- a/client/src/sass/include/_miniature.scss+++ b/client/src/sass/include/_miniature.scss@@ -118,8 +118,6 @@}@mixin grid-videos-miniature-layout {- @include grid-videos-miniature-margins;-@media screen and (min-width: $mobile-view) {.videos,.playlists {@@ -156,3 +154,8 @@}}}++@mixin grid-videos-miniature-layout-with-margins {+ @include grid-videos-miniature-margins;+ @include grid-videos-miniature-layout;+}diff --git a/shared/models/custom-markup/custom-markup-data.model.ts b/shared/models/custom-markup/custom-markup-data.model.tsindex f3c23ec2c9..06c9b544d9 100644--- a/shared/models/custom-markup/custom-markup-data.model.ts+++ b/shared/models/custom-markup/custom-markup-data.model.ts@@ -25,14 +25,16 @@ export type ChannelMiniatureMarkupData = {export type VideosListMarkupData = {onlyDisplayTitle?: string // boolean+ maxRows?: string // numbersort?: string- count?: string+ count?: string // numbercategoryOneOf?: string // coma separated valueslanguageOneOf?: string // coma separated valuesonlyLocal?: string // boolean+}export type ButtonMarkupData = {