Chocobozzz/PeerTube

View on GitHub
client/src/app/shared/shared-video-miniature/videos-list.component.html

Summary

Maintainability
Test Coverage
<div class="margin-content">
  <div class="videos-header pt-4 mb-4">
    <h1 *ngIf="displayTitle" class="title mb-1" placement="bottom" [ngbTooltip]="titleTooltip" container="body">
      {{ title }}
    </h1>

    <div [ngClass]="{ 'no-title': !displayTitle, invisible: !syndicationItems || syndicationItems.length === 0 }" class="title-subscription">
      <ng-container i18n>Subscribe to RSS feed "{{ title }}"</ng-container>

      <my-feed [syndicationItems]="syndicationItems"></my-feed>
    </div>

    <div *ngIf="headerActions.length !== 0" class="action-block mt-3">
      <ng-container *ngFor="let action of headerActions">
        <a *ngIf="action.routerLink" class="ms-2" [routerLink]="action.routerLink" routerLinkActive="active">
          <ng-container *ngTemplateOutlet="actionContent; context:{ $implicit: action }"></ng-container>
        </a>

        <button *ngIf="!action.routerLink && !action.href && action.click" class="ms-2 button-unstyle" (click)="action.click($event)" (key.enter)="action.click($event)">
          <ng-container *ngTemplateOutlet="actionContent; context:{ $implicit: action }"></ng-container>
        </button>

        <a *ngIf="!action.routerLink && action.href && action.click" class="ms-2" (click)="action.click($event)" (key.enter)="action.click($event)" [href]="action.href">
          <ng-container *ngTemplateOutlet="actionContent; context:{ $implicit: action }"></ng-container>
        </a>

        <ng-template #actionContent let-action>
          <my-button *ngIf="!action.justIcon" [icon]="action.iconName" [label]="action.label"></my-button>
          <my-button *ngIf="action.justIcon" [icon]="action.iconName" [ngbTooltip]="action.label"></my-button>
        </ng-template>
      </ng-container>
    </div>
  </div>

  <my-video-filters-header
    *ngIf="displayFilters" [displayModerationBlock]="displayModerationBlock" [hideScope]="hideScopeFilter"
    [filters]="filters"
    (filtersChanged)="onFiltersChanged(true)"
  ></my-video-filters-header>

  <div class="no-results" i18n *ngIf="hasDoneFirstQuery && videos.length === 0 && highlightedLives.length === 0">No results.</div>

  <div
    myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onVideosDataSubject.asObservable()"
    [setAngularState]="true" [parentDisabled]="disabled"
    class="videos" [ngClass]="{ 'display-as-row': displayAsRow }"
  >
    <ng-container *ngIf="highlightedLives.length !== 0">
      <h2 class="date-title">
        <my-global-icon iconName="live"></my-global-icon> Current lives
      </h2>

      <ng-container *ngFor="let live of highlightedLives; trackBy: videoById;">
        <div class="video-wrapper">
          <my-video-miniature
            [video]="live" [user]="userMiniature" [displayAsRow]="displayAsRow"
            [displayVideoActions]="displayVideoActions" [displayOptions]="displayOptions"
            (videoBlocked)="removeVideoFromArray(live)" (liveRemoved)="removeVideoFromArray(live)"
          >
          </my-video-miniature>
        </div>
      </ng-container>

      <h2 *ngIf="!groupByDate" class="date-title">
        <my-global-icon iconName="videos"></my-global-icon> Videos
      </h2>
    </ng-container>

    <ng-container *ngFor="let video of videos; trackBy: videoById;">
      <h2 class="date-title" *ngIf="getCurrentGroupedDateLabel(video)">
        {{ getCurrentGroupedDateLabel(video) }}
      </h2>

      <div class="video-wrapper">
        <my-video-miniature
          [video]="video" [user]="userMiniature" [displayAsRow]="displayAsRow"
          [displayVideoActions]="displayVideoActions" [displayOptions]="displayOptions"
          (videoBlocked)="removeVideoFromArray(video)" (videoRemoved)="removeVideoFromArray(video)"
        >
        </my-video-miniature>
      </div>
    </ng-container>
  </div>
</div>