More modern avatar upload, quota represented with progress bars
authorRigel Kent <sendmemail@rigelk.eu>
Fri, 13 Mar 2020 00:29:11 +0000 (01:29 +0100)
committerRigel Kent <sendmemail@rigelk.eu>
Fri, 13 Mar 2020 00:43:52 +0000 (01:43 +0100)
client/src/app/+my-account/my-account-settings/my-account-settings.component.html
client/src/app/+my-account/my-account-settings/my-account-settings.component.scss
client/src/app/+my-account/my-account-settings/my-account-settings.component.ts
client/src/app/+my-account/shared/actor-avatar-info.component.html
client/src/app/+my-account/shared/actor-avatar-info.component.scss
client/src/app/videos/+video-edit/video-add-components/video-upload.component.html
client/src/sass/bootstrap.scss
client/src/sass/include/_bootstrap.scss

index ddcde828c6d8d09910661cb0d72e45514164ea6e..6fee087fb675bfd1f48ff9f34ac56bdeb79b1aae 100644 (file)
@@ -8,13 +8,17 @@
 
     <div class="user-quota mb-3">
       <div>
-        <label i18n>Total video quota:</label>
-        <ng-container i18n>{{ userVideoQuotaUsed | bytes: 0 }} used</ng-container> / {{ userVideoQuota }}
+        <div class="progress" i18n-title title="Total video quota">
+          <div class="progress-bar" role="progressbar" [style]="{ width: userVideoQuotaPercentage + '%' }" [attr.aria-valuenow]="userVideoQuotaUsed" aria-valuemin="0" [attr.aria-valuemax]="userVideoQuota">{{ userVideoQuotaUsed | bytes: 0 }}</div>
+          <span class="ml-auto mr-2">{{ userVideoQuota }}</span>
+        </div>
       </div>
 
-      <div *ngIf="hasDailyQuota()">
-        <label i18n>Daily video quota:</label>
-        <ng-container>{{ userVideoQuotaUsedDaily | bytes: 0 }} used</ng-container> / {{ userVideoQuotaDaily }}
+      <div *ngIf="hasDailyQuota()" class="mt-3">
+        <div class="progress" i18n-title title="Daily video quota">
+          <div class="progress-bar progress-bar-secondary" role="progressbar" [style]="{ width: userVideoQuotaDailyPercentage + '%' }" [attr.aria-valuenow]="userVideoQuotaUsedDaily" aria-valuemin="0" [attr.aria-valuemax]="userVideoQuotaDaily">{{ userVideoQuotaUsedDaily | bytes: 0 }}</div>
+          <span class="ml-auto mr-2">{{ userVideoQuotaDaily }}</span>
+        </div>
       </div>
     </div>
 
index 7eb60c7fbbd0a88182c1bb284e3839b18608685b..2b90cc8cf2a2e49cbb478ff3ac748a6d69f99100 100644 (file)
@@ -13,3 +13,7 @@
 .account-title {
   @include settings-big-title;
 }
+
+.progress {
+  width: 500px;
+}
index ada98401c754af9b82a9a7746d26bcfcf1ba3a52..5f2db985487dc873f0aff6fb824d6a909d708542 100644 (file)
@@ -17,9 +17,11 @@ export class MyAccountSettingsComponent implements OnInit, AfterViewChecked {
 
   userVideoQuota = '0'
   userVideoQuotaUsed = 0
+  userVideoQuotaPercentage = 15
 
   userVideoQuotaDaily = '0'
   userVideoQuotaUsedDaily = 0
+  userVideoQuotaDailyPercentage = 15
 
   constructor (
     private viewportScroller: ViewportScroller,
@@ -40,12 +42,14 @@ export class MyAccountSettingsComponent implements OnInit, AfterViewChecked {
       () => {
         if (this.user.videoQuota !== -1) {
           this.userVideoQuota = new BytesPipe().transform(this.user.videoQuota, 0).toString()
+          this.userVideoQuotaPercentage = this.user.videoQuota * 100 / this.userVideoQuotaUsed
         } else {
           this.userVideoQuota = this.i18n('Unlimited')
         }
 
         if (this.user.videoQuotaDaily !== -1) {
           this.userVideoQuotaDaily = new BytesPipe().transform(this.user.videoQuotaDaily, 0).toString()
+          this.userVideoQuotaDailyPercentage = this.user.videoQuotaDaily * 100 / this.userVideoQuotaUsedDaily
         } else {
           this.userVideoQuotaDaily = this.i18n('Unlimited')
         }
index 8bdff2f5a80890b57bb0fdef778556021df72dab..b992d0ebd3b1abba730ad81ec1ed1f7532898159 100644 (file)
@@ -2,6 +2,13 @@
   <div class="actor">
     <img [src]="actor.avatarUrl" alt="Avatar" />
 
+    <div class="actor-img-edit-container">
+      <div class="actor-img-edit-button" [ngbTooltip]="'(extensions: '+ avatarExtensions +', max size: 100KB)'" placement="right" container="body">
+        <my-global-icon iconName="edit"></my-global-icon>
+        <input #avatarfileInput type="file" name="avatarfile" id="avatarfile" [accept]="avatarExtensions" (change)="onAvatarChange()"/>
+      </div>
+    </div>
+
     <div class="actor-info">
       <div class="actor-info-names">
         <div class="actor-info-display-name">{{ actor.displayName }}</div>
       <div i18n class="actor-info-followers">{{ actor.followersCount }} subscribers</div>
     </div>
   </div>
-
-  <div class="button-file">
-    <span i18n>Change the avatar</span>
-    <input #avatarfileInput type="file" name="avatarfile" id="avatarfile" [accept]="avatarExtensions" (change)="onAvatarChange()" />
-  </div>
-  <div i18n class="file-max-size">(extensions: {{ avatarExtensions }}, max size: {{ maxAvatarSize | bytes }})</div>
 </ng-container>
\ No newline at end of file
index 86f8108b96b5d05b2d10f886597959d8dc4feece..5a66ecfd2246f44e6a56bbb212197601ba388bbf 100644 (file)
@@ -5,12 +5,42 @@
   display: flex;
 
   img {
-    @include avatar(50px);
+    @include avatar(100px);
 
     margin-right: 15px;
   }
 
+  .actor-img-edit-container {
+    position: relative;
+    width: 0;
+
+    .actor-img-edit-button {
+      @include peertube-button-file(21px);
+      @include button-with-icon(19px);
+    
+      margin-top: 10px;
+      margin-bottom: 5px;
+      border-radius: 50%;
+      top: 55px;
+      right: 45px;
+      cursor: pointer;
+
+      input {
+        width: 30px;
+        height: 30px;
+      }
+
+      my-global-icon {
+        right: 7px;
+      }
+    }
+  }
+
   .actor-info {
+    justify-content: center;
+    display: inline-flex;
+    flex-direction: column;
+
     .actor-info-names {
       display: flex;
       align-items: center;
 
     .actor-info-followers {
       font-size: 15px;
+      padding-bottom: .5rem;
     }
   }
 }
-
-.button-file {
-  @include peertube-button-file(160px);
-
-  margin-top: 10px;
-  margin-bottom: 5px;
-}
-
-.file-max-size {
-  display: inline-block;
-  font-size: 13px;
-
-  position: relative;
-  top: -10px;
-}
index 0f904affbb8cde071cf2d91ce3c85c5685464a6d..bdbc2a2cbf0ec048d6c720017eac0ade9249aee4 100644 (file)
@@ -68,7 +68,7 @@
 </div>
 
 <!-- Hidden because we want to load the component -->
-<form [hidden]="!isUploadingVideo" novalidate [formGroup]="form">
+<form [hidden]="!isUploadingVideo" novalidate [formGroup]="form" class="mb-3">
   <my-video-edit
     [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions"
     [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels"
index 5c1ce1028b6515214f39e8d1e0aece4108c1a25b..6c42acaff5afadde8ba60e99de46987d64b48751 100644 (file)
@@ -236,3 +236,10 @@ ngb-tooltip-window {
     background-color: var(--secondaryColor);
   }
 }
+
+.progress-bar {
+  background-color: var(--mainColor);
+}
+.progress-bar-secondary {
+  background-color: var(--secondaryColor);
+}
index b1a23be6bcad130aeb39a2aaf48235727bfe2453..61bb4739de61be1895541fd38abbd9b14c07c889 100644 (file)
@@ -26,7 +26,7 @@
 @import '~bootstrap/scss/badge';
 //@import '~bootstrap/scss/jumbotron';
 @import '~bootstrap/scss/alert';
-//@import '~bootstrap/scss/progress';
+@import '~bootstrap/scss/progress';
 //@import '~bootstrap/scss/media';
 //@import '~bootstrap/scss/list-group';
 @import '~bootstrap/scss/close';