diff --git a/client/src/app/+my-account/my-account-history/my-account-history.component.html b/client/src/app/+my-account/my-account-history/my-account-history.component.html
index 4b94490a0..6e274f689 100644
--- a/client/src/app/+my-account/my-account-history/my-account-history.component.html
+++ b/client/src/app/+my-account/my-account-history/my-account-history.component.html
@@ -15,6 +15,8 @@
diff --git a/client/src/app/search/search.component.html b/client/src/app/search/search.component.html
index da2ace54d..0a9f78cb2 100644
--- a/client/src/app/search/search.component.html
+++ b/client/src/app/search/search.component.html
@@ -48,7 +48,10 @@
-
+
diff --git a/client/src/app/search/search.component.ts b/client/src/app/search/search.component.ts
index a3383ed8a..a7ddbe1f8 100644
--- a/client/src/app/search/search.component.ts
+++ b/client/src/app/search/search.component.ts
@@ -1,6 +1,6 @@
import { Component, OnDestroy, OnInit } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
-import { AuthService, Notifier, ServerService } from '@app/core'
+import { AuthService, Notifier } from '@app/core'
import { forkJoin, Subscription } from 'rxjs'
import { SearchService } from '@app/search/search.service'
import { ComponentPagination } from '@app/shared/rest/component-pagination.model'
@@ -138,6 +138,10 @@ export class SearchComponent implements OnInit, OnDestroy {
return this.advancedSearch.size()
}
+ removeVideoFromArray (video: Video) {
+ this.results = this.results.filter(r => !this.isVideo(r) || r.id !== video.id)
+ }
+
private resetPagination () {
this.pagination.currentPage = 1
this.pagination.totalItems = null
diff --git a/client/src/app/shared/buttons/action-dropdown.component.html b/client/src/app/shared/buttons/action-dropdown.component.html
index 6999474d6..cc244dc76 100644
--- a/client/src/app/shared/buttons/action-dropdown.component.html
+++ b/client/src/app/shared/buttons/action-dropdown.component.html
@@ -1,9 +1,11 @@
diff --git a/client/src/app/shared/buttons/action-dropdown.component.scss b/client/src/app/shared/buttons/action-dropdown.component.scss
index 985b2ca88..5073190b0 100644
--- a/client/src/app/shared/buttons/action-dropdown.component.scss
+++ b/client/src/app/shared/buttons/action-dropdown.component.scss
@@ -8,12 +8,19 @@
.action-button {
@include peertube-button;
- &.grey {
- @include grey-button;
- }
+ &.button-styled {
- &.orange {
- @include orange-button;
+ &.grey {
+ @include grey-button;
+ }
+
+ &.orange {
+ @include orange-button;
+ }
+
+ &:hover, &:active, &:focus {
+ background-color: $grey-background-color;
+ }
}
display: inline-block;
@@ -23,10 +30,6 @@
display: none;
}
- &:hover, &:active, &:focus {
- background-color: $grey-background-color;
- }
-
.more-icon {
width: 21px;
}
@@ -48,6 +51,10 @@
cursor: pointer;
color: #000 !important;
+ &.with-icon {
+ @include dropdown-with-icon-item;
+ }
+
a, span {
display: block;
width: 100%;
diff --git a/client/src/app/shared/buttons/action-dropdown.component.ts b/client/src/app/shared/buttons/action-dropdown.component.ts
index 275e2b51e..f5345831b 100644
--- a/client/src/app/shared/buttons/action-dropdown.component.ts
+++ b/client/src/app/shared/buttons/action-dropdown.component.ts
@@ -1,12 +1,18 @@
import { Component, Input } from '@angular/core'
+import { GlobalIconName } from '@app/shared/images/global-icon.component'
export type DropdownAction = {
label?: string
+ iconName?: GlobalIconName
handler?: (a: T) => any
linkBuilder?: (a: T) => (string | number)[]
isDisplayed?: (a: T) => boolean
}
+export type DropdownButtonSize = 'normal' | 'small'
+export type DropdownTheme = 'orange' | 'grey'
+export type DropdownDirection = 'horizontal' | 'vertical'
+
@Component({
selector: 'my-action-dropdown',
styleUrls: [ './action-dropdown.component.scss' ],
@@ -16,14 +22,29 @@ export type DropdownAction = {
export class ActionDropdownComponent {
@Input() actions: DropdownAction[] | DropdownAction[][] = []
@Input() entry: T
+
@Input() placement = 'bottom-left'
- @Input() buttonSize: 'normal' | 'small' = 'normal'
+
+ @Input() buttonSize: DropdownButtonSize = 'normal'
+ @Input() buttonDirection: DropdownDirection = 'horizontal'
+ @Input() buttonStyled = true
+
@Input() label: string
- @Input() theme: 'orange' | 'grey' = 'grey'
+ @Input() theme: DropdownTheme = 'grey'
getActions () {
if (this.actions.length !== 0 && Array.isArray(this.actions[0])) return this.actions
return [ this.actions ]
}
+
+ areActionsDisplayed (actions: DropdownAction[], entry: T) {
+ return actions.some(a => a.isDisplayed === undefined || a.isDisplayed(entry))
+ }
+
+ handleClick (event: Event, action: DropdownAction) {
+ event.preventDefault()
+
+ // action.handler(entry)
+ }
}
diff --git a/client/src/app/shared/misc/screen.service.ts b/client/src/app/shared/misc/screen.service.ts
index 1cbc96b14..db481204e 100644
--- a/client/src/app/shared/misc/screen.service.ts
+++ b/client/src/app/shared/misc/screen.service.ts
@@ -32,6 +32,8 @@ export class ScreenService {
}
private cacheWindowInnerWidthExpired () {
+ if (!this.lastFunctionCallTime) return true
+
return new Date().getTime() > (this.lastFunctionCallTime + this.cacheForMs)
}
}
diff --git a/client/src/app/shared/shared.module.ts b/client/src/app/shared/shared.module.ts
index 68225b457..ded65653f 100644
--- a/client/src/app/shared/shared.module.ts
+++ b/client/src/app/shared/shared.module.ts
@@ -80,6 +80,11 @@ import { NumberFormatterPipe } from '@app/shared/angular/number-formatter.pipe'
import { ObjectLengthPipe } from '@app/shared/angular/object-length.pipe'
import { FromNowPipe } from '@app/shared/angular/from-now.pipe'
import { PeerTubeTemplateDirective } from '@app/shared/angular/peertube-template.directive'
+import { VideoActionsDropdownComponent } from '@app/shared/video/video-actions-dropdown.component'
+import { VideoBlacklistComponent } from '@app/shared/video/modals/video-blacklist.component'
+import { VideoDownloadComponent } from '@app/shared/video/modals/video-download.component'
+import { VideoReportComponent } from '@app/shared/video/modals/video-report.component'
+import { ClipboardModule } from 'ngx-clipboard'
@NgModule({
imports: [
@@ -95,6 +100,8 @@ import { PeerTubeTemplateDirective } from '@app/shared/angular/peertube-template
NgbTabsetModule,
NgbTooltipModule,
+ ClipboardModule,
+
PrimeSharedModule,
InputMaskModule,
NgPipesModule
@@ -110,6 +117,11 @@ import { PeerTubeTemplateDirective } from '@app/shared/angular/peertube-template
VideoAddToPlaylistComponent,
VideoPlaylistElementMiniatureComponent,
VideosSelectionComponent,
+ VideoActionsDropdownComponent,
+
+ VideoDownloadComponent,
+ VideoReportComponent,
+ VideoBlacklistComponent,
FeedComponent,
@@ -158,6 +170,8 @@ import { PeerTubeTemplateDirective } from '@app/shared/angular/peertube-template
NgbTabsetModule,
NgbTooltipModule,
+ ClipboardModule,
+
PrimeSharedModule,
InputMaskModule,
BytesPipe,
@@ -172,6 +186,11 @@ import { PeerTubeTemplateDirective } from '@app/shared/angular/peertube-template
VideoAddToPlaylistComponent,
VideoPlaylistElementMiniatureComponent,
VideosSelectionComponent,
+ VideoActionsDropdownComponent,
+
+ VideoDownloadComponent,
+ VideoReportComponent,
+ VideoBlacklistComponent,
FeedComponent,
diff --git a/client/src/app/shared/video-playlist/video-add-to-playlist.component.html b/client/src/app/shared/video-playlist/video-add-to-playlist.component.html
index 19b326206..6029b3648 100644
--- a/client/src/app/shared/video-playlist/video-add-to-playlist.component.html
+++ b/client/src/app/shared/video-playlist/video-add-to-playlist.component.html
@@ -1,74 +1,76 @@
-