diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-05 10:56:23 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-11-09 15:33:04 +0100 |
commit | f8c00564e7e66c7c9d65ea044a4c1485df0e4c7c (patch) | |
tree | 895792776837b477d4daff3d1c112942015d0371 /client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts | |
parent | ba881f0e3f60218b28abbb59d23118db5f97d5f8 (diff) | |
download | PeerTube-f8c00564e7e66c7c9d65ea044a4c1485df0e4c7c.tar.gz PeerTube-f8c00564e7e66c7c9d65ea044a4c1485df0e4c7c.tar.zst PeerTube-f8c00564e7e66c7c9d65ea044a4c1485df0e4c7c.zip |
Add live info in watch page
Diffstat (limited to 'client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts')
-rw-r--r-- | client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts index 8f4c129a5..18b4a2f3c 100644 --- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts | |||
@@ -13,6 +13,7 @@ import { | |||
13 | VideoDetails, | 13 | VideoDetails, |
14 | VideoService | 14 | VideoService |
15 | } from '../shared-main' | 15 | } from '../shared-main' |
16 | import { LiveStreamInformationComponent } from '../shared-video-live' | ||
16 | import { VideoAddToPlaylistComponent } from '../shared-video-playlist' | 17 | import { VideoAddToPlaylistComponent } from '../shared-video-playlist' |
17 | import { VideoDownloadComponent } from './video-download.component' | 18 | import { VideoDownloadComponent } from './video-download.component' |
18 | 19 | ||
@@ -25,6 +26,7 @@ export type VideoActionsDisplayType = { | |||
25 | report?: boolean | 26 | report?: boolean |
26 | duplicate?: boolean | 27 | duplicate?: boolean |
27 | mute?: boolean | 28 | mute?: boolean |
29 | liveInfo?: boolean | ||
28 | } | 30 | } |
29 | 31 | ||
30 | @Component({ | 32 | @Component({ |
@@ -39,6 +41,7 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
39 | @ViewChild('videoDownloadModal') videoDownloadModal: VideoDownloadComponent | 41 | @ViewChild('videoDownloadModal') videoDownloadModal: VideoDownloadComponent |
40 | @ViewChild('videoReportModal') videoReportModal: VideoReportComponent | 42 | @ViewChild('videoReportModal') videoReportModal: VideoReportComponent |
41 | @ViewChild('videoBlockModal') videoBlockModal: VideoBlockComponent | 43 | @ViewChild('videoBlockModal') videoBlockModal: VideoBlockComponent |
44 | @ViewChild('liveStreamInformationModal') liveStreamInformationModal: LiveStreamInformationComponent | ||
42 | 45 | ||
43 | @Input() video: Video | VideoDetails | 46 | @Input() video: Video | VideoDetails |
44 | @Input() videoCaptions: VideoCaption[] = [] | 47 | @Input() videoCaptions: VideoCaption[] = [] |
@@ -51,7 +54,8 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
51 | delete: true, | 54 | delete: true, |
52 | report: true, | 55 | report: true, |
53 | duplicate: true, | 56 | duplicate: true, |
54 | mute: true | 57 | mute: true, |
58 | liveInfo: false | ||
55 | } | 59 | } |
56 | @Input() placement = 'left' | 60 | @Input() placement = 'left' |
57 | 61 | ||
@@ -127,6 +131,12 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
127 | this.videoBlockModal.show() | 131 | this.videoBlockModal.show() |
128 | } | 132 | } |
129 | 133 | ||
134 | showLiveInfoModal (video: Video) { | ||
135 | this.modalOpened.emit() | ||
136 | |||
137 | this.liveStreamInformationModal.show(video) | ||
138 | } | ||
139 | |||
130 | /* Actions checker */ | 140 | /* Actions checker */ |
131 | 141 | ||
132 | isVideoUpdatable () { | 142 | isVideoUpdatable () { |
@@ -145,6 +155,10 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
145 | return this.video.isUnblockableBy(this.user) | 155 | return this.video.isUnblockableBy(this.user) |
146 | } | 156 | } |
147 | 157 | ||
158 | isVideoLiveInfoAvailable () { | ||
159 | return this.video.isLiveInfoAvailableBy(this.user) | ||
160 | } | ||
161 | |||
148 | isVideoDownloadable () { | 162 | isVideoDownloadable () { |
149 | return this.video && | 163 | return this.video && |
150 | this.video.isLive !== true && | 164 | this.video.isLive !== true && |
@@ -261,6 +275,12 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
261 | iconName: 'download' | 275 | iconName: 'download' |
262 | }, | 276 | }, |
263 | { | 277 | { |
278 | label: $localize`Display live information`, | ||
279 | handler: ({ video }) => this.showLiveInfoModal(video), | ||
280 | isDisplayed: () => this.isVideoLiveInfoAvailable(), | ||
281 | iconName: 'live' | ||
282 | }, | ||
283 | { | ||
264 | label: $localize`Update`, | 284 | label: $localize`Update`, |
265 | linkBuilder: ({ video }) => [ '/videos/update', video.uuid ], | 285 | linkBuilder: ({ video }) => [ '/videos/update', video.uuid ], |
266 | iconName: 'edit', | 286 | iconName: 'edit', |