aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+videos')
-rw-r--r--client/src/app/+videos/+video-edit/video-add.component.html41
-rw-r--r--client/src/app/+videos/+video-edit/video-add.component.scss21
-rw-r--r--client/src/app/+videos/+video-edit/video-add.component.ts36
3 files changed, 82 insertions, 16 deletions
diff --git a/client/src/app/+videos/+video-edit/video-add.component.html b/client/src/app/+videos/+video-edit/video-add.component.html
index ac75d9ff8..b056c6e7a 100644
--- a/client/src/app/+videos/+video-edit/video-add.component.html
+++ b/client/src/app/+videos/+video-edit/video-add.component.html
@@ -1,18 +1,43 @@
1<div *ngIf="user.isUploadDisabled()" class="no-upload"> 1<ng-template #AlertButtons>
2 <div class="alert alert-warning"> 2 <a i18n routerLink="/about/instance" *ngIf="!isContactFormEnabled" class="about-link">Read instance rules for help</a>
3 <div i18n>Sorry, the upload feature is disabled for your account. If you want to add videos, an admin must unlock your quota.</div> 3 <a i18n routerLink="/about/contact" *ngIf="isContactFormEnabled" class="contact-link">Contact us</a>
4 <a i18n routerLink="/about/instance" class="about-link">Read instance rules for help</a> 4</ng-template>
5
6<ng-container *ngIf="user.isUploadDisabled()">
7 <div class="upload-message upload-disabled alert alert-warning">
8 <div>{{ uploadMessages.noQuota }}</div>
9 <ng-template [ngTemplateOutlet]="AlertButtons"></ng-template>
5 </div> 10 </div>
6 <img src="/client/assets/images/mascot/defeated.svg" alt="defeated mascot">
7</div>
8 11
9<div *ngIf="!user.isUploadDisabled()" class="margin-content"> 12 <div class="upload-image">
10 <div class="alert alert-warning" *ngIf="isRootUser()" i18n> 13 <img src="/client/assets/images/mascot/defeated.svg" alt="defeated mascot">
14 </div>
15</ng-container>
16
17<ng-container *ngIf="!user.isUploadDisabled()">
18 <div *ngIf="user.isAutoBlocked()" class="upload-message auto-blocked alert alert-warning">
19 <div>{{ uploadMessages.autoBlock }}</div>
20 <ng-template [ngTemplateOutlet]="AlertButtons" *ngIf="!user.hasNoQuotaLeft() && !user.hasNoQuotaLeftDaily()"></ng-template>
21 </div>
22
23 <div *ngIf="user.hasNoQuotaLeft()" class="upload-message quota-daily-left alert alert-warning">
24 <div>{{ uploadMessages.quotaLeftDaily }}</div>
25 <ng-template [ngTemplateOutlet]="AlertButtons" *ngIf="!user.hasNoQuotaLeft()"></ng-template>
26 </div>
27
28 <div *ngIf="user.hasNoQuotaLeft()" class="upload-message quota-left alert alert-warning">
29 <div>{{ uploadMessages.quotaLeft }}</div>
30 <ng-template [ngTemplateOutlet]="AlertButtons"></ng-template>
31 </div>
32
33 <div *ngIf="isRootUser()" class="upload-message root-user alert alert-warning" i18n>
11 We recommend you to not use the <strong>root</strong> user to publish your videos, since it's the super-admin account of your instance. 34 We recommend you to not use the <strong>root</strong> user to publish your videos, since it's the super-admin account of your instance.
12 <br /> 35 <br />
13 Instead, <a routerLink="/admin/users">create a dedicated account</a> to upload your videos. 36 Instead, <a routerLink="/admin/users">create a dedicated account</a> to upload your videos.
14 </div> 37 </div>
38</ng-container>
15 39
40<div *ngIf="!user.isUploadDisabled()" class="margin-content">
16 <my-user-quota *ngIf="!isInSecondStep() || secondStepType === 'go-live'" [user]="user" [userInformationLoaded]="userInformationLoaded"></my-user-quota> 41 <my-user-quota *ngIf="!isInSecondStep() || secondStepType === 'go-live'" [user]="user" [userInformationLoaded]="userInformationLoaded"></my-user-quota>
17 42
18 <div class="title-page title-page-single" *ngIf="isInSecondStep()"> 43 <div class="title-page title-page-single" *ngIf="isInSecondStep()">
diff --git a/client/src/app/+videos/+video-edit/video-add.component.scss b/client/src/app/+videos/+video-edit/video-add.component.scss
index dea6fde36..26be86d29 100644
--- a/client/src/app/+videos/+video-edit/video-add.component.scss
+++ b/client/src/app/+videos/+video-edit/video-add.component.scss
@@ -6,18 +6,29 @@ $border-type: solid;
6$border-color: #EAEAEA; 6$border-color: #EAEAEA;
7$nav-link-height: 40px; 7$nav-link-height: 40px;
8 8
9.no-upload { 9.upload-message {
10 height: 100%;
11 width: 100%; 10 width: 100%;
12 text-align: center; 11 text-align: center;
12 font-size: 15px;
13 margin-bottom: 0;
14
15 &:last-child {
16 margin-bottom: 1rem;
17 }
13 18
14 .about-link { 19 .about-link,
20 .contact-link {
15 @include peertube-button-link; 21 @include peertube-button-link;
16 @include orange-button; 22 @include orange-button;
17 23
18 height: fit-content; 24 height: fit-content;
19 margin-top: 10px; 25 margin-top: 10px;
20 } 26 }
27}
28
29.upload-image {
30 width: 100%;
31 text-align: center;
21 32
22 img { 33 img {
23 margin-top: 10px; 34 margin-top: 10px;
@@ -38,10 +49,6 @@ $nav-link-height: 40px;
38 padding-top: 20px; 49 padding-top: 20px;
39} 50}
40 51
41.alert {
42 font-size: 15px;
43}
44
45::ng-deep .video-add-nav { 52::ng-deep .video-add-nav {
46 border-bottom: $border-width $border-type $border-color; 53 border-bottom: $border-width $border-type $border-color;
47 margin: 20px 0 0 !important; 54 margin: 20px 0 0 !important;
diff --git a/client/src/app/+videos/+video-edit/video-add.component.ts b/client/src/app/+videos/+video-edit/video-add.component.ts
index 8606b8222..1443c64af 100644
--- a/client/src/app/+videos/+video-edit/video-add.component.ts
+++ b/client/src/app/+videos/+video-edit/video-add.component.ts
@@ -1,6 +1,6 @@
1import { Component, HostListener, OnInit, ViewChild } from '@angular/core' 1import { Component, HostListener, OnInit, ViewChild } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 2import { ActivatedRoute, Router } from '@angular/router'
3import { AuthService, AuthUser, CanComponentDeactivate, ServerService } from '@app/core' 3import { AuthService, AuthUser, CanComponentDeactivate, HooksService, ServerService } from '@app/core'
4import { HTMLServerConfig } from '@shared/models' 4import { HTMLServerConfig } from '@shared/models'
5import { VideoEditType } from './shared/video-edit.type' 5import { VideoEditType } from './shared/video-edit.type'
6import { VideoGoLiveComponent } from './video-add-components/video-go-live.component' 6import { VideoGoLiveComponent } from './video-add-components/video-go-live.component'
@@ -26,15 +26,27 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate {
26 26
27 activeNav: string 27 activeNav: string
28 28
29 uploadMessages: {
30 noQuota: string
31 autoBlock: string
32 quotaLeftDaily: string
33 quotaLeft: string
34 }
35
29 private serverConfig: HTMLServerConfig 36 private serverConfig: HTMLServerConfig
30 37
31 constructor ( 38 constructor (
32 private auth: AuthService, 39 private auth: AuthService,
40 private hooks: HooksService,
33 private serverService: ServerService, 41 private serverService: ServerService,
34 private route: ActivatedRoute, 42 private route: ActivatedRoute,
35 private router: Router 43 private router: Router
36 ) {} 44 ) {}
37 45
46 get isContactFormEnabled () {
47 return this.serverConfig.email.enabled && this.serverConfig.contactForm.enabled
48 }
49
38 get userInformationLoaded () { 50 get userInformationLoaded () {
39 return this.auth.userInformationLoaded 51 return this.auth.userInformationLoaded
40 } 52 }
@@ -49,6 +61,28 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate {
49 if (this.route.snapshot.fragment) { 61 if (this.route.snapshot.fragment) {
50 this.onNavChange(this.route.snapshot.fragment) 62 this.onNavChange(this.route.snapshot.fragment)
51 } 63 }
64
65 this.buildUploadMessages()
66 }
67
68 private async buildUploadMessages () {
69 // eslint-disable-next-line max-len
70 const noQuota = $localize`Sorry, the upload feature is disabled for your account. If you want to add videos, an admin must unlock your quota.`
71 // eslint-disable-next-line max-len
72 const autoBlock = $localize`Uploaded videos are reviewed before publishing for your account. If you want to add videos without moderation review, an admin must turn off your videos auto-block.`
73 // eslint-disable-next-line max-len
74 const quotaLeftDaily = $localize`Your daily video quota is insufficient. If you want to add more videos, you must wait for 24 hours or an admin must increase your daily quota.`
75 // eslint-disable-next-line max-len
76 const quotaLeft = $localize`Your video quota is insufficient. If you want to add more videos, an admin must increase your quota.`
77
78 const uploadMessages = {
79 noQuota,
80 autoBlock,
81 quotaLeftDaily,
82 quotaLeft
83 }
84
85 this.uploadMessages = await this.hooks.wrapObject(uploadMessages, 'common', 'filter:upload-page.alert-messages.edit.result')
52 } 86 }
53 87
54 onNavChange (newActiveNav: string) { 88 onNavChange (newActiveNav: string) {