]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Move video alert in a dedicated component
authorChocobozzz <me@florianbigard.com>
Wed, 30 Jun 2021 06:55:11 +0000 (08:55 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 30 Jun 2021 06:56:14 +0000 (08:56 +0200)
client/src/app/+videos/+video-watch/shared/information/index.ts
client/src/app/+videos/+video-watch/shared/information/video-alert.component.html [new file with mode: 0644]
client/src/app/+videos/+video-watch/shared/information/video-alert.component.scss [new file with mode: 0644]
client/src/app/+videos/+video-watch/shared/information/video-alert.component.ts [new file with mode: 0644]
client/src/app/+videos/+video-watch/video-watch.component.html
client/src/app/+videos/+video-watch/video-watch.component.scss
client/src/app/+videos/+video-watch/video-watch.component.ts
client/src/app/+videos/+video-watch/video-watch.module.ts

index 4c9920765364bb490e000a187354cbd8e0c59791..2569251cf3878dc8cd9a4b0c9039185c4a132d47 100644 (file)
@@ -1 +1,2 @@
 export * from './privacy-concerns.component'
+export * from './video-alert.component'
diff --git a/client/src/app/+videos/+video-watch/shared/information/video-alert.component.html b/client/src/app/+videos/+video-watch/shared/information/video-alert.component.html
new file mode 100644 (file)
index 0000000..3480d36
--- /dev/null
@@ -0,0 +1,24 @@
+<div i18n class="alert alert-warning" *ngIf="isVideoToImport()">
+  The video is being imported, it will be available when the import is finished.
+</div>
+
+<div i18n class="alert alert-warning" *ngIf="isVideoToTranscode()">
+  The video is being transcoded, it may not work properly.
+</div>
+
+<div i18n class="alert alert-info" *ngIf="hasVideoScheduledPublication()">
+  This video will be published on {{ video.scheduledUpdate.updateAt | date: 'full' }}.
+</div>
+
+<div i18n class="alert alert-info" *ngIf="isWaitingForLive()">
+  This live has not started yet.
+</div>
+
+<div i18n class="alert alert-info" *ngIf="isLiveEnded()">
+  This live has ended.
+</div>
+
+<div class="alert alert-danger" *ngIf="video?.blacklisted">
+  <div class="blocked-label" i18n>This video is blocked.</div>
+  {{ video.blockedReason }}
+</div>
diff --git a/client/src/app/+videos/+video-watch/shared/information/video-alert.component.scss b/client/src/app/+videos/+video-watch/shared/information/video-alert.component.scss
new file mode 100644 (file)
index 0000000..109c31c
--- /dev/null
@@ -0,0 +1,4 @@
+.alert {
+  text-align: center;
+  border-radius: 0;
+}
diff --git a/client/src/app/+videos/+video-watch/shared/information/video-alert.component.ts b/client/src/app/+videos/+video-watch/shared/information/video-alert.component.ts
new file mode 100644 (file)
index 0000000..8a46ba0
--- /dev/null
@@ -0,0 +1,32 @@
+import { Component, Input } from '@angular/core'
+import { VideoDetails } from '@app/shared/shared-main'
+import { VideoState } from '@shared/models'
+
+@Component({
+  selector: 'my-video-alert',
+  templateUrl: './video-alert.component.html',
+  styleUrls: [ './video-alert.component.scss' ]
+})
+export class VideoAlertComponent {
+  @Input() video: VideoDetails
+
+  isVideoToTranscode () {
+    return this.video && this.video.state.id === VideoState.TO_TRANSCODE
+  }
+
+  isVideoToImport () {
+    return this.video && this.video.state.id === VideoState.TO_IMPORT
+  }
+
+  hasVideoScheduledPublication () {
+    return this.video && this.video.scheduledUpdate !== undefined
+  }
+
+  isWaitingForLive () {
+    return this.video?.state.id === VideoState.WAITING_FOR_LIVE
+  }
+
+  isLiveEnded () {
+    return this.video?.state.id === VideoState.LIVE_ENDED
+  }
+}
index 09be2d0859d0a8bd302d54ac60c3efccdb3e7656..a0508731f507aaa982970506eb221bdec87fab67 100644 (file)
     <my-plugin-placeholder pluginId="player-next"></my-plugin-placeholder>
   </div>
 
-  <div class="row">
-    <div i18n class="col-md-12 alert alert-warning" *ngIf="isVideoToImport()">
-      The video is being imported, it will be available when the import is finished.
-    </div>
-
-    <div i18n class="col-md-12 alert alert-warning" *ngIf="isVideoToTranscode()">
-      The video is being transcoded, it may not work properly.
-    </div>
-
-    <div i18n class="col-md-12 alert alert-info" *ngIf="hasVideoScheduledPublication()">
-      This video will be published on {{ video.scheduledUpdate.updateAt | date: 'full' }}.
-    </div>
-
-    <div i18n class="col-md-12 alert alert-info" *ngIf="isWaitingForLive()">
-      This live has not started yet.
-    </div>
-
-    <div i18n class="col-md-12 alert alert-info" *ngIf="isLiveEnded()">
-      This live has ended.
-    </div>
-
-    <div class="col-md-12 alert alert-danger" *ngIf="video?.blacklisted">
-      <div class="blocked-label" i18n>This video is blocked.</div>
-      {{ video.blockedReason }}
-    </div>
-  </div>
+  <my-video-alert [video]="video"></my-video-alert>
 
   <!-- Video information -->
   <div *ngIf="video" class="margin-content video-bottom">
index ee74cb0b0fb419428e7832ad5875c197e5d0ed0b..2fc847716274b1ea6facf4164443bfe03e36913b 100644 (file)
@@ -30,11 +30,6 @@ $video-height: 66vh;
   height: 100%;
 }
 
-.alert {
-  text-align: center;
-  border-radius: 0;
-}
-
 .flex-direction-column {
   flex-direction: column;
 }
index ca20c2b852d9fa2ddfcb519a04a0e1d9ed3d7b73..7af37ef03ad815a915942980b47dba08ed408b03 100644 (file)
@@ -220,26 +220,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
     }
   }
 
-  isVideoToTranscode () {
-    return this.video && this.video.state.id === VideoState.TO_TRANSCODE
-  }
-
-  isVideoToImport () {
-    return this.video && this.video.state.id === VideoState.TO_IMPORT
-  }
-
-  hasVideoScheduledPublication () {
-    return this.video && this.video.scheduledUpdate !== undefined
-  }
-
-  isWaitingForLive () {
-    return this.video?.state.id === VideoState.WAITING_FOR_LIVE
-  }
-
-  isLiveEnded () {
-    return this.video?.state.id === VideoState.LIVE_ENDED
-  }
-
   isVideoBlur (video: Video) {
     return video.isVideoNSFWForUser(this.user, this.serverConfig)
   }
index 60252534214d598ce99bea5b4f15198a835cb6e8..4669a700c5f17bfdf2d1cc1a9a7521295461d315 100644 (file)
@@ -14,13 +14,14 @@ import { SharedActorImageModule } from '../../shared/shared-actor-image/shared-a
 import { VideoCommentService } from '../../shared/shared-video-comment/video-comment.service'
 import { PlayerStylesComponent } from './player-styles.component'
 import {
+  ActionButtonsComponent,
+  PrivacyConcernsComponent,
   RecommendationsModule,
+  VideoAlertComponent,
   VideoAvatarChannelComponent,
   VideoDescriptionComponent,
   VideoRateComponent,
-  VideoWatchPlaylistComponent,
-  ActionButtonsComponent,
-  PrivacyConcernsComponent
+  VideoWatchPlaylistComponent
 } from './shared'
 import { VideoCommentAddComponent } from './shared/comment/video-comment-add.component'
 import { VideoCommentComponent } from './shared/comment/video-comment.component'
@@ -55,6 +56,7 @@ import { VideoWatchComponent } from './video-watch.component'
     VideoDescriptionComponent,
     PrivacyConcernsComponent,
     ActionButtonsComponent,
+    VideoAlertComponent,
 
     VideoCommentsComponent,
     VideoCommentAddComponent,