ActivityPub-federated video streaming platform using P2P directly in your web browser
Add buttons in playlist page
Chocobozzz82f443de1aba
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.html b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.htmlindex 2bfdf5c436..09b4c8a1ba 100644--- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.html+++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.html@@ -5,10 +5,33 @@*ngIf="playlist" [playlist]="playlist" [toManage]="false" [displayChannel]="true"[displayDescription]="true" [displayPrivacy]="true"></my-video-playlist-miniature>++ <div class="playlist-buttons">+ <button (click)="showShareModal()" class="action-button share-button">+ <my-global-icon iconName="share" aria-hidden="true"></my-global-icon>+ <span class="icon-text" i18n>Share</span>+ </button>++ <my-action-dropdown+ *ngIf="isRegularPlaylist(playlist)"+ [entry]="playlist" [actions]="playlistActions" label="More"+ ></my-action-dropdown>+ </div>+</div><div class="playlist-elements col-xs-12 col-md-7 col-xl-9">- <div i18n class="no-results" *ngIf="pagination.totalItems === 0">No videos in this playlist.</div>+ <div class="no-results" *ngIf="pagination.totalItems === 0">+ <div i18n>No videos in this playlist.</div>++ <div i18n>+ Browse videos on PeerTube to add them in your playlist.+ </div>++ <div i18n>+ See the <a target="_blank" href="https://docs.joinpeertube.org/#/use-library?id=playlist">documentation</a> for more information.+ </div>+ </div><divclass="videos" myInfiniteScroller [autoInit]="true" (nearOfBottom)="onNearOfBottom()"@@ -24,3 +47,5 @@</div></div></div>++<my-video-share #videoShareModal [playlist]="playlist"></my-video-share>diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.scss b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.scssindex 4531e475a1..3e9b57c355 100644--- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.scss+++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.scss@@ -10,7 +10,9 @@padding: 10px;display: flex;+ flex-direction: column;justify-content: center;+ align-items: center;/* fix ellipsis dots background color */::ng-deep .miniature-name::after {@@ -18,6 +20,20 @@}}+.playlist-buttons {+ display:flex;+ margin: 30px 0 10px 0;++ .share-button {+ @include peertube-button;+ @include button-with-icon(17px, 3px, -1px);+ @include grey-button;+ @include apply-svg-color(pvar(--actionButtonColor));++ margin-right: 10px;+ }+}+// Thanks Angular CDK <3 https://material.angular.io/cdk/drag-drop/examples.cdk-drag-preview {box-sizing: border-box;diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.tsindex 0add81c38c..e278d9ed2f 100644--- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts+++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts@@ -1,9 +1,13 @@import { Subject, Subscription } from 'rxjs'import { CdkDragDrop } from '@angular/cdk/drag-drop'-import { Component, OnDestroy, OnInit } from '@angular/core'-import { ActivatedRoute } from '@angular/router'-import { ComponentPagination, Notifier, ScreenService } from '@app/core'+import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'+import { ActivatedRoute, Router } from '@angular/router'+import { ComponentPagination, ConfirmService, Notifier, ScreenService } from '@app/core'+import { DropdownAction } from '@app/shared/shared-main'+import { VideoShareComponent } from '@app/shared/shared-share-modal'import { VideoPlaylist, VideoPlaylistElement, VideoPlaylistService } from '@app/shared/shared-video-playlist'+import { I18n } from '@ngx-translate/i18n-polyfill'+import { VideoPlaylistType } from '@shared/models'@Component({selector: 'my-account-video-playlist-elements',@@ -11,9 +15,13 @@ import { VideoPlaylist, VideoPlaylistElement, VideoPlaylistService } from '@app/styleUrls: [ './my-account-video-playlist-elements.component.scss' ]})export class MyAccountVideoPlaylistElementsComponent implements OnInit, OnDestroy {+ @ViewChild('videoShareModal') videoShareModal: VideoShareComponent+playlistElements: VideoPlaylistElement[] = []playlist: VideoPlaylist+ playlistActions: DropdownAction<VideoPlaylist>[][] = []+pagination: ComponentPagination = {currentPage: 1,itemsPerPage: 10,@@ -27,12 +35,30 @@ export class MyAccountVideoPlaylistElementsComponent implements OnInit, OnDestroconstructor (private notifier: Notifier,+ private i18n: I18n,+ private router: Router,+ private confirmService: ConfirmService,private route: ActivatedRoute,private screenService: ScreenService,private videoPlaylistService: VideoPlaylistService) {}ngOnInit () {+ this.playlistActions = [+ [+ {+ label: this.i18n('Update playlist'),+ iconName: 'edit',+ linkBuilder: playlist => [ '/my-account', 'video-playlists', 'update', playlist.uuid ]+ },+ {+ label: this.i18n('Delete playlist'),+ iconName: 'delete',+ handler: playlist => this.deleteVideoPlaylist(playlist)+ }+ ]+ ]+this.paramsSub = this.route.params.subscribe(routeParams => {this.videoPlaylistId = routeParams[ 'videoPlaylistId' ]this.loadElements()@@ -90,6 +116,38 @@ export class MyAccountVideoPlaylistElementsComponent implements OnInit, OnDestroreturn elem.id}+ isRegularPlaylist (playlist: VideoPlaylist) {+ return playlist?.type.id === VideoPlaylistType.REGULAR+ }++ showShareModal () {+ this.videoShareModal.show()+ }++ async deleteVideoPlaylist (videoPlaylist: VideoPlaylist) {+ const res = await this.confirmService.confirm(+ this.i18n(+ 'Do you really want to delete {{playlistDisplayName}}?',+ { playlistDisplayName: videoPlaylist.displayName }+ ),+ this.i18n('Delete')+ )+ if (res === false) return++ this.videoPlaylistService.removeVideoPlaylist(videoPlaylist)+ .subscribe(+ () => {+ this.router.navigate([ '/my-account', 'video-playlists' ])++ this.notifier.success(+ this.i18n('Playlist {{playlistDisplayName}} deleted.', { playlistDisplayName: videoPlaylist.displayName })+ )+ },++ error => this.notifier.error(error.message)+ )+ }+/*** Returns null to not have drag and drop delay.* In small views, where elements are about 100% wide,diff --git a/client/src/app/+my-account/my-account.module.ts b/client/src/app/+my-account/my-account.module.tsindex bf5a4fc8a2..5f7ed4d2fc 100644--- a/client/src/app/+my-account/my-account.module.ts+++ b/client/src/app/+my-account/my-account.module.ts@@ -8,6 +8,7 @@ import { SharedFormModule } from '@app/shared/shared-forms'import { SharedGlobalIconModule } from '@app/shared/shared-icons'import { SharedMainModule } from '@app/shared/shared-main'import { SharedModerationModule } from '@app/shared/shared-moderation'+import { SharedShareModal } from '@app/shared/shared-share-modal'import { SharedUserInterfaceSettingsModule } from '@app/shared/shared-user-settings'import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscription/shared-user-subscription.module'import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature'@@ -53,7 +54,8 @@ import { MyAccountComponent } from './my-account.component'SharedVideoPlaylistModule,SharedUserInterfaceSettingsModule,SharedGlobalIconModule,- SharedAbuseListModule+ SharedAbuseListModule,+ SharedShareModal],declarations: [diff --git a/client/src/app/+videos/+video-watch/video-watch.component.html b/client/src/app/+videos/+video-watch/video-watch.component.htmlindex 2588b9af57..4279437d23 100644--- a/client/src/app/+videos/+video-watch/video-watch.component.html+++ b/client/src/app/+videos/+video-watch/video-watch.component.html@@ -116,9 +116,10 @@<my-global-icon iconName="download" aria-hidden="true"></my-global-icon><span class="icon-text d-none d-sm-inline" i18n>DOWNLOAD</span></button>-+<my-video-download #videoDownloadModal></my-video-download></ng-container>+<ng-container *ngIf="isUserLoggedIn()"><my-video-actions-dropdownplacement="bottom auto" buttonDirection="horizontal" [buttonStyled]="true" [video]="video" [videoCaptions]="videoCaptions"diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.tsindex 33f9982826..a53af210a9 100644--- a/client/src/app/+videos/+video-watch/video-watch.component.ts+++ b/client/src/app/+videos/+video-watch/video-watch.component.ts@@ -8,12 +8,14 @@ import { AuthService, AuthUser, ConfirmService, MarkdownService, Notifier, RestEimport { HooksService } from '@app/core/plugins/hooks.service'import { RedirectService } from '@app/core/routing/redirect.service'import { isXPercentInViewport, scrollToTop } from '@app/helpers'-import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'import { Video, VideoCaptionService, VideoDetails, VideoService } from '@app/shared/shared-main'+import { VideoShareComponent } from '@app/shared/shared-share-modal'import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription'+import { VideoDownloadComponent } from '@app/shared/shared-video-miniature'import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist'import { MetaService } from '@ngx-meta/core'import { I18n } from '@ngx-translate/i18n-polyfill'+import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '@shared/models'import { getStoredP2PEnabled, getStoredTheater } from '../../../assets/player/peertube-player-local-storage'import {@@ -26,10 +28,8 @@ import {} from '../../../assets/player/peertube-player-manager'import { isWebRTCDisabled, timeToInt } from '../../../assets/player/utils'import { environment } from '../../../environments/environment'-import { VideoShareComponent } from './modal/video-share.component'import { VideoSupportComponent } from './modal/video-support.component'import { VideoWatchPlaylistComponent } from './video-watch-playlist.component'-import { VideoDownloadComponent } from '@app/shared/shared-video-miniature'@Component({selector: 'my-video-watch',diff --git a/client/src/app/+videos/+video-watch/video-watch.module.ts b/client/src/app/+videos/+video-watch/video-watch.module.tsindex 5821dc2b73..612bbccc44 100644--- a/client/src/app/+videos/+video-watch/video-watch.module.ts+++ b/client/src/app/+videos/+video-watch/video-watch.module.ts@@ -1,19 +1,17 @@-import { QRCodeModule } from 'angularx-qrcode'import { NgModule } from '@angular/core'import { SharedFormModule } from '@app/shared/shared-forms'import { SharedGlobalIconModule } from '@app/shared/shared-icons'import { SharedMainModule } from '@app/shared/shared-main'import { SharedModerationModule } from '@app/shared/shared-moderation'+import { SharedShareModal } from '@app/shared/shared-share-modal'import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscription'import { SharedVideoCommentModule } from '@app/shared/shared-video-comment'import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature'import { SharedVideoPlaylistModule } from '@app/shared/shared-video-playlist'-import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'import { VideoCommentService } from '../../shared/shared-video-comment/video-comment.service'import { VideoCommentAddComponent } from './comment/video-comment-add.component'import { VideoCommentComponent } from './comment/video-comment.component'import { VideoCommentsComponent } from './comment/video-comments.component'-import { VideoShareComponent } from './modal/video-share.component'import { VideoSupportComponent } from './modal/video-support.component'import { RecommendationsModule } from './recommendations/recommendations.module'import { TimestampRouteTransformerDirective } from './timestamp-route-transformer.directive'@@ -25,8 +23,6 @@ import { VideoWatchComponent } from './video-watch.component'@NgModule({imports: [VideoWatchRoutingModule,- NgbTooltipModule,- QRCodeModule,RecommendationsModule,SharedMainModule,@@ -36,14 +32,14 @@ import { VideoWatchComponent } from './video-watch.component'SharedUserSubscriptionModule,SharedModerationModule,SharedGlobalIconModule,- SharedVideoCommentModule+ SharedVideoCommentModule,+ SharedShareModal],declarations: [VideoWatchComponent,VideoWatchPlaylistComponent,- VideoShareComponent,VideoSupportComponent,VideoCommentsComponent,VideoCommentAddComponent,diff --git a/client/src/app/shared/shared-share-modal/index.ts b/client/src/app/shared/shared-share-modal/index.tsnew file mode 100644index 0000000000..e13c08acc9--- /dev/null+++ b/client/src/app/shared/shared-share-modal/index.ts@@ -0,0 +1,3 @@+export * from './video-share.component'++export * from './shared-share-modal.module'diff --git a/client/src/app/shared/shared-share-modal/shared-share-modal.module.ts b/client/src/app/shared/shared-share-modal/shared-share-modal.module.tsnew file mode 100644index 0000000000..e269eecac2--- /dev/null+++ b/client/src/app/shared/shared-share-modal/shared-share-modal.module.ts@@ -0,0 +1,27 @@+import { QRCodeModule } from 'angularx-qrcode'+import { NgModule } from '@angular/core'+import { SharedFormModule } from '../shared-forms'+import { SharedGlobalIconModule } from '../shared-icons'+import { SharedMainModule } from '../shared-main/shared-main.module'+import { VideoShareComponent } from './video-share.component'++@NgModule({+ imports: [+ QRCodeModule,++ SharedMainModule,+ SharedFormModule,+ SharedGlobalIconModule+ ],++ declarations: [+ VideoShareComponent+ ],++ exports: [+ VideoShareComponent+ ],++ providers: [ ]+})+export class SharedShareModal { }diff --git a/client/src/app/+videos/+video-watch/modal/video-share.component.html b/client/src/app/shared/shared-share-modal/video-share.component.htmlsimilarity index 96%rename from client/src/app/+videos/+video-watch/modal/video-share.component.htmlrename to client/src/app/shared/shared-share-modal/video-share.component.htmlindex 946e8d8ca0..4174458b54 100644--- a/client/src/app/+videos/+video-watch/modal/video-share.component.html+++ b/client/src/app/shared/shared-share-modal/video-share.component.html@@ -7,8 +7,8 @@<div class="modal-body">- <div class="playlist" *ngIf="hasPlaylist()">- <div class="title-page title-page-single" i18n>Share the playlist</div>+ <div class="playlist" *ngIf="playlist">+ <div class="title-page title-page-single" i18n *ngIf="video">Share the playlist</div><div ngbNav #nav="ngbNav" class="nav-tabs" [(activeId)]="activePlaylistId">@@ -53,7 +53,7 @@<div class="filters">- <div class="form-group">+ <div class="form-group" *ngIf="video"><my-peertube-checkbox inputName="includeVideoInPlaylist" [(ngModel)]="includeVideoInPlaylist" i18n-labelTextlabelText="Share the playlist at this video position"></my-peertube-checkbox></div>@@ -62,8 +62,8 @@</div>- <div class="video">- <div class="title-page title-page-single" *ngIf="hasPlaylist()" i18n>Share the video</div>+ <div class="video" *ngIf="video">+ <div class="title-page title-page-single" *ngIf="playlist" i18n>Share the video</div><div ngbNav #nav="ngbNav" class="nav-tabs" [(activeId)]="activeVideoId">diff --git a/client/src/app/+videos/+video-watch/modal/video-share.component.scss b/client/src/app/shared/shared-share-modal/video-share.component.scsssimilarity index 100%rename from client/src/app/+videos/+video-watch/modal/video-share.component.scssrename to client/src/app/shared/shared-share-modal/video-share.component.scssdiff --git a/client/src/app/+videos/+video-watch/modal/video-share.component.ts b/client/src/app/shared/shared-share-modal/video-share.component.tssimilarity index 93%rename from client/src/app/+videos/+video-watch/modal/video-share.component.tsrename to client/src/app/shared/shared-share-modal/video-share.component.tsindex d9171fe0ec..8d8e8a3a59 100644--- a/client/src/app/+videos/+video-watch/modal/video-share.component.ts+++ b/client/src/app/shared/shared-share-modal/video-share.component.ts@@ -1,9 +1,9 @@import { Component, ElementRef, Input, ViewChild } from '@angular/core'-import { buildVideoOrPlaylistEmbed, buildVideoLink, buildPlaylistLink } from '../../../../assets/player/utils'-import { NgbModal } from '@ng-bootstrap/ng-bootstrap'-import { VideoCaption } from '@shared/models'import { VideoDetails } from '@app/shared/shared-main'import { VideoPlaylist } from '@app/shared/shared-video-playlist'+import { NgbModal } from '@ng-bootstrap/ng-bootstrap'+import { VideoCaption } from '@shared/models'+import { buildPlaylistLink, buildVideoLink, buildVideoOrPlaylistEmbed } from '../../../assets/player/utils'type Customizations = {startAtCheckbox: boolean@@ -51,7 +51,7 @@ export class VideoShareComponent {show (currentVideoTimestamp?: number, currentPlaylistPosition?: number) {let subtitle: string- if (this.videoCaptions.length !== 0) {+ if (this.videoCaptions && this.videoCaptions.length !== 0) {subtitle = this.videoCaptions[0].language.id}@@ -60,7 +60,7 @@ export class VideoShareComponent {startAt: currentVideoTimestamp ? Math.floor(currentVideoTimestamp) : 0,stopAtCheckbox: false,- stopAt: this.video.duration,+ stopAt: this.video?.duration,subtitleCheckbox: false,subtitle,@@ -118,10 +118,6 @@ export class VideoShareComponent {return this.activeVideoId === 'embed'}- hasPlaylist () {- return !!this.playlist- }-private getPlaylistOptions (baseUrl?: string) {return {baseUrl,diff --git a/client/src/sass/application.scss b/client/src/sass/application.scssindex cdf0ee9928..f4e4d89771 100644--- a/client/src/sass/application.scss+++ b/client/src/sass/application.scss@@ -282,6 +282,7 @@ table {max-height: 500px;display: flex;+ flex-direction: column;align-items: center;justify-content: center;font-size: 16px;