Chocobozzz/PeerTube

View on GitHub
client/src/app/+videos/+video-edit/video-add-components/video-upload.component.html

Summary

Maintainability
Test Coverage
<div *ngIf="!isUploadingVideo" class="upload-video-container" myDragDrop (fileDropped)="onFileDropped($event)">
  <div class="first-step-block">
    <my-global-icon class="upload-icon" iconName="upload" aria-hidden="true"></my-global-icon>

    <div class="button-file form-control" [ngbTooltip]="'(extensions: ' + getVideoExtensions() + ')'">
      <span i18n>Select the file to upload</span>
      <input
        aria-label="Select the file to upload"
        i18n-aria-label
        #videofileInput
        [accept]="getVideoExtensions()"
        (change)="onFileChange($event)"
        id="videofile"
        type="file"
      />
    </div>

    <div class="form-group form-group-channel">
      <label i18n for="first-step-channel">Channel</label>
      <my-select-channel inputId="first-step-channel" [items]="userVideoChannels" [(ngModel)]="firstStepChannelId"></my-select-channel>
    </div>

    <div class="form-group">
      <label i18n for="first-step-privacy">Privacy</label>
      <my-select-options inputId="first-step-privacy" [items]="videoPrivacies" [(ngModel)]="firstStepPrivacyId"></my-select-options>
    </div>

    <ng-container *ngIf="isUploadingAudioFile">
      <div  class="form-group audio-preview">
        <label i18n for="previewfileUpload">Video background image</label>

        <div i18n class="audio-image-info">
          Image that will be merged with your audio file.
          <br />
          The chosen image will be definitive and cannot be modified.
        </div>

        <my-preview-upload
          i18n-inputLabel inputLabel="Edit" inputName="previewfileUpload" [(ngModel)]="previewfileUpload"
          previewWidth="360px" previewHeight="200px"
        ></my-preview-upload>
      </div>

      <div class="form-group upload-audio-button">
        <my-button theme="orange" [label]="getAudioUploadLabel()" icon="upload" (click)="uploadAudio()"></my-button>
      </div>
    </ng-container>
  </div>
</div>

<my-upload-progress
  [isUploading]="isUploadingVideo" [uploadPercents]="videoUploadPercents" [error]="error" [uploaded]="videoUploaded"
  [enableRetryAfterError]="enableRetryAfterError" (cancel)="cancelUpload()" (retry)="retryUpload()"
>
</my-upload-progress>

<my-alert *ngIf="videoUploaded && !error" type="primary" i18n>
  Congratulations! Your video is now available in your private library.
</my-alert>

<!-- Hidden because we want to load the component -->
<form [hidden]="!isUploadingVideo" novalidate [formGroup]="form" class="mb-3">
  <my-video-edit
    [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions"
    [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels"
    forbidScheduledPublication="false"
    type="upload"
  ></my-video-edit>

  <div class="submit-container">
    <div i18n *ngIf="videoUploaded === false" class="message-submit">Publish will be available when upload is finished</div>

    <my-button
      theme="orange" i18n-label label="Publish" icon="circle-tick"
      (click)="updateSecondStep()" (keydown.enter)="updateSecondStep()" [disabled]="isPublishingButtonDisabled()"
    ></my-button>
  </div>
</form>