Chocobozzz/PeerTube

View on GitHub
client/src/app/+stats/video/video-stats.component.html

Summary

Maintainability
Test Coverage
<div class="margin-content">
  <h1 class="title-page" i18n>{{ video.name }}</h1>

  <div class="stats-embed">
    <div class="global-stats">
      <div *ngFor="let card of globalStatsCards" class="card stats-card">
        <div class="label">
          {{ card.label }}

          <my-help *ngIf="card.help">
            <ng-template ptTemplate="customHtml">{{ card.help }}</ng-template>
          </my-help>
        </div>
        <div class="value">{{ card.value }}</div>
        <div *ngIf="card.moreInfo" class="more-info">{{ card.moreInfo }}</div>
      </div>
    </div>

    <my-embed [video]="video"></my-embed>
  </div>

  <div class="stats-with-date">

    <div class="overall-stats">
      <h2>{{ getViewersStatsTitle() }}</h2>

      <div class="date-filter-wrapper">
        <label class="visually-hidden" for="date-filter">Filter viewers stats by date</label>
        <my-select-options inputId="date-filter" [(ngModel)]="currentDateFilter" (ngModelChange)="onDateFilterChange()" [items]="dateFilters"></my-select-options>
      </div>

      <div class="cards">
        <div *ngFor="let card of overallStatCards" class="card stats-card">
          <div class="label">{{ card.label }}</div>
          <div class="value">{{ card.value }}</div>
          <div *ngIf="card.moreInfo" class="more-info">{{ card.moreInfo }}</div>
        </div>
      </div>
    </div>

    <div class="timeserie">
      <div ngbNav #nav="ngbNav" [activeId]="activeGraphId" (activeIdChange)="onChartChange($event)" class="nav-tabs">

        <ng-container *ngFor="let availableChart of availableCharts" [ngbNavItem]="availableChart.id">
          <a ngbNavLink>
            <span>{{ availableChart.label }}</span>
          </a>

          <ng-template ngbNavContent>
            <div class="chart-container">
              <p-chart
                *ngIf="chartOptions[availableChart.id]"
                [height]="chartHeight" [width]="chartWidth"
                [type]="chartOptions[availableChart.id].type" [options]="chartOptions[availableChart.id].options" [data]="chartOptions[availableChart.id].data"
                [plugins]="chartPlugins"
              ></p-chart>
            </div>

            <div class="zoom-container">
              <span *ngIf="!hasZoom() && availableChart.zoomEnabled" i18n class="description">You can select a part of the graph to zoom in</span>

              <my-button i18n *ngIf="hasZoom()" (click)="resetZoom()">Reset zoom</my-button>
            </div>
          </ng-template>
        </ng-container>
      </div>

      <div [ngbNavOutlet]="nav"></div>
    </div>
  </div>
</div>