]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Don't display scope fitler on account/channel pages
authorChocobozzz <me@florianbigard.com>
Mon, 30 Aug 2021 07:37:00 +0000 (09:37 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 30 Aug 2021 07:37:18 +0000 (09:37 +0200)
client/src/app/+accounts/account-videos/account-videos.component.html
client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.html
client/src/app/+videos/video-list/video-user-subscriptions.component.html
client/src/app/+videos/video-list/video-user-subscriptions.component.ts
client/src/app/shared/shared-video-miniature/video-filters-header.component.html
client/src/app/shared/shared-video-miniature/video-filters-header.component.ts
client/src/app/shared/shared-video-miniature/video-filters.model.ts
client/src/app/shared/shared-video-miniature/videos-list.component.html
client/src/app/shared/shared-video-miniature/videos-list.component.scss
client/src/app/shared/shared-video-miniature/videos-list.component.ts

index 5b4b0937fbca2d4f0c5af0b52e6dc33528212073..f88d141c24ed99b2cd44436d03f3e463a74fd4b3 100644 (file)
@@ -13,6 +13,8 @@
   [displayModerationBlock]="true"
   [displayAsRow]="displayAsRow()"
 
+  [hideScopeFilter]="true"
+
   [loadUserVideoPreferences]="true"
 
   [disabled]="disabled"
index 1b6b72f1ef77cb9c325df5df568d89671fa187b4..0a6c5fcb2cd0de56aa241c068929da173bc9c6a6 100644 (file)
@@ -14,6 +14,8 @@
   [displayOptions]="displayOptions"
   [displayAsRow]="displayAsRow()"
 
+  [hideScopeFilter]="true"
+
   [loadUserVideoPreferences]="true"
 
   [disabled]="disabled"
index 2675b58bfe3e7b35c4e92579307f50e87863aad9..5536bb945613bc4cd2fcbf66500f399096085d84 100644 (file)
@@ -13,5 +13,7 @@
   [groupByDate]="true"
 
   [disabled]="disabled"
+
+  [headerActions]="actions"
 >
 </my-videos-list>
index 43cbab9f6eabf61bf45037563e9f5311dfa2e85d..04f02c138fee263661e6cc069b299ed10d949d7a 100644 (file)
@@ -23,7 +23,7 @@ export class VideoUserSubscriptionsComponent implements DisableForReuseHook {
     {
       routerLink: '/my-library/subscriptions',
       label: $localize`Subscriptions`,
-      iconName: 'cog'
+      iconName: 'cog' as 'cog'
     }
   ]
 
index 44c21c089139ec491734b239aa8b67aaf5651cc1..60474689786693a26d6dc83138abd872e6af494a 100644 (file)
@@ -77,7 +77,7 @@
         </div>
       </div>
 
-      <div class="form-group">
+      <div class="form-group" *ngIf="!hideScope">
         <label for="scope" i18n>Scope:</label>
 
         <div class="peertube-radio-container">
index 99f133e540e9a251f4b47ba16ef660d123305ff9..54a7c5dabffd02f08e2f5e4649dae5b4b0c61f5b 100644 (file)
@@ -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
index a3b8129f0a375c1ccb752c357d82073da62f1087..920dc826c7018fd20555006b6e4f96b4f9607d0c 100644 (file)
@@ -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 () {
index 4ccb4092c91a2aec4adb5347fbd36eb2bdfab5e7..08ed7b94c9d36df3e6e1a954925434bb99772557 100644 (file)
@@ -33,7 +33,7 @@
   </div>
 
   <my-video-filters-header
-    *ngIf="displayFilters" [displayModerationBlock]="displayModerationBlock"
+    *ngIf="displayFilters" [displayModerationBlock]="displayModerationBlock" [hideScope]="hideScopeFilter"
     [defaultSort]="defaultSort" [filters]="filters"
     (filtersChanged)="onFiltersChanged(true)"
   ></my-video-filters-header>
index e82ef05baf456f6ea598dcee92a1e700ec4cae78..209201a5c05126c103eda8766011f371fdbba53e 100644 (file)
@@ -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 {
index 10de97298b4517a49354fedf0b26a8803f158a4b..3db8352578957232dcce2bd1b0a0ddcd86f06390 100644 (file)
@@ -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 = {