Reorganize client shared modules
[oweals/peertube.git] / client / src / app / videos / +video-edit / video-add.component.html
index f151383f1cf392ae12bd575e9758bbed65d3f7ba..79bfc6e5cc539de3a52edb6227aca962819183dd 100644 (file)
@@ -1,64 +1,46 @@
 <div class="margin-content">
-  <div class="title-page title-page-single">
-    <ng-container *ngIf="!videoFileName" i18n>Upload your video</ng-container>
-    <ng-container *ngIf="videoFileName" i18n>Upload {{ videoFileName }}</ng-container>
+  <div class="alert alert-warning" *ngIf="isRootUser()" i18n>
+    We recommend you to not use the <strong>root</strong> user to publish your videos, since it's the super-admin account of your instance.
+    <br />
+    Instead, <a routerLink="/admin/users">create a dedicated account</a> to upload your videos.
   </div>
 
-  <div *ngIf="!isUploadingVideo" class="upload-video-container">
-    <div class="upload-video">
-      <div class="icon icon-upload"></div>
-
-      <div class="button-file">
-        <span i18n>Select the file to upload (.mp4, .webm, .ogv)</span>
-        <input #videofileInput type="file" name="videofile" id="videofile" [accept]="videoExtensions" (change)="fileChange()" />
-      </div>
-
-      <div class="form-group form-group-channel">
-        <label i18n for="first-step-channel">Channel</label>
-        <div class="peertube-select-container">
-          <select id="first-step-channel" [(ngModel)]="firstStepChannelId">
-            <option *ngFor="let channel of userVideoChannels" [value]="channel.id">{{ channel.label }}</option>
-          </select>
-        </div>
-      </div>
-
-      <div class="form-group">
-        <label i18n for="first-step-privacy">Privacy</label>
-        <div class="peertube-select-container">
-          <select id="first-step-privacy" [(ngModel)]="firstStepPrivacyId">
-            <option *ngFor="let privacy of videoPrivacies" [value]="privacy.id">{{ privacy.label }}</option>
-            <option [value]="SPECIAL_SCHEDULED_PRIVACY">Scheduled</option>
-          </select>
-        </div>
-      </div>
-    </div>
+  <div class="title-page title-page-single" *ngIf="isInSecondStep()">
+    <ng-container *ngIf="secondStepType === 'import-url' || secondStepType === 'import-torrent'" i18n>Import {{ videoName }}</ng-container>
+    <ng-container *ngIf="secondStepType === 'upload'" i18n>Upload {{ videoName }}</ng-container>
   </div>
 
-  <div *ngIf="isUploadingVideo" class="upload-progress-cancel">
-    <p-progressBar
-      [value]="videoUploadPercents"
-      [ngClass]="{ processing: videoUploadPercents === 100 && videoUploaded === false }"
-    ></p-progressBar>
-    <input *ngIf="videoUploaded === false" type="button" value="Cancel" (click)="cancelUpload()" />
+  <div ngbNav #nav="ngbNav" class="nav-tabs video-add-nav" [ngClass]="{ 'hide-nav': secondStepType !== undefined }">
+    <ng-container ngbNavItem>
+      <a ngbNavLink>
+        <span i18n>Upload a file</span>
+      </a>
+
+      <ng-template ngbNavContent>
+        <my-video-upload #videoUpload (firstStepDone)="onFirstStepDone('upload', $event)" (firstStepError)="onError()"></my-video-upload>
+      </ng-template>
+    </ng-container>
+
+    <ng-container ngbNavItem *ngIf="isVideoImportHttpEnabled()">
+      <a ngbNavLink>
+        <span i18n>Import with URL</span>
+      </a>
+
+      <ng-template ngbNavContent>
+        <my-video-import-url #videoImportUrl (firstStepDone)="onFirstStepDone('import-url', $event)" (firstStepError)="onError()"></my-video-import-url>
+      </ng-template>
+    </ng-container>
+
+    <ng-container ngbNavItem *ngIf="isVideoImportTorrentEnabled()">
+      <a ngbNavLink>
+        <span i18n>Import with torrent</span>
+      </a>
+
+      <ng-template ngbNavContent>
+        <my-video-import-torrent #videoImportTorrent (firstStepDone)="onFirstStepDone('import-torrent', $event)" (firstStepError)="onError()"></my-video-import-torrent>
+      </ng-template>
+    </ng-container>
   </div>
 
-  <!-- Hidden because we want to load the component -->
-  <form [hidden]="!isUploadingVideo" novalidate [formGroup]="form">
-    <my-video-edit
-      [form]="form" [formErrors]="formErrors"
-      [validationMessages]="validationMessages" [videoPrivacies]="videoPrivacies" [userVideoChannels]="userVideoChannels"
-    ></my-video-edit>
-
-    <div class="submit-container">
-      <div i18n *ngIf="videoUploaded === false" class="message-submit">Publish will be available when upload is finished</div>
-
-      <div class="submit-button"
-         (click)="updateSecondStep()"
-         [ngClass]="{ disabled: !form.valid || isUpdatingVideo === true || videoUploaded !== true }"
-      >
-        <span class="icon icon-validate"></span>
-        <input type="button" i18n-value value="Publish" />
-      </div>
-    </div>
-  </form>
+  <div [ngbNavOutlet]="nav"></div>
 </div>