]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/videos/+video-edit/video-add.component.ts
fix likes bar, grid adjustment and menu width
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / +video-edit / video-add.component.ts
1 import { Component, ViewChild } from '@angular/core'
2 import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service'
3 import { VideoImportUrlComponent } from '@app/videos/+video-edit/video-add-components/video-import-url.component'
4 import { VideoUploadComponent } from '@app/videos/+video-edit/video-add-components/video-upload.component'
5 import { ServerService } from '@app/core'
6 import { VideoImportTorrentComponent } from '@app/videos/+video-edit/video-add-components/video-import-torrent.component'
7
8 @Component({
9 selector: 'my-videos-add',
10 templateUrl: './video-add.component.html',
11 styleUrls: [ './video-add.component.scss' ]
12 })
13 export class VideoAddComponent implements CanComponentDeactivate {
14 @ViewChild('videoUpload') videoUpload: VideoUploadComponent
15 @ViewChild('videoImportUrl') videoImportUrl: VideoImportUrlComponent
16 @ViewChild('videoImportTorrent') videoImportTorrent: VideoImportTorrentComponent
17
18 secondStepType: 'upload' | 'import-url' | 'import-torrent'
19 videoName: string
20
21 constructor (
22 private serverService: ServerService
23 ) {}
24
25 onFirstStepDone (type: 'upload' | 'import-url' | 'import-torrent', videoName: string) {
26 this.secondStepType = type
27 this.videoName = videoName
28 }
29
30 canDeactivate () {
31 if (this.secondStepType === 'upload') return this.videoUpload.canDeactivate()
32 if (this.secondStepType === 'import-url') return this.videoImportUrl.canDeactivate()
33 if (this.secondStepType === 'import-torrent') return this.videoImportTorrent.canDeactivate()
34
35 return { canDeactivate: true }
36 }
37
38 isVideoImportHttpEnabled () {
39 return this.serverService.getConfig().import.videos.http.enabled
40 }
41
42 isVideoImportTorrentEnabled () {
43 return this.serverService.getConfig().import.videos.torrent.enabled
44 }
45 }