From 22a16e36f6526887ed8f5e5d3c9f9e5da0b4a8cd Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 21 Aug 2018 16:18:59 +0200 Subject: Add local user subscriptions --- .../videos/+video-watch/video-watch.component.html | 9 ++-- .../videos/+video-watch/video-watch.component.scss | 17 +++++-- .../video-user-subscriptions.component.ts | 57 ++++++++++++++++++++++ client/src/app/videos/videos-routing.module.ts | 15 ++++-- client/src/app/videos/videos.module.ts | 4 +- 5 files changed, 87 insertions(+), 15 deletions(-) create mode 100644 client/src/app/videos/video-list/video-user-subscriptions.component.ts (limited to 'client/src/app/videos') diff --git a/client/src/app/videos/+video-watch/video-watch.component.html b/client/src/app/videos/+video-watch/video-watch.component.html index c275258ef..8a49e3566 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.html +++ b/client/src/app/videos/+video-watch/video-watch.component.html @@ -42,16 +42,17 @@ Video channel avatar - + +
- - By {{ video.by }} + + By {{ video.byAccount }} Account avatar - +
diff --git a/client/src/app/videos/+video-watch/video-watch.component.scss b/client/src/app/videos/+video-watch/video-watch.component.scss index 1354de32e..5bf2f485a 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.scss +++ b/client/src/app/videos/+video-watch/video-watch.component.scss @@ -125,6 +125,14 @@ margin: -2px 2px 0 5px; } } + + my-subscribe-button { + /deep/ span[role=button] { + font-size: 13px !important; + } + + margin-left: 5px; + } } .video-info-by { @@ -369,7 +377,10 @@ .video-miniature-information { flex-grow: 1; - margin-left: 10px; + } + + .video-thumbnail { + margin-right: 10px } } } @@ -502,10 +513,6 @@ .other-videos { /deep/ .video-miniature { flex-direction: column; - - .video-miniature-information { - margin-left: 0 !important; - } } } diff --git a/client/src/app/videos/video-list/video-user-subscriptions.component.ts b/client/src/app/videos/video-list/video-user-subscriptions.component.ts new file mode 100644 index 000000000..6e8959c54 --- /dev/null +++ b/client/src/app/videos/video-list/video-user-subscriptions.component.ts @@ -0,0 +1,57 @@ +import { Component, OnDestroy, OnInit } from '@angular/core' +import { ActivatedRoute, Router } from '@angular/router' +import { immutableAssign } from '@app/shared/misc/utils' +import { Location } from '@angular/common' +import { NotificationsService } from 'angular2-notifications' +import { AuthService } from '../../core/auth' +import { AbstractVideoList } from '../../shared/video/abstract-video-list' +import { VideoSortField } from '../../shared/video/sort-field.type' +import { VideoService } from '../../shared/video/video.service' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { ScreenService } from '@app/shared/misc/screen.service' +import { OwnerDisplayType } from '@app/shared/video/video-miniature.component' + +@Component({ + selector: 'my-videos-user-subscriptions', + styleUrls: [ '../../shared/video/abstract-video-list.scss' ], + templateUrl: '../../shared/video/abstract-video-list.html' +}) +export class VideoUserSubscriptionsComponent extends AbstractVideoList implements OnInit, OnDestroy { + titlePage: string + currentRoute = '/videos/subscriptions' + sort = '-publishedAt' as VideoSortField + ownerDisplayType: OwnerDisplayType = 'auto' + + constructor ( + protected router: Router, + protected route: ActivatedRoute, + protected notificationsService: NotificationsService, + protected authService: AuthService, + protected location: Location, + protected i18n: I18n, + protected screenService: ScreenService, + private videoService: VideoService + ) { + super() + + this.titlePage = i18n('Videos from your subscriptions') + } + + ngOnInit () { + super.ngOnInit() + } + + ngOnDestroy () { + super.ngOnDestroy() + } + + getVideosObservable (page: number) { + const newPagination = immutableAssign(this.pagination, { currentPage: page }) + + return this.videoService.getUserSubscriptionVideos(newPagination, this.sort) + } + + generateSyndicationList () { + // not implemented yet + } +} diff --git a/client/src/app/videos/videos-routing.module.ts b/client/src/app/videos/videos-routing.module.ts index 538a43c6d..18ed52570 100644 --- a/client/src/app/videos/videos-routing.module.ts +++ b/client/src/app/videos/videos-routing.module.ts @@ -5,6 +5,7 @@ import { MetaGuard } from '@ngx-meta/core' import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' import { VideoTrendingComponent } from './video-list/video-trending.component' import { VideosComponent } from './videos.component' +import { VideoUserSubscriptionsComponent } from '@app/videos/video-list/video-user-subscriptions.component' const videosRoutes: Routes = [ { @@ -12,11 +13,6 @@ const videosRoutes: Routes = [ component: VideosComponent, canActivateChild: [ MetaGuard ], children: [ - { - path: 'list', - pathMatch: 'full', - redirectTo: 'recently-added' - }, { path: 'trending', component: VideoTrendingComponent, @@ -35,6 +31,15 @@ const videosRoutes: Routes = [ } } }, + { + path: 'subscriptions', + component: VideoUserSubscriptionsComponent, + data: { + meta: { + title: 'Subscriptions' + } + } + }, { path: 'local', component: VideoLocalComponent, diff --git a/client/src/app/videos/videos.module.ts b/client/src/app/videos/videos.module.ts index c38257e08..3c3877273 100644 --- a/client/src/app/videos/videos.module.ts +++ b/client/src/app/videos/videos.module.ts @@ -5,6 +5,7 @@ import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.c import { VideoTrendingComponent } from './video-list/video-trending.component' import { VideosRoutingModule } from './videos-routing.module' import { VideosComponent } from './videos.component' +import { VideoUserSubscriptionsComponent } from '@app/videos/video-list/video-user-subscriptions.component' @NgModule({ imports: [ @@ -17,7 +18,8 @@ import { VideosComponent } from './videos.component' VideoTrendingComponent, VideoRecentlyAddedComponent, - VideoLocalComponent + VideoLocalComponent, + VideoUserSubscriptionsComponent ], exports: [ -- cgit v1.2.3