From c729caf6cc34630877a0e5a1bda1719384cd0c8a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 11 Feb 2022 10:51:33 +0100 Subject: Add basic video editor support --- .../video-actions-dropdown.component.ts | 23 ++++++++++++++++++---- .../video-miniature.component.ts | 4 ++++ 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'client/src/app/shared/shared-video-miniature') 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 c2a318285..abbfc63f8 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 @@ -1,8 +1,8 @@ import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core' -import { AuthService, ConfirmService, Notifier, ScreenService } from '@app/core' +import { AuthService, ConfirmService, Notifier, ScreenService, ServerService } from '@app/core' import { BlocklistService, VideoBlockComponent, VideoBlockService, VideoReportComponent } from '@app/shared/shared-moderation' import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' -import { VideoCaption } from '@shared/models' +import { VideoCaption, VideoState } from '@shared/models' import { Actor, DropdownAction, @@ -29,6 +29,7 @@ export type VideoActionsDisplayType = { liveInfo?: boolean removeFiles?: boolean transcoding?: boolean + editor?: boolean } @Component({ @@ -59,7 +60,8 @@ export class VideoActionsDropdownComponent implements OnChanges { mute: true, liveInfo: false, removeFiles: false, - transcoding: false + transcoding: false, + editor: true } @Input() placement = 'left' @@ -89,7 +91,8 @@ export class VideoActionsDropdownComponent implements OnChanges { private videoBlocklistService: VideoBlockService, private screenService: ScreenService, private videoService: VideoService, - private redundancyService: RedundancyService + private redundancyService: RedundancyService, + private serverService: ServerService ) { } get user () { @@ -149,6 +152,12 @@ export class VideoActionsDropdownComponent implements OnChanges { return this.video.isUpdatableBy(this.user) } + isVideoEditable () { + return this.serverService.getHTMLConfig().videoEditor.enabled && + this.video.state?.id === VideoState.PUBLISHED && + this.video.isUpdatableBy(this.user) + } + isVideoRemovable () { return this.video.isRemovableBy(this.user) } @@ -329,6 +338,12 @@ export class VideoActionsDropdownComponent implements OnChanges { iconName: 'edit', isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.update && this.isVideoUpdatable() }, + { + label: $localize`Editor`, + linkBuilder: ({ video }) => [ '/video-editor/edit', video.uuid ], + iconName: 'film', + isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.editor && this.isVideoEditable() + }, { label: $localize`Block`, handler: () => this.showBlockModal(), diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts index 847e401ed..7de9fc8e2 100644 --- a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts @@ -195,6 +195,10 @@ export class VideoMiniatureComponent implements OnInit { return $localize`To import` } + if (video.state.id === VideoState.TO_EDIT) { + return $localize`To edit` + } + return '' } -- cgit v1.2.3