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'
7 selector: 'my-videos-add',
8 templateUrl: './video-add.component.html',
9 styleUrls: [ './video-add.component.scss' ]
11 export class VideoAddComponent implements CanComponentDeactivate {
12 @ViewChild('videoUpload') videoUpload: VideoUploadComponent
13 @ViewChild('videoImport') videoImport: VideoImportComponent
15 secondStepType: 'upload' | 'import'
18 onFirstStepDone (type: 'upload' | 'import', videoName: string) {
19 this.secondStepType = type
20 this.videoName = videoName
24 if (this.secondStepType === 'upload') return this.videoUpload.canDeactivate()
25 if (this.secondStepType === 'import') return this.videoImport.canDeactivate()
27 return { canDeactivate: true }