]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/videos/+video-edit/video-add.component.ts
64071b40c37753dc4f0dc9f3c4bf5dba418d5c3f
[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 { VideoImportComponent } from '@app/videos/+video-edit/video-import.component'
4 import { VideoUploadComponent } from '@app/videos/+video-edit/video-upload.component'
5
6 @Component({
7 selector: 'my-videos-add',
8 templateUrl: './video-add.component.html',
9 styleUrls: [ './video-add.component.scss' ]
10 })
11 export class VideoAddComponent implements CanComponentDeactivate {
12 @ViewChild('videoUpload') videoUpload: VideoUploadComponent
13 @ViewChild('videoImport') videoImport: VideoImportComponent
14
15 secondStepType: 'upload' | 'import'
16 videoName: string
17
18 onFirstStepDone (type: 'upload' | 'import', videoName: string) {
19 this.secondStepType = type
20 this.videoName = videoName
21 }
22
23 canDeactivate () {
24 if (this.secondStepType === 'upload') return this.videoUpload.canDeactivate()
25 if (this.secondStepType === 'import') return this.videoImport.canDeactivate()
26
27 return { canDeactivate: true }
28 }
29 }