aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-12-04 13:19:55 +0100
committerChocobozzz <me@florianbigard.com>2019-12-04 13:20:02 +0100
commit66fd15160e633d98fd7933ffe4abb6c55fcd1755 (patch)
tree43215742a9404a39039b18cca7debdac3a933a71 /client/src/app
parentc883db6d038a8510205f5f13ef46fb5a1c9e8288 (diff)
downloadPeerTube-66fd15160e633d98fd7933ffe4abb6c55fcd1755.tar.gz
PeerTube-66fd15160e633d98fd7933ffe4abb6c55fcd1755.tar.zst
PeerTube-66fd15160e633d98fd7933ffe4abb6c55fcd1755.zip
Clearer video quota label in user settings
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-settings.component.html10
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-settings.component.scss1
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-settings.component.ts19
3 files changed, 28 insertions, 2 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 eb9367d1f..9f187b574 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
@@ -1,7 +1,15 @@
1<my-actor-avatar-info [actor]="user.account" (avatarChange)="onAvatarChange($event)"></my-actor-avatar-info> 1<my-actor-avatar-info [actor]="user.account" (avatarChange)="onAvatarChange($event)"></my-actor-avatar-info>
2 2
3<div class="user-quota"> 3<div class="user-quota">
4 <span i18n class="user-quota-label">Video quota:</span> {{ userVideoQuotaUsed | bytes: 0 }} / {{ userVideoQuota }} 4 <div>
5 <span i18n class="user-quota-label">Total video quota:</span>
6 <ng-container i18n>{{ userVideoQuotaUsed | bytes: 0 }} used</ng-container> / {{ userVideoQuota }}
7 </div>
8
9 <div *ngIf="hasDailyQuota()">
10 <span i18n class="user-quota-label">Daily video quota:</span>
11 <ng-container>{{ userVideoQuotaUsedDaily | bytes: 0 }} used</ng-container> / {{ userVideoQuotaDaily }}
12 </div>
5</div> 13</div>
6 14
7<div i18n class="account-title">Profile</div> 15<div i18n class="account-title">Profile</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 16f26dfed..d0395aca9 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
@@ -6,6 +6,7 @@
6 margin-top: 20px; 6 margin-top: 20px;
7 7
8 .user-quota-label { 8 .user-quota-label {
9 margin-right: 5px;
9 font-weight: $font-semibold; 10 font-weight: $font-semibold;
10 } 11 }
11} 12}
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 95fd2a3db..e314cdbea 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
@@ -13,9 +13,13 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
13}) 13})
14export class MyAccountSettingsComponent implements OnInit { 14export class MyAccountSettingsComponent implements OnInit {
15 user: User = null 15 user: User = null
16
16 userVideoQuota = '0' 17 userVideoQuota = '0'
17 userVideoQuotaUsed = 0 18 userVideoQuotaUsed = 0
18 19
20 userVideoQuotaDaily = '0'
21 userVideoQuotaUsedDaily = 0
22
19 constructor ( 23 constructor (
20 private userService: UserService, 24 private userService: UserService,
21 private authService: AuthService, 25 private authService: AuthService,
@@ -37,11 +41,20 @@ export class MyAccountSettingsComponent implements OnInit {
37 } else { 41 } else {
38 this.userVideoQuota = this.i18n('Unlimited') 42 this.userVideoQuota = this.i18n('Unlimited')
39 } 43 }
44
45 if (this.user.videoQuotaDaily !== -1) {
46 this.userVideoQuotaDaily = new BytesPipe().transform(this.user.videoQuotaDaily, 0).toString()
47 } else {
48 this.userVideoQuotaDaily = this.i18n('Unlimited')
49 }
40 } 50 }
41 ) 51 )
42 52
43 this.userService.getMyVideoQuotaUsed() 53 this.userService.getMyVideoQuotaUsed()
44 .subscribe(data => this.userVideoQuotaUsed = data.videoQuotaUsed) 54 .subscribe(data => {
55 this.userVideoQuotaUsed = data.videoQuotaUsed
56 this.userVideoQuotaUsedDaily = data.videoQuotaUsedDaily
57 })
45 } 58 }
46 59
47 onAvatarChange (formData: FormData) { 60 onAvatarChange (formData: FormData) {
@@ -56,4 +69,8 @@ export class MyAccountSettingsComponent implements OnInit {
56 err => this.notifier.error(err.message) 69 err => this.notifier.error(err.message)
57 ) 70 )
58 } 71 }
72
73 hasDailyQuota () {
74 return this.user.videoQuotaDaily !== -1
75 }
59} 76}