From d3e91a5f72ac9c986cdb67d7d6c85bb4819e680c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 25 Apr 2018 15:43:19 +0200 Subject: [PATCH] Add video channel account list --- .../app/+account/account-routing.module.ts | 12 ++++- .../account-video-channels.component.html | 11 ++++ .../account-video-channels.component.scss | 30 +++++++++++ .../account-video-channels.component.ts | 33 ++++++++++++ .../src/app/+account/account.component.html | 4 +- client/src/app/+account/account.component.ts | 4 -- client/src/app/+account/account.module.ts | 2 + client/src/app/menu/menu.component.html | 2 +- client/src/app/menu/menu.component.ts | 4 -- .../my-account-settings.component.html | 2 +- .../my-account-settings.component.ts | 4 -- .../src/app/shared/account/account.model.ts | 44 ++-------------- client/src/app/shared/actor/actor.model.ts | 50 +++++++++++++++++++ client/src/app/shared/shared.module.ts | 4 +- client/src/app/shared/users/user.model.ts | 17 ++++--- .../video-channel/video-channel.model.ts | 23 +++++++++ .../video-channel/video-channel.service.ts | 36 +++++++++++++ client/src/app/shared/video/video.model.ts | 6 ++- .../comment/video-comment-add.component.html | 2 +- .../comment/video-comment-add.component.ts | 4 -- .../comment/video-comment.component.html | 2 +- .../comment/video-comment.component.ts | 6 --- .../comment/video-comment.model.ts | 6 ++- .../+video-watch/video-watch.component.html | 2 +- .../+video-watch/video-watch.component.ts | 4 -- 25 files changed, 230 insertions(+), 84 deletions(-) create mode 100644 client/src/app/+account/account-video-channels/account-video-channels.component.html create mode 100644 client/src/app/+account/account-video-channels/account-video-channels.component.scss create mode 100644 client/src/app/+account/account-video-channels/account-video-channels.component.ts create mode 100644 client/src/app/shared/actor/actor.model.ts create mode 100644 client/src/app/shared/video-channel/video-channel.model.ts create mode 100644 client/src/app/shared/video-channel/video-channel.service.ts diff --git a/client/src/app/+account/account-routing.module.ts b/client/src/app/+account/account-routing.module.ts index 534102121..f72d8373f 100644 --- a/client/src/app/+account/account-routing.module.ts +++ b/client/src/app/+account/account-routing.module.ts @@ -3,7 +3,8 @@ import { RouterModule, Routes } from '@angular/router' import { MetaGuard } from '@ngx-meta/core' import { AccountComponent } from './account.component' import { AccountVideosComponent } from './account-videos/account-videos.component' -import { AccountAboutComponent } from '@app/+account/account-about/account-about.component' +import { AccountAboutComponent } from './account-about/account-about.component' +import { AccountVideoChannelsComponent } from './account-video-channels/account-video-channels.component' const accountRoutes: Routes = [ { @@ -25,6 +26,15 @@ const accountRoutes: Routes = [ } } }, + { + path: 'video-channels', + component: AccountVideoChannelsComponent, + data: { + meta: { + title: 'Account video channels' + } + } + }, { path: 'about', component: AccountAboutComponent, diff --git a/client/src/app/+account/account-video-channels/account-video-channels.component.html b/client/src/app/+account/account-video-channels/account-video-channels.component.html new file mode 100644 index 000000000..d20b40c60 --- /dev/null +++ b/client/src/app/+account/account-video-channels/account-video-channels.component.html @@ -0,0 +1,11 @@ +
+ + Avatar + +
{{ videoChannel.displayName }}
+
{{ videoChannel.followersCount }} subscribers
+
+
\ No newline at end of file diff --git a/client/src/app/+account/account-video-channels/account-video-channels.component.scss b/client/src/app/+account/account-video-channels/account-video-channels.component.scss new file mode 100644 index 000000000..c9c7fa8eb --- /dev/null +++ b/client/src/app/+account/account-video-channels/account-video-channels.component.scss @@ -0,0 +1,30 @@ +@import '_variables'; +@import '_mixins'; + +.row { + text-align: center; +} + +a.video-channel { + @include disable-default-a-behaviour; + + display: inline-block; + text-align: center; + color: #000; + margin: 10px 30px; + + img { + @include avatar(80px); + + margin-bottom: 10px; + } + + .video-channel-display-name { + font-size: 20px; + font-weight: $font-bold; + } + + .video-channel-followers { + font-size: 15px; + } +} \ No newline at end of file diff --git a/client/src/app/+account/account-video-channels/account-video-channels.component.ts b/client/src/app/+account/account-video-channels/account-video-channels.component.ts new file mode 100644 index 000000000..8915eb622 --- /dev/null +++ b/client/src/app/+account/account-video-channels/account-video-channels.component.ts @@ -0,0 +1,33 @@ +import { Component, OnInit } from '@angular/core' +import { ActivatedRoute } from '@angular/router' +import 'rxjs/add/observable/from' +import 'rxjs/add/operator/concatAll' +import { Account } from '@app/shared/account/account.model' +import { AccountService } from '@app/shared/account/account.service' +import { VideoChannel } from '../../../../../shared/models/videos' +import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' + +@Component({ + selector: 'my-account-video-channels', + templateUrl: './account-video-channels.component.html', + styleUrls: [ './account-video-channels.component.scss' ] +}) +export class AccountVideoChannelsComponent implements OnInit { + account: Account + videoChannels: VideoChannel[] = [] + + constructor ( + protected route: ActivatedRoute, + private accountService: AccountService, + private videoChannelService: VideoChannelService + ) { } + + ngOnInit () { + // Parent get the account for us + this.accountService.accountLoaded + .do(account => this.account = account) + .flatMap(account => this.videoChannelService.getVideoChannels(account.id)) + .map(res => res.data) + .subscribe(videoChannels => this.videoChannels = videoChannels) + } +} diff --git a/client/src/app/+account/account.component.html b/client/src/app/+account/account.component.html index f875b37a4..d0e99edda 100644 --- a/client/src/app/+account/account.component.html +++ b/client/src/app/+account/account.component.html @@ -2,7 +2,7 @@