diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-30 08:55:11 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-30 08:56:14 +0200 |
commit | 2453589a286e1f65843af582512387b2fa17b502 (patch) | |
tree | 57d41d8c432ca4e793a16d3b51f665b34aafec52 /client | |
parent | d4f0b2ecec221b6cdd75b5d87ba800c6301a15df (diff) | |
download | PeerTube-2453589a286e1f65843af582512387b2fa17b502.tar.gz PeerTube-2453589a286e1f65843af582512387b2fa17b502.tar.zst PeerTube-2453589a286e1f65843af582512387b2fa17b502.zip |
Move video alert in a dedicated component
Diffstat (limited to 'client')
8 files changed, 67 insertions, 54 deletions
diff --git a/client/src/app/+videos/+video-watch/shared/information/index.ts b/client/src/app/+videos/+video-watch/shared/information/index.ts index 4c9920765..2569251cf 100644 --- a/client/src/app/+videos/+video-watch/shared/information/index.ts +++ b/client/src/app/+videos/+video-watch/shared/information/index.ts | |||
@@ -1 +1,2 @@ | |||
1 | export * from './privacy-concerns.component' | 1 | export * from './privacy-concerns.component' |
2 | 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 index 000000000..3480d3656 --- /dev/null +++ b/client/src/app/+videos/+video-watch/shared/information/video-alert.component.html | |||
@@ -0,0 +1,24 @@ | |||
1 | <div i18n class="alert alert-warning" *ngIf="isVideoToImport()"> | ||
2 | The video is being imported, it will be available when the import is finished. | ||
3 | </div> | ||
4 | |||
5 | <div i18n class="alert alert-warning" *ngIf="isVideoToTranscode()"> | ||
6 | The video is being transcoded, it may not work properly. | ||
7 | </div> | ||
8 | |||
9 | <div i18n class="alert alert-info" *ngIf="hasVideoScheduledPublication()"> | ||
10 | This video will be published on {{ video.scheduledUpdate.updateAt | date: 'full' }}. | ||
11 | </div> | ||
12 | |||
13 | <div i18n class="alert alert-info" *ngIf="isWaitingForLive()"> | ||
14 | This live has not started yet. | ||
15 | </div> | ||
16 | |||
17 | <div i18n class="alert alert-info" *ngIf="isLiveEnded()"> | ||
18 | This live has ended. | ||
19 | </div> | ||
20 | |||
21 | <div class="alert alert-danger" *ngIf="video?.blacklisted"> | ||
22 | <div class="blocked-label" i18n>This video is blocked.</div> | ||
23 | {{ video.blockedReason }} | ||
24 | </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 index 000000000..109c31c57 --- /dev/null +++ b/client/src/app/+videos/+video-watch/shared/information/video-alert.component.scss | |||
@@ -0,0 +1,4 @@ | |||
1 | .alert { | ||
2 | text-align: center; | ||
3 | border-radius: 0; | ||
4 | } | ||
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 index 000000000..8a46ba0d5 --- /dev/null +++ b/client/src/app/+videos/+video-watch/shared/information/video-alert.component.ts | |||
@@ -0,0 +1,32 @@ | |||
1 | import { Component, Input } from '@angular/core' | ||
2 | import { VideoDetails } from '@app/shared/shared-main' | ||
3 | import { VideoState } from '@shared/models' | ||
4 | |||
5 | @Component({ | ||
6 | selector: 'my-video-alert', | ||
7 | templateUrl: './video-alert.component.html', | ||
8 | styleUrls: [ './video-alert.component.scss' ] | ||
9 | }) | ||
10 | export class VideoAlertComponent { | ||
11 | @Input() video: VideoDetails | ||
12 | |||
13 | isVideoToTranscode () { | ||
14 | return this.video && this.video.state.id === VideoState.TO_TRANSCODE | ||
15 | } | ||
16 | |||
17 | isVideoToImport () { | ||
18 | return this.video && this.video.state.id === VideoState.TO_IMPORT | ||
19 | } | ||
20 | |||
21 | hasVideoScheduledPublication () { | ||
22 | return this.video && this.video.scheduledUpdate !== undefined | ||
23 | } | ||
24 | |||
25 | isWaitingForLive () { | ||
26 | return this.video?.state.id === VideoState.WAITING_FOR_LIVE | ||
27 | } | ||
28 | |||
29 | isLiveEnded () { | ||
30 | return this.video?.state.id === VideoState.LIVE_ENDED | ||
31 | } | ||
32 | } | ||
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.html b/client/src/app/+videos/+video-watch/video-watch.component.html index 09be2d085..a0508731f 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.html +++ b/client/src/app/+videos/+video-watch/video-watch.component.html | |||
@@ -20,32 +20,7 @@ | |||
20 | <my-plugin-placeholder pluginId="player-next"></my-plugin-placeholder> | 20 | <my-plugin-placeholder pluginId="player-next"></my-plugin-placeholder> |
21 | </div> | 21 | </div> |
22 | 22 | ||
23 | <div class="row"> | 23 | <my-video-alert [video]="video"></my-video-alert> |
24 | <div i18n class="col-md-12 alert alert-warning" *ngIf="isVideoToImport()"> | ||
25 | The video is being imported, it will be available when the import is finished. | ||
26 | </div> | ||
27 | |||
28 | <div i18n class="col-md-12 alert alert-warning" *ngIf="isVideoToTranscode()"> | ||
29 | The video is being transcoded, it may not work properly. | ||
30 | </div> | ||
31 | |||
32 | <div i18n class="col-md-12 alert alert-info" *ngIf="hasVideoScheduledPublication()"> | ||
33 | This video will be published on {{ video.scheduledUpdate.updateAt | date: 'full' }}. | ||
34 | </div> | ||
35 | |||
36 | <div i18n class="col-md-12 alert alert-info" *ngIf="isWaitingForLive()"> | ||
37 | This live has not started yet. | ||
38 | </div> | ||
39 | |||
40 | <div i18n class="col-md-12 alert alert-info" *ngIf="isLiveEnded()"> | ||
41 | This live has ended. | ||
42 | </div> | ||
43 | |||
44 | <div class="col-md-12 alert alert-danger" *ngIf="video?.blacklisted"> | ||
45 | <div class="blocked-label" i18n>This video is blocked.</div> | ||
46 | {{ video.blockedReason }} | ||
47 | </div> | ||
48 | </div> | ||
49 | 24 | ||
50 | <!-- Video information --> | 25 | <!-- Video information --> |
51 | <div *ngIf="video" class="margin-content video-bottom"> | 26 | <div *ngIf="video" class="margin-content video-bottom"> |
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.scss b/client/src/app/+videos/+video-watch/video-watch.component.scss index ee74cb0b0..2fc847716 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.scss +++ b/client/src/app/+videos/+video-watch/video-watch.component.scss | |||
@@ -30,11 +30,6 @@ $video-height: 66vh; | |||
30 | height: 100%; | 30 | height: 100%; |
31 | } | 31 | } |
32 | 32 | ||
33 | .alert { | ||
34 | text-align: center; | ||
35 | border-radius: 0; | ||
36 | } | ||
37 | |||
38 | .flex-direction-column { | 33 | .flex-direction-column { |
39 | flex-direction: column; | 34 | flex-direction: column; |
40 | } | 35 | } |
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts index ca20c2b85..7af37ef03 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -220,26 +220,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
220 | } | 220 | } |
221 | } | 221 | } |
222 | 222 | ||
223 | isVideoToTranscode () { | ||
224 | return this.video && this.video.state.id === VideoState.TO_TRANSCODE | ||
225 | } | ||
226 | |||
227 | isVideoToImport () { | ||
228 | return this.video && this.video.state.id === VideoState.TO_IMPORT | ||
229 | } | ||
230 | |||
231 | hasVideoScheduledPublication () { | ||
232 | return this.video && this.video.scheduledUpdate !== undefined | ||
233 | } | ||
234 | |||
235 | isWaitingForLive () { | ||
236 | return this.video?.state.id === VideoState.WAITING_FOR_LIVE | ||
237 | } | ||
238 | |||
239 | isLiveEnded () { | ||
240 | return this.video?.state.id === VideoState.LIVE_ENDED | ||
241 | } | ||
242 | |||
243 | isVideoBlur (video: Video) { | 223 | isVideoBlur (video: Video) { |
244 | return video.isVideoNSFWForUser(this.user, this.serverConfig) | 224 | return video.isVideoNSFWForUser(this.user, this.serverConfig) |
245 | } | 225 | } |
diff --git a/client/src/app/+videos/+video-watch/video-watch.module.ts b/client/src/app/+videos/+video-watch/video-watch.module.ts index 602525342..4669a700c 100644 --- a/client/src/app/+videos/+video-watch/video-watch.module.ts +++ b/client/src/app/+videos/+video-watch/video-watch.module.ts | |||
@@ -14,13 +14,14 @@ import { SharedActorImageModule } from '../../shared/shared-actor-image/shared-a | |||
14 | import { VideoCommentService } from '../../shared/shared-video-comment/video-comment.service' | 14 | import { VideoCommentService } from '../../shared/shared-video-comment/video-comment.service' |
15 | import { PlayerStylesComponent } from './player-styles.component' | 15 | import { PlayerStylesComponent } from './player-styles.component' |
16 | import { | 16 | import { |
17 | ActionButtonsComponent, | ||
18 | PrivacyConcernsComponent, | ||
17 | RecommendationsModule, | 19 | RecommendationsModule, |
20 | VideoAlertComponent, | ||
18 | VideoAvatarChannelComponent, | 21 | VideoAvatarChannelComponent, |
19 | VideoDescriptionComponent, | 22 | VideoDescriptionComponent, |
20 | VideoRateComponent, | 23 | VideoRateComponent, |
21 | VideoWatchPlaylistComponent, | 24 | VideoWatchPlaylistComponent |
22 | ActionButtonsComponent, | ||
23 | PrivacyConcernsComponent | ||
24 | } from './shared' | 25 | } from './shared' |
25 | import { VideoCommentAddComponent } from './shared/comment/video-comment-add.component' | 26 | import { VideoCommentAddComponent } from './shared/comment/video-comment-add.component' |
26 | import { VideoCommentComponent } from './shared/comment/video-comment.component' | 27 | import { VideoCommentComponent } from './shared/comment/video-comment.component' |
@@ -55,6 +56,7 @@ import { VideoWatchComponent } from './video-watch.component' | |||
55 | VideoDescriptionComponent, | 56 | VideoDescriptionComponent, |
56 | PrivacyConcernsComponent, | 57 | PrivacyConcernsComponent, |
57 | ActionButtonsComponent, | 58 | ActionButtonsComponent, |
59 | VideoAlertComponent, | ||
58 | 60 | ||
59 | VideoCommentsComponent, | 61 | VideoCommentsComponent, |
60 | VideoCommentAddComponent, | 62 | VideoCommentAddComponent, |