Replace p-progressbar and bootstrap progressbar with pure CSS alt
authorRigel Kent <sendmemail@rigelk.eu>
Fri, 13 Mar 2020 19:38:50 +0000 (20:38 +0100)
committerRigel Kent <sendmemail@rigelk.eu>
Fri, 13 Mar 2020 19:38:50 +0000 (20:38 +0100)
14 files changed:
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-video-settings/my-account-video-settings.component.scss
client/src/app/+my-account/shared/actor-avatar-info.component.html
client/src/app/+my-account/shared/actor-avatar-info.component.ts
client/src/app/videos/+video-edit/video-add-components/video-send.scss
client/src/app/videos/+video-edit/video-add-components/video-upload.component.html
client/src/app/videos/+video-edit/video-add-components/video-upload.component.scss
client/src/app/videos/+video-edit/video-add.module.ts
client/src/sass/application.scss
client/src/sass/bootstrap.scss
client/src/sass/include/_bootstrap.scss
client/src/sass/include/_mixins.scss
client/src/sass/primeng-custom.scss

index 6fee087fb675bfd1f48ff9f34ac56bdeb79b1aae..f1c4665456d82163876321fca5151871cc394700 100644 (file)
@@ -16,7 +16,7 @@
 
       <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>
+          <div class="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>
index e1a00fb8b725f3282c7ef53ca4544c99d674a6df..2660c2b728b102fa26df02af600654b96b163d85 100644 (file)
@@ -15,6 +15,7 @@
 }
 
 .progress {
+  @include progressbar;
   width: 500px;
   max-width: 100%;
 }
index a5a4357269932401b818bf3324ed9c84272ab6ed..2050950be0d1d5b90293a83f11dc145d17bf3016 100644 (file)
@@ -3,7 +3,7 @@
     <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">
+      <div class="actor-img-edit-button" [ngbTooltip]="'(extensions: '+ avatarExtensions +', '+ maxSizeText +': '+ maxAvatarSizeInBytes +')'" placement="right" container="body">
         <my-global-icon iconName="edit"></my-global-icon>
         <input #avatarfileInput type="file" title=" " name="avatarfile" id="avatarfile" [accept]="avatarExtensions" (change)="onAvatarChange()"/>
       </div>
index eb198587d5f0186294aaa346d4c79974b8191d2d..8e4a7a602654809b0d040ee339bb6cbeaf99fbfd 100644 (file)
@@ -4,6 +4,8 @@ import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
 import { Account } from '@app/shared/account/account.model'
 import { Notifier } from '@app/core'
 import { ServerConfig } from '@shared/models'
+import { BytesPipe } from 'ngx-pipes'
+import { I18n } from '@ngx-translate/i18n-polyfill'
 
 @Component({
   selector: 'my-actor-avatar-info',
@@ -17,12 +19,19 @@ export class ActorAvatarInfoComponent implements OnInit {
 
   @Output() avatarChange = new EventEmitter<FormData>()
 
+  maxSizeText: string
+
   private serverConfig: ServerConfig
+  private bytesPipe: BytesPipe
 
   constructor (
     private serverService: ServerService,
-    private notifier: Notifier
-  ) {}
+    private notifier: Notifier,
+    private i18n: I18n
+  ) {
+    this.bytesPipe = new BytesPipe()
+    this.maxSizeText = this.i18n('max size')
+  }
 
   ngOnInit (): void {
     this.serverConfig = this.serverService.getTmpConfig()
@@ -47,6 +56,10 @@ export class ActorAvatarInfoComponent implements OnInit {
     return this.serverConfig.avatar.file.size.max
   }
 
+  get maxAvatarSizeInBytes () {
+    return this.bytesPipe.transform(this.maxAvatarSize)
+  }
+
   get avatarExtensions () {
     return this.serverConfig.avatar.file.extensions.join(', ')
   }
index 8769dd3020e3c835338a2c95ed3ca050a70082af..1979d0061d7fbc783db61211f9ab65082d142767 100644 (file)
@@ -41,9 +41,7 @@ $width-size: 190px;
   }
 
   .button-file {
-    @include peertube-button-file(auto);
-
-    min-width: 190px;
+    @include peertube-button-file(max-content);
   }
 
   .button-file-extension {
index bdbc2a2cbf0ec048d6c720017eac0ade9249aee4..3cb57e37519ec7a36d032f71422c59fa47e4e4fe 100644 (file)
 </div>
 
 <div *ngIf="isUploadingVideo && !error" class="upload-progress-cancel">
-  <p-progressBar
-    [value]="videoUploadPercents"
-    [ngClass]="{ processing: videoUploadPercents === 100 && videoUploaded === false }"
-  ></p-progressBar>
+  <div class="progress" i18n-title title="Total video quota">
+    <div class="progress-bar" role="progressbar" [style]="{ width: videoUploadPercents + '%' }" [attr.aria-valuenow]="videoUploadPercents" aria-valuemin="0" [attr.aria-valuemax]="100">
+      <span *ngIf="videoUploadPercents === 100 && videoUploaded === false" i18n>Processing…</span>
+      <span *ngIf="videoUploadPercents !== 100 || videoUploaded">{{ videoUploadPercents }}%</span>
+    </div>
+  </div>
   <input *ngIf="videoUploaded === false" type="button" value="Cancel" (click)="cancelUpload()" />
 </div>
 
index b5628e276b0c7d64415f7b557160e4fcccccab5e..95baa3d0a68cb75c61fbcf1367979a86debef0af 100644 (file)
   margin-top: 25px;
   margin-bottom: 40px;
 
-  p-progressBar {
+  .progress {
+    @include progressbar;
     flex-grow: 1;
-
-    ::ng-deep .ui-progressbar {
-      font-size: 15px !important;
-      height: 30px !important;
-      border-radius: 3px !important;
-      background-color: rgba(11, 204, 41, 0.16) !important;
-
-      .ui-progressbar-value {
-        background-color: #0BCC29 !important;
-      }
-
-      .ui-progressbar-label {
-        text-align: left;
-        padding-left: 18px;
-        margin-top: 0 !important;
-        color: #fff !important;
-        line-height: 30px !important;
-      }
-    }
-
-    &.processing {
-      ::ng-deep .ui-progressbar-label {
-        // Same color as background to hide "100%"
-        color: rgba(11, 204, 41, 0.16) !important;
-
-        &::before {
-          content: 'Processing...';
-          color: #fff;
-        }
+    height: 30px;
+    font-size: 15px;
+    background-color: rgba(11, 204, 41, 0.16);
+
+    .progress-bar {
+      background-color: $green;
+      line-height: 30px;
+      text-align: left;
+      font-weight: $font-bold;
+
+      span {
+        margin-left: 18px;
       }
     }
   }
index 870f7cb97cb74f30e15eac8a6d2bd45da62190be..4386f10b6675579bea2b2b3405833e9370f42573 100644 (file)
@@ -7,14 +7,12 @@ import { CanDeactivateGuard } from '../../shared/guards/can-deactivate-guard.ser
 import { VideoUploadComponent } from '@app/videos/+video-edit/video-add-components/video-upload.component'
 import { VideoImportUrlComponent } from '@app/videos/+video-edit/video-add-components/video-import-url.component'
 import { VideoImportTorrentComponent } from '@app/videos/+video-edit/video-add-components/video-import-torrent.component'
-import { ProgressBarModule } from 'primeng/progressbar'
 
 @NgModule({
   imports: [
     VideoAddRoutingModule,
     VideoEditModule,
     SharedModule,
-    ProgressBarModule
   ],
   declarations: [
     VideoAddComponent,
index 413f8c49dceb794b7e5b47fcb8b8382a6b7fd5ff..089a58009e82ece00059f11285e92b9b09ca2e16 100644 (file)
@@ -181,6 +181,7 @@ label {
 
 .title-page-about,
 .title-page-settings {
+  white-space: nowrap;
   font-size: 115%;
   font-weight: $font-regular;
 
index 6c42acaff5afadde8ba60e99de46987d64b48751..5c1ce1028b6515214f39e8d1e0aece4108c1a25b 100644 (file)
@@ -236,10 +236,3 @@ ngb-tooltip-window {
     background-color: var(--secondaryColor);
   }
 }
-
-.progress-bar {
-  background-color: var(--mainColor);
-}
-.progress-bar-secondary {
-  background-color: var(--secondaryColor);
-}
index 61bb4739de61be1895541fd38abbd9b14c07c889..b1a23be6bcad130aeb39a2aaf48235727bfe2453 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';
index 5163ea0564cd0caa6e8065dd79175550a25ac27e..e8dfb79bc2ec427c83ab64822ff36dc85e441db9 100644 (file)
   overflow: hidden;
   display: inline-block;
   width: $width;
+  min-height: 30px;
 
   @include peertube-button;
   @include orange-button;
     position: absolute;
     top: 0;
     right: 0;
-    min-width: 100%;
-    min-height: 100%;
+    width: 100%;
+    height: 100%;
     font-size: 100px;
     text-align: right;
     filter: alpha(opacity=0);
     top: -2px;
   }
 }
+
+@mixin progressbar {
+  background-color: $grey-background-color;
+  display: flex;
+  height: 1rem;
+  overflow: hidden;
+  font-size: 0.75rem;
+  border-radius: 0.25rem;
+
+  .progress-bar {
+    color: var(--mainBackgroundColor);
+    background-color: var(--mainColor);
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+    text-align: center;
+    white-space: nowrap;
+    transition: width 0.6s ease;
+
+    &.secondary {
+      background-color: var(--secondaryColor);
+    }
+  }
+}
index fbba2ad5ce99f7575a62b2d7a07668861103fe2b..0a3634c946639ac02ff62edba4ccd6a75f679aee 100644 (file)
@@ -416,9 +416,9 @@ p-toast {
   .ui-toast-close-icon {
     font-family: "Glyphicons Halflings";
 
-    opacity: .5;
+    opacity: .3;
     &:hover {
-      opacity: .8;
+      opacity: .5;
     }
 
     &:after {