From 1b20624552501e8c2968853c6d139af568e1eb95 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 30 Aug 2021 09:37:00 +0200 Subject: Don't display scope fitler on account/channel pages --- .../shared-video-miniature/video-filters-header.component.html | 2 +- .../shared-video-miniature/video-filters-header.component.ts | 2 ++ .../src/app/shared/shared-video-miniature/video-filters.model.ts | 9 ++++++++- .../app/shared/shared-video-miniature/videos-list.component.html | 2 +- .../app/shared/shared-video-miniature/videos-list.component.scss | 7 ++++++- .../app/shared/shared-video-miniature/videos-list.component.ts | 8 +++++++- 6 files changed, 25 insertions(+), 5 deletions(-) (limited to 'client/src/app/shared/shared-video-miniature') diff --git a/client/src/app/shared/shared-video-miniature/video-filters-header.component.html b/client/src/app/shared/shared-video-miniature/video-filters-header.component.html index 44c21c089..604746897 100644 --- a/client/src/app/shared/shared-video-miniature/video-filters-header.component.html +++ b/client/src/app/shared/shared-video-miniature/video-filters-header.component.html @@ -77,7 +77,7 @@ -
+
diff --git a/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts b/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts index 99f133e54..54a7c5dab 100644 --- a/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts @@ -24,6 +24,8 @@ export class VideoFiltersHeaderComponent implements OnInit, OnDestroy { @Input() defaultSort = '-publishedAt' @Input() nsfwPolicy: NSFWPolicyType + @Input() hideScope = false + @Output() filtersChanged = new EventEmitter() areFiltersCollapsed = true diff --git a/client/src/app/shared/shared-video-miniature/video-filters.model.ts b/client/src/app/shared/shared-video-miniature/video-filters.model.ts index a3b8129f0..920dc826c 100644 --- a/client/src/app/shared/shared-video-miniature/video-filters.model.ts +++ b/client/src/app/shared/shared-video-miniature/video-filters.model.ts @@ -38,10 +38,14 @@ export class VideoFilters { private onChangeCallbacks: Array<() => void> = [] private oldFormObjectString: string - constructor (defaultSort: string, defaultScope: VideoFilterScope) { + private readonly hiddenFields: string[] = [] + + constructor (defaultSort: string, defaultScope: VideoFilterScope, hiddenFields: string[] = []) { this.setDefaultSort(defaultSort) this.setDefaultScope(defaultScope) + this.hiddenFields = hiddenFields + this.reset() } @@ -160,6 +164,9 @@ export class VideoFilters { label: $localize`VOD videos` }) } + + this.activeFilters = this.activeFilters + .filter(a => this.hiddenFields.includes(a.key) === false) } getActiveFilters () { diff --git a/client/src/app/shared/shared-video-miniature/videos-list.component.html b/client/src/app/shared/shared-video-miniature/videos-list.component.html index 4ccb4092c..08ed7b94c 100644 --- a/client/src/app/shared/shared-video-miniature/videos-list.component.html +++ b/client/src/app/shared/shared-video-miniature/videos-list.component.html @@ -33,7 +33,7 @@
diff --git a/client/src/app/shared/shared-video-miniature/videos-list.component.scss b/client/src/app/shared/shared-video-miniature/videos-list.component.scss index e82ef05ba..209201a5c 100644 --- a/client/src/app/shared/shared-video-miniature/videos-list.component.scss +++ b/client/src/app/shared/shared-video-miniature/videos-list.component.scss @@ -3,6 +3,9 @@ @use '_mixins' as *; @use '_miniature' as *; +// Cannot set margin top to videos-header because of the main header fixed position +$margin-top: 30px; + .videos-header { display: grid; grid-template-columns: auto 1fr auto; @@ -19,7 +22,7 @@ display: inline-block; font-weight: $font-semibold; - margin-top: 30px; + margin-top: $margin-top; margin-bottom: 0; } @@ -35,6 +38,8 @@ .action-block { grid-column: 3; + grid-row: 1/3; + margin-top: $margin-top; } my-feed { diff --git a/client/src/app/shared/shared-video-miniature/videos-list.component.ts b/client/src/app/shared/shared-video-miniature/videos-list.component.ts index 10de97298..3db835257 100644 --- a/client/src/app/shared/shared-video-miniature/videos-list.component.ts +++ b/client/src/app/shared/shared-video-miniature/videos-list.component.ts @@ -59,6 +59,8 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy { @Input() headerActions: HeaderAction[] = [] + @Input() hideScopeFilter = false + @Input() displayOptions: MiniatureDisplayOptions = { date: true, views: true, @@ -109,7 +111,11 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy { } ngOnInit () { - this.filters = new VideoFilters(this.defaultSort, this.defaultScope) + const hiddenFilters = this.hideScopeFilter + ? [ 'scope' ] + : [] + + this.filters = new VideoFilters(this.defaultSort, this.defaultScope, hiddenFilters) this.filters.load({ ...this.route.snapshot.queryParams, scope: this.defaultScope }) this.groupedDateLabels = { -- cgit v1.2.3