aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+my-account
diff options
context:
space:
mode:
authorKim <1877318+kimsible@users.noreply.github.com>2020-07-24 08:53:25 +0200
committerGitHub <noreply@github.com>2020-07-24 08:53:25 +0200
commit2e7f262724dd64a209e0bad5930ba29bb4f801c3 (patch)
treeae722bf8df3331442a5f9eaa34eb5c12db21f6cf /client/src/app/+my-account
parentb40a219338fed042072decea203838ca5e2b265f (diff)
downloadPeerTube-2e7f262724dd64a209e0bad5930ba29bb4f801c3.tar.gz
PeerTube-2e7f262724dd64a209e0bad5930ba29bb4f801c3.tar.zst
PeerTube-2e7f262724dd64a209e0bad5930ba29bb4f801c3.zip
Display user quota progress bars above upload form (#2981)
* Move user-quota to my-user-quota shared component * Add user-quota to upload form * Increase progress bar height and make it focusable * Correct syntax parenthesis * Add explicit title to user-quota bars + tooltip with quota values * Hide user-quota in second upload step * Customize focus styles on user-quota Co-authored-by: kimsible <kimsible@users.noreply.github.com>
Diffstat (limited to 'client/src/app/+my-account')
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-settings.component.html16
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-settings.component.scss21
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-settings.component.ts38
3 files changed, 3 insertions, 72 deletions
diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.html b/client/src/app/+my-account/my-account-settings/my-account-settings.component.html
index eb7bb0d6f..2ad014f01 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.html
+++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.html
@@ -14,21 +14,7 @@
14 14
15 <div class="form-group form-group-right col-12 col-lg-8 col-xl-9"> 15 <div class="form-group form-group-right col-12 col-lg-8 col-xl-9">
16 16
17 <div class="user-quota mb-3"> 17 <my-user-quota [user]="user" [userInformationLoaded]="userInformationLoaded"></my-user-quota>
18 <div>
19 <div class="progress" i18n-title title="Total video quota">
20 <div class="progress-bar" role="progressbar" [style]="{ width: userVideoQuotaPercentage + '%' }" [attr.aria-valuenow]="userVideoQuotaUsed" aria-valuemin="0" [attr.aria-valuemax]="user.videoQuota">{{ userVideoQuotaUsed | bytes: 0 }}</div>
21 <span class="ml-auto mr-2">{{ userVideoQuota }}</span>
22 </div>
23 </div>
24
25 <div *ngIf="hasDailyQuota()" class="mt-3">
26 <div class="progress" i18n-title title="Daily video quota">
27 <div class="progress-bar secondary" role="progressbar" [style]="{ width: userVideoQuotaDailyPercentage + '%' }" [attr.aria-valuenow]="userVideoQuotaUsedDaily" aria-valuemin="0" [attr.aria-valuemax]="user.videoQuotaDaily">{{ userVideoQuotaUsedDaily | bytes: 0 }}</div>
28 <span class="ml-auto mr-2">{{ userVideoQuotaDaily }}</span>
29 </div>
30 </div>
31 </div>
32 18
33 <my-account-profile [user]="user" [userInformationLoaded]="userInformationLoaded"></my-account-profile> 19 <my-account-profile [user]="user" [userInformationLoaded]="userInformationLoaded"></my-account-profile>
34 </div> 20 </div>
diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.scss b/client/src/app/+my-account/my-account-settings/my-account-settings.component.scss
index 1cdb1fab4..d17cd931e 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.scss
+++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.scss
@@ -1,15 +1,6 @@
1@import '_variables'; 1@import '_variables';
2@import '_mixins'; 2@import '_mixins';
3 3
4.user-quota {
5 font-size: 15px;
6 margin-top: 20px;
7
8 label {
9 margin-right: 5px;
10 }
11}
12
13.account-title { 4.account-title {
14 @include settings-big-title; 5 @include settings-big-title;
15 6
@@ -18,14 +9,6 @@
18 } 9 }
19} 10}
20 11
21.progress { 12.form-group {
22 @include progressbar; 13 max-width: 500px;
23 width: 500px;
24 max-width: 100%;
25}
26
27@media screen and (max-width: $small-view) {
28 .progress {
29 width: 100%;
30 }
31} 14}
diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts
index a9a150e21..a3a8ff1f1 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts
+++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts
@@ -1,4 +1,3 @@
1import { BytesPipe } from 'ngx-pipes'
2import { ViewportScroller } from '@angular/common' 1import { ViewportScroller } from '@angular/common'
3import { AfterViewChecked, Component, OnInit } from '@angular/core' 2import { AfterViewChecked, Component, OnInit } from '@angular/core'
4import { AuthService, Notifier, User, UserService } from '@app/core' 3import { AuthService, Notifier, User, UserService } from '@app/core'
@@ -12,14 +11,6 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
12export class MyAccountSettingsComponent implements OnInit, AfterViewChecked { 11export class MyAccountSettingsComponent implements OnInit, AfterViewChecked {
13 user: User = null 12 user: User = null
14 13
15 userVideoQuota = '0'
16 userVideoQuotaUsed = 0
17 userVideoQuotaPercentage = 15
18
19 userVideoQuotaDaily = '0'
20 userVideoQuotaUsedDaily = 0
21 userVideoQuotaDailyPercentage = 15
22
23 private lastScrollHash: string 14 private lastScrollHash: string
24 15
25 constructor ( 16 constructor (
@@ -36,31 +27,6 @@ export class MyAccountSettingsComponent implements OnInit, AfterViewChecked {
36 27
37 ngOnInit () { 28 ngOnInit () {
38 this.user = this.authService.getUser() 29 this.user = this.authService.getUser()
39
40 this.authService.userInformationLoaded.subscribe(
41 () => {
42 if (this.user.videoQuota !== -1) {
43 this.userVideoQuota = new BytesPipe().transform(this.user.videoQuota, 0).toString()
44 } else {
45 this.userVideoQuota = this.i18n('Unlimited')
46 }
47
48 if (this.user.videoQuotaDaily !== -1) {
49 this.userVideoQuotaDaily = new BytesPipe().transform(this.user.videoQuotaDaily, 0).toString()
50 } else {
51 this.userVideoQuotaDaily = this.i18n('Unlimited')
52 }
53 }
54 )
55
56 this.userService.getMyVideoQuotaUsed()
57 .subscribe(data => {
58 this.userVideoQuotaUsed = data.videoQuotaUsed
59 this.userVideoQuotaPercentage = this.userVideoQuotaUsed * 100 / this.user.videoQuota
60
61 this.userVideoQuotaUsedDaily = data.videoQuotaUsedDaily
62 this.userVideoQuotaDailyPercentage = this.userVideoQuotaUsedDaily * 100 / this.user.videoQuotaDaily
63 })
64 } 30 }
65 31
66 ngAfterViewChecked () { 32 ngAfterViewChecked () {
@@ -83,8 +49,4 @@ export class MyAccountSettingsComponent implements OnInit, AfterViewChecked {
83 err => this.notifier.error(err.message) 49 err => this.notifier.error(err.message)
84 ) 50 )
85 } 51 }
86
87 hasDailyQuota () {
88 return this.user.videoQuotaDaily !== -1
89 }
90} 52}