aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-02-11 10:51:33 +0100
committerChocobozzz <chocobozzz@cpy.re>2022-02-28 10:42:19 +0100
commitc729caf6cc34630877a0e5a1bda1719384cd0c8a (patch)
tree1d2e13722e518c73d2c9e6f0969615e29d51cf8c /client/src/app/shared
parenta24bf4dc659cebb65d887862bf21d7a35e9ec791 (diff)
downloadPeerTube-c729caf6cc34630877a0e5a1bda1719384cd0c8a.tar.gz
PeerTube-c729caf6cc34630877a0e5a1bda1719384cd0c8a.tar.zst
PeerTube-c729caf6cc34630877a0e5a1bda1719384cd0c8a.zip
Add basic video editor support
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/shared-forms/form-reactive.ts2
-rw-r--r--client/src/app/shared/shared-forms/form-validator.service.ts2
-rw-r--r--client/src/app/shared/shared-forms/timestamp-input.component.html3
-rw-r--r--client/src/app/shared/shared-forms/timestamp-input.component.scss14
-rw-r--r--client/src/app/shared/shared-forms/timestamp-input.component.ts2
-rw-r--r--client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts23
-rw-r--r--client/src/app/shared/shared-video-miniature/video-miniature.component.ts4
7 files changed, 42 insertions, 8 deletions
diff --git a/client/src/app/shared/shared-forms/form-reactive.ts b/client/src/app/shared/shared-forms/form-reactive.ts
index 07a12c6f6..6b3a6c773 100644
--- a/client/src/app/shared/shared-forms/form-reactive.ts
+++ b/client/src/app/shared/shared-forms/form-reactive.ts
@@ -24,7 +24,7 @@ export abstract class FormReactive {
24 this.formErrors = formErrors 24 this.formErrors = formErrors
25 this.validationMessages = validationMessages 25 this.validationMessages = validationMessages
26 26
27 this.form.statusChanges.subscribe(async status => { 27 this.form.statusChanges.subscribe(async () => {
28 // FIXME: remove when https://github.com/angular/angular/issues/41519 is fixed 28 // FIXME: remove when https://github.com/angular/angular/issues/41519 is fixed
29 await this.waitPendingCheck() 29 await this.waitPendingCheck()
30 30
diff --git a/client/src/app/shared/shared-forms/form-validator.service.ts b/client/src/app/shared/shared-forms/form-validator.service.ts
index 0fe50ac9b..f67d5bb33 100644
--- a/client/src/app/shared/shared-forms/form-validator.service.ts
+++ b/client/src/app/shared/shared-forms/form-validator.service.ts
@@ -30,7 +30,7 @@ export class FormValidatorService {
30 30
31 if (field?.MESSAGES) validationMessages[name] = field.MESSAGES as { [ name: string ]: string } 31 if (field?.MESSAGES) validationMessages[name] = field.MESSAGES as { [ name: string ]: string }
32 32
33 const defaultValue = defaultValues[name] || '' 33 const defaultValue = defaultValues[name] ?? ''
34 34
35 if (field?.VALIDATORS) group[name] = [ defaultValue, field.VALIDATORS ] 35 if (field?.VALIDATORS) group[name] = [ defaultValue, field.VALIDATORS ]
36 else group[name] = [ defaultValue ] 36 else group[name] = [ defaultValue ]
diff --git a/client/src/app/shared/shared-forms/timestamp-input.component.html b/client/src/app/shared/shared-forms/timestamp-input.component.html
index c57a4b32c..c89a7b019 100644
--- a/client/src/app/shared/shared-forms/timestamp-input.component.html
+++ b/client/src/app/shared/shared-forms/timestamp-input.component.html
@@ -1,4 +1,5 @@
1<p-inputMask 1<p-inputMask
2 [disabled]="disabled" [(ngModel)]="timestampString" (onBlur)="onBlur()" 2 [disabled]="disabled" [(ngModel)]="timestampString" (onBlur)="onBlur()"
3 mask="9:99:99" slotChar="0" (ngModelChange)="onModelChange()" 3 [ngClass]="{ 'border-disabled': disableBorder }"
4 mask="9:99:99" slotChar="0" (ngModelChange)="onModelChange()" [inputId]="inputName"
4></p-inputMask> 5></p-inputMask>
diff --git a/client/src/app/shared/shared-forms/timestamp-input.component.scss b/client/src/app/shared/shared-forms/timestamp-input.component.scss
index d2358c027..27d6fa173 100644
--- a/client/src/app/shared/shared-forms/timestamp-input.component.scss
+++ b/client/src/app/shared/shared-forms/timestamp-input.component.scss
@@ -1,10 +1,10 @@
1@use '_variables' as *; 1@use '_variables' as *;
2@use '_mixins' as *;
2 3
3p-inputmask { 4p-inputmask {
4 ::ng-deep input { 5 ::ng-deep input {
5 width: 80px; 6 width: 80px;
6 font-size: 15px; 7 font-size: 15px;
7 border: 0;
8 8
9 &:focus-within, 9 &:focus-within,
10 &:focus { 10 &:focus {
@@ -16,4 +16,16 @@ p-inputmask {
16 opacity: 0.5; 16 opacity: 0.5;
17 } 17 }
18 } 18 }
19
20 &.border-disabled {
21 ::ng-deep input {
22 border: 0;
23 }
24 }
25
26 &:not(.border-disabled) {
27 ::ng-deep input {
28 @include peertube-input-text(80px);
29 }
30 }
19} 31}
diff --git a/client/src/app/shared/shared-forms/timestamp-input.component.ts b/client/src/app/shared/shared-forms/timestamp-input.component.ts
index 3fc705905..79ca63673 100644
--- a/client/src/app/shared/shared-forms/timestamp-input.component.ts
+++ b/client/src/app/shared/shared-forms/timestamp-input.component.ts
@@ -18,6 +18,8 @@ export class TimestampInputComponent implements ControlValueAccessor, OnInit {
18 @Input() maxTimestamp: number 18 @Input() maxTimestamp: number
19 @Input() timestamp: number 19 @Input() timestamp: number
20 @Input() disabled = false 20 @Input() disabled = false
21 @Input() inputName: string
22 @Input() disableBorder = true
21 23
22 @Output() inputBlur = new EventEmitter() 24 @Output() inputBlur = new EventEmitter()
23 25
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 @@
1import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core' 1import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core'
2import { AuthService, ConfirmService, Notifier, ScreenService } from '@app/core' 2import { AuthService, ConfirmService, Notifier, ScreenService, ServerService } from '@app/core'
3import { BlocklistService, VideoBlockComponent, VideoBlockService, VideoReportComponent } from '@app/shared/shared-moderation' 3import { BlocklistService, VideoBlockComponent, VideoBlockService, VideoReportComponent } from '@app/shared/shared-moderation'
4import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' 4import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'
5import { VideoCaption } from '@shared/models' 5import { VideoCaption, VideoState } from '@shared/models'
6import { 6import {
7 Actor, 7 Actor,
8 DropdownAction, 8 DropdownAction,
@@ -29,6 +29,7 @@ export type VideoActionsDisplayType = {
29 liveInfo?: boolean 29 liveInfo?: boolean
30 removeFiles?: boolean 30 removeFiles?: boolean
31 transcoding?: boolean 31 transcoding?: boolean
32 editor?: boolean
32} 33}
33 34
34@Component({ 35@Component({
@@ -59,7 +60,8 @@ export class VideoActionsDropdownComponent implements OnChanges {
59 mute: true, 60 mute: true,
60 liveInfo: false, 61 liveInfo: false,
61 removeFiles: false, 62 removeFiles: false,
62 transcoding: false 63 transcoding: false,
64 editor: true
63 } 65 }
64 @Input() placement = 'left' 66 @Input() placement = 'left'
65 67
@@ -89,7 +91,8 @@ export class VideoActionsDropdownComponent implements OnChanges {
89 private videoBlocklistService: VideoBlockService, 91 private videoBlocklistService: VideoBlockService,
90 private screenService: ScreenService, 92 private screenService: ScreenService,
91 private videoService: VideoService, 93 private videoService: VideoService,
92 private redundancyService: RedundancyService 94 private redundancyService: RedundancyService,
95 private serverService: ServerService
93 ) { } 96 ) { }
94 97
95 get user () { 98 get user () {
@@ -149,6 +152,12 @@ export class VideoActionsDropdownComponent implements OnChanges {
149 return this.video.isUpdatableBy(this.user) 152 return this.video.isUpdatableBy(this.user)
150 } 153 }
151 154
155 isVideoEditable () {
156 return this.serverService.getHTMLConfig().videoEditor.enabled &&
157 this.video.state?.id === VideoState.PUBLISHED &&
158 this.video.isUpdatableBy(this.user)
159 }
160
152 isVideoRemovable () { 161 isVideoRemovable () {
153 return this.video.isRemovableBy(this.user) 162 return this.video.isRemovableBy(this.user)
154 } 163 }
@@ -330,6 +339,12 @@ export class VideoActionsDropdownComponent implements OnChanges {
330 isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.update && this.isVideoUpdatable() 339 isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.update && this.isVideoUpdatable()
331 }, 340 },
332 { 341 {
342 label: $localize`Editor`,
343 linkBuilder: ({ video }) => [ '/video-editor/edit', video.uuid ],
344 iconName: 'film',
345 isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.editor && this.isVideoEditable()
346 },
347 {
333 label: $localize`Block`, 348 label: $localize`Block`,
334 handler: () => this.showBlockModal(), 349 handler: () => this.showBlockModal(),
335 iconName: 'no', 350 iconName: 'no',
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 {
195 return $localize`To import` 195 return $localize`To import`
196 } 196 }
197 197
198 if (video.state.id === VideoState.TO_EDIT) {
199 return $localize`To edit`
200 }
201
198 return '' 202 return ''
199 } 203 }
200 204