From e2f01c47e08d26a30ad47068d195b3d21d0df8a1 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 13 Mar 2019 14:18:58 +0100 Subject: Playlist support in watch page --- ...video-playlist-element-miniature.component.html | 73 ++++++++++ ...video-playlist-element-miniature.component.scss | 124 +++++++++++++++++ .../video-playlist-element-miniature.component.ts | 149 +++++++++++++++++++++ 3 files changed, 346 insertions(+) create mode 100644 client/src/app/shared/video-playlist/video-playlist-element-miniature.component.html create mode 100644 client/src/app/shared/video-playlist/video-playlist-element-miniature.component.scss create mode 100644 client/src/app/shared/video-playlist/video-playlist-element-miniature.component.ts (limited to 'client/src/app/shared/video-playlist') diff --git a/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.html b/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.html new file mode 100644 index 000000000..1f178675f --- /dev/null +++ b/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.html @@ -0,0 +1,73 @@ +
+ +
+ + {{ video.playlistElement.position }} +
+ + + +
+ {{ video.name }} + + + + + {{ formatTimestamp(video)}} +
+ + +
+ + +
+ + +
+
+ + + +
+ +
+ + + +
+ + +
+ + + Delete from {{playlist?.displayName}} + +
+
+
diff --git a/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.scss b/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.scss new file mode 100644 index 000000000..eb869f69a --- /dev/null +++ b/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.scss @@ -0,0 +1,124 @@ +@import '_variables'; +@import '_mixins'; +@import '_miniature'; + +.video { + display: flex; + align-items: center; + background-color: var(--mainBackgroundColor); + padding: 10px; + border-bottom: 1px solid $separator-border-color; + + &:hover { + background-color: rgba(0, 0, 0, 0.05); + + .more { + display: block; + } + } + + &.playing { + background-color: rgba(0, 0, 0, 0.02); + } + + a { + @include disable-default-a-behaviour; + + min-width: 0; + display: flex; + align-items: center; + cursor: pointer; + flex-grow: 1; + + .position { + font-weight: $font-semibold; + margin-right: 10px; + color: $grey-foreground-color; + min-width: 20px; + + my-global-icon { + @include apply-svg-color($grey-foreground-color); + + width: 17px; + position: relative; + left: -2px; + } + } + + my-video-thumbnail { + @include thumbnail-size-component(130px, 72px); + + display: flex; // Avoids an issue with line-height that adds space below the element + margin-right: 10px; + } + + .video-info { + display: flex; + flex-direction: column; + min-width: 0; + + a { + color: var(--mainForegroundColor); + width: fit-content; + + &:hover { + text-decoration: underline !important; + } + } + + .video-info-name { + font-size: 18px; + font-weight: $font-semibold; + + @include ellipsis; + } + + .video-info-account, .video-info-timestamp { + color: $grey-foreground-color; + } + } + } + + .more { + justify-self: flex-end; + margin-left: auto; + cursor: pointer; + display: none; + + &.show { + display: block; + } + + .icon-more { + @include apply-svg-color($grey-foreground-color); + + display: flex; + + &::after { + border: none; + } + } + + .dropdown-item { + @include dropdown-with-icon-item; + } + + .timestamp-options { + padding-top: 0; + padding-left: 35px; + margin-bottom: 15px; + + > div { + display: flex; + align-items: center; + } + + input { + @include peertube-button; + @include orange-button; + + margin-top: 10px; + } + } + } +} diff --git a/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.ts b/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.ts new file mode 100644 index 000000000..c0cfd855d --- /dev/null +++ b/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.ts @@ -0,0 +1,149 @@ +import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core' +import { Video } from '@app/shared/video/video.model' +import { VideoPlaylistElementUpdate } from '@shared/models' +import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core' +import { ActivatedRoute } from '@angular/router' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { VideoService } from '@app/shared/video/video.service' +import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' +import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' +import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' +import { secondsToTime } from '../../../assets/player/utils' + +@Component({ + selector: 'my-video-playlist-element-miniature', + styleUrls: [ './video-playlist-element-miniature.component.scss' ], + templateUrl: './video-playlist-element-miniature.component.html' +}) +export class VideoPlaylistElementMiniatureComponent { + @ViewChild('moreDropdown') moreDropdown: NgbDropdown + + @Input() playlist: VideoPlaylist + @Input() video: Video + @Input() owned = false + @Input() playing = false + @Input() rowLink = false + @Input() accountLink = true + + @Output() elementRemoved = new EventEmitter