]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix videos more dropdown position/loading
authorChocobozzz <me@florianbigard.com>
Fri, 26 Apr 2019 08:47:07 +0000 (10:47 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 13 May 2019 07:45:37 +0000 (09:45 +0200)
client/src/app/shared/video/video-actions-dropdown.component.ts
client/src/app/shared/video/video-miniature.component.scss
client/src/app/shared/video/video-miniature.component.ts

index 787ef118804f169f8576376091cb42fd99e64a26..b2d77a9e675fab722c507ef7c4b455c8b85465e0 100644 (file)
@@ -1,4 +1,4 @@
-import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core'
+import { AfterContentInit, AfterViewInit, Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild } from '@angular/core'
 import { I18n } from '@ngx-translate/i18n-polyfill'
 import { DropdownAction, DropdownButtonSize, DropdownDirection } from '@app/shared/buttons/action-dropdown.component'
 import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core'
@@ -28,7 +28,7 @@ export type VideoActionsDisplayType = {
   templateUrl: './video-actions-dropdown.component.html',
   styleUrls: [ './video-actions-dropdown.component.scss' ]
 })
-export class VideoActionsDropdownComponent implements OnChanges {
+export class VideoActionsDropdownComponent implements AfterViewInit, OnChanges {
   @ViewChild('playlistDropdown') playlistDropdown: NgbDropdown
   @ViewChild('playlistAdd') playlistAdd: VideoAddToPlaylistComponent
 
@@ -78,6 +78,13 @@ export class VideoActionsDropdownComponent implements OnChanges {
     return this.authService.getUser()
   }
 
+  ngAfterViewInit () {
+    // We rely on mouseenter to lazy load actions
+    if (this.screenService.isInTouchScreen()) {
+      this.loadDropdownInformation()
+    }
+  }
+
   ngOnChanges () {
     this.buildActions()
   }
index 6e173af997a66e4b5a66724e2c113d6f34c6389e..d665ce021ccb45b7536207990e3ff0203e1c7c95 100644 (file)
@@ -2,6 +2,9 @@
 @import '_mixins';
 @import '_miniature';
 
+$more-button-width: 41px;
+$more-margin-right: 10px;
+
 .video-miniature {
   width: $video-miniature-width;
   display: inline-flex;
@@ -14,7 +17,7 @@
     display: flex;
 
     .video-miniature-information {
-      width: 200px;
+      width: $video-miniature-width - $more-button-width - $more-margin-right;
       line-height: normal;
 
       .video-miniature-name {
@@ -61,7 +64,9 @@
 
     .video-actions {
       margin-top: 3px;
-      margin-right: 10px;
+      margin-right: $more-margin-right;
+      width: $more-button-width;
+      height: 30px;
 
       /deep/ .dropdown-root:not(.show) {
         opacity: 0;
@@ -86,7 +91,7 @@
         top: -3px;
 
         /deep/ .dropdown-root {
-          display: block !important;
+          opacity: 1 !important;
         }
       }
     }
index e32b8cbc585011d0581e7f5c11b5c543c34fa183..48475033cc180c1e0c05d37f04867f7e77addf96 100644 (file)
@@ -74,7 +74,7 @@ export class VideoMiniatureComponent implements OnInit {
 
     // We rely on mouseenter to lazy load actions
     if (this.screenService.isInTouchScreen()) {
-      this.showActions = true
+      this.loadActions()
     }
   }