]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Display all miniature actions on hover and focus
authorRigel Kent <sendmemail@rigelk.eu>
Thu, 2 Jan 2020 14:45:27 +0000 (15:45 +0100)
committerRigel Kent <sendmemail@rigelk.eu>
Thu, 2 Jan 2020 15:26:18 +0000 (16:26 +0100)
client/src/app/shared/buttons/action-dropdown.component.scss
client/src/app/shared/video/video-miniature.component.html
client/src/app/shared/video/video-miniature.component.scss
client/src/app/shared/video/video-miniature.component.ts
client/src/app/shared/video/video-thumbnail.component.html
client/src/app/shared/video/video-thumbnail.component.scss
client/src/app/shared/video/video-thumbnail.component.ts

index 2f7e848d53bfbe819279b9add612e9ffe7986675..e33aa8d246bcd536fad7595bd4552bf425834491 100644 (file)
@@ -34,7 +34,7 @@
     width: 21px;
 
     ::ng-deep {
-      @include apply-svg-color(var(--mainForegroundColor));
+      @include apply-svg-color(var(--actionButtonColor));
     }
   }
 
index 23a7dbb1e50298d59bef75608b883219c96b0f35..c6fd570b74d0b8af7ec3a0f2233ed8159a8b68ab 100644 (file)
@@ -1,5 +1,5 @@
 <div class="video-miniature" [ngClass]="{ 'display-as-row': displayAsRow }" (mouseenter)="loadActions()">
-  <my-video-thumbnail [video]="video" [nsfw]="isVideoBlur"></my-video-thumbnail>
+  <my-video-thumbnail #thumbnail [video]="video" [nsfw]="isVideoBlur"></my-video-thumbnail>
 
   <div class="video-bottom">
     <div class="video-miniature-information">
index ac83c5dfa9a9a9581d69000ac985894fbfa6b43b..b63fd2989efcad94cdf57756c8ae6aaecac64e19 100644 (file)
@@ -74,10 +74,14 @@ $more-margin-right: 15px;
       ::ng-deep .playlist-dropdown.show + my-action-dropdown .dropdown-root {
         opacity: 1;
       }
-    }
 
-    &:hover .video-actions ::ng-deep .dropdown-root {
-      opacity: 1;
+      ::ng-deep .more-icon {
+        opacity: .6;
+
+        &:hover {
+          opacity: 1;
+        }
+      }
     }
 
     @media screen and (max-width: $small-view) {
@@ -96,6 +100,11 @@ $more-margin-right: 15px;
     }
   }
 
+  &:hover ::ng-deep .video-thumbnail .video-thumbnail-actions-overlay,
+  &:hover .video-bottom .video-actions ::ng-deep .dropdown-root {
+    opacity: 1;
+  }
+
   &.display-as-row {
     flex-direction: row;
     margin-bottom: 0;
index 9fffc7ddb5bdd75fcd109acb808e5a6bf32f38c7..ba65d33b694d951d00e40e7c49f1fe184d8de344 100644 (file)
@@ -1,4 +1,4 @@
-import { ChangeDetectionStrategy, Component, EventEmitter, Inject, Input, LOCALE_ID, OnInit, Output } from '@angular/core'
+import { ChangeDetectionStrategy, Component, EventEmitter, Inject, Input, LOCALE_ID, OnInit, Output, ViewChild } from '@angular/core'
 import { User } from '../users'
 import { Video } from './video.model'
 import { ServerService } from '@app/core'
@@ -6,6 +6,7 @@ import { ServerConfig, VideoPrivacy, VideoState } from '../../../../../shared'
 import { I18n } from '@ngx-translate/i18n-polyfill'
 import { VideoActionsDisplayType } from '@app/shared/video/video-actions-dropdown.component'
 import { ScreenService } from '@app/shared/misc/screen.service'
+import { VideoThumbnailComponent } from './video-thumbnail.component'
 
 export type OwnerDisplayType = 'account' | 'videoChannel' | 'auto'
 export type MiniatureDisplayOptions = {
@@ -46,6 +47,8 @@ export class VideoMiniatureComponent implements OnInit {
   @Output() videoUnblacklisted = new EventEmitter()
   @Output() videoRemoved = new EventEmitter()
 
+  @ViewChild('thumbnail', { static: true }) thumbnail: VideoThumbnailComponent
+
   videoActionsDisplayOptions: VideoActionsDisplayType = {
     playlist: true,
     download: false,
@@ -128,6 +131,7 @@ export class VideoMiniatureComponent implements OnInit {
 
   loadActions () {
     if (this.displayVideoActions) this.showActions = true
+    this.thumbnail.load()
   }
 
   onVideoBlacklisted () {
index df15698c0e5339fc53cbda1d4ded0ccf73a9042c..9679dfefb9e5d0921a7efd5774ee0e41d271452a 100644 (file)
@@ -1,7 +1,7 @@
 <a
   [routerLink]="getVideoRouterLink()" [queryParams]="queryParams" [attr.title]="video.name"
   class="video-thumbnail"
-  (mouseenter)="load()"
+  (mouseenter)="load()" (focus)="load()"
 >
   <img alt="" [attr.aria-labelledby]="video.name" [attr.src]="getImageUrl()" [ngClass]="{ 'blur-filter': nsfw }" />
 
index aac50fd1bd355db2fd960252fb5078e60dada9fa..ad221d6ed64a5c4ecf7641b7747578c0348b4af9 100644 (file)
@@ -35,6 +35,7 @@
     bottom: 5px;
   }
 
+  &:focus,
   &:hover {
     .video-thumbnail-actions-overlay {
       opacity: 1;
index 0f605e425d849b7dd82f6fd4d96c4f618ab727c4..6f9292d52fd00355dc4783d6580415e58e9bc372 100644 (file)
@@ -3,12 +3,7 @@ import { Video } from './video.model'
 import { ScreenService } from '@app/shared/misc/screen.service'
 import { AuthService, ThemeService } from '@app/core'
 import { VideoPlaylistService } from '../video-playlist/video-playlist.service'
-import { VideoPlaylistType } from '@shared/models'
-import { forkJoin } from 'rxjs'
-import { VideoPlaylistElement } from '@app/shared/video-playlist/video-playlist-element.model'
-import { VideoPlaylist } from '../video-playlist/video-playlist.model'
 import { VideoPlaylistElementCreate } from '../../../../../shared'
-import { VideoExistInPlaylist } from '@shared/models/videos/playlist/video-exist-in-playlist.model'
 
 @Component({
   selector: 'my-video-thumbnail',
@@ -36,6 +31,7 @@ export class VideoThumbnailComponent {
 
   load () {
     if (this.addedToWatchLater !== undefined) return
+    if (!this.isUserLoggedIn()) return
 
     this.videoPlaylistService.doesVideoExistInPlaylist(this.video.id)
       .subscribe(