diff options
author | Chocobozzz <me@florianbigard.com> | 2018-04-25 15:43:19 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-04-25 15:43:19 +0200 |
commit | d3e91a5f72ac9c986cdb67d7d6c85bb4819e680c (patch) | |
tree | 3c2406346c7774587ba4e095ab595e5953e25c61 /client/src/app/+account | |
parent | 03e12d7c4954e1071fdeb7ef362ea5c3965d4075 (diff) | |
download | PeerTube-d3e91a5f72ac9c986cdb67d7d6c85bb4819e680c.tar.gz PeerTube-d3e91a5f72ac9c986cdb67d7d6c85bb4819e680c.tar.zst PeerTube-d3e91a5f72ac9c986cdb67d7d6c85bb4819e680c.zip |
Add video channel account list
Diffstat (limited to 'client/src/app/+account')
7 files changed, 90 insertions, 6 deletions
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' | |||
3 | import { MetaGuard } from '@ngx-meta/core' | 3 | import { MetaGuard } from '@ngx-meta/core' |
4 | import { AccountComponent } from './account.component' | 4 | import { AccountComponent } from './account.component' |
5 | import { AccountVideosComponent } from './account-videos/account-videos.component' | 5 | import { AccountVideosComponent } from './account-videos/account-videos.component' |
6 | import { AccountAboutComponent } from '@app/+account/account-about/account-about.component' | 6 | import { AccountAboutComponent } from './account-about/account-about.component' |
7 | import { AccountVideoChannelsComponent } from './account-video-channels/account-video-channels.component' | ||
7 | 8 | ||
8 | const accountRoutes: Routes = [ | 9 | const accountRoutes: Routes = [ |
9 | { | 10 | { |
@@ -26,6 +27,15 @@ const accountRoutes: Routes = [ | |||
26 | } | 27 | } |
27 | }, | 28 | }, |
28 | { | 29 | { |
30 | path: 'video-channels', | ||
31 | component: AccountVideoChannelsComponent, | ||
32 | data: { | ||
33 | meta: { | ||
34 | title: 'Account video channels' | ||
35 | } | ||
36 | } | ||
37 | }, | ||
38 | { | ||
29 | path: 'about', | 39 | path: 'about', |
30 | component: AccountAboutComponent, | 40 | component: AccountAboutComponent, |
31 | data: { | 41 | data: { |
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 @@ | |||
1 | <div *ngIf="account" class="row"> | ||
2 | <a | ||
3 | *ngFor="let videoChannel of videoChannels" [routerLink]="[ '/video-channels', videoChannel.uuid ]" | ||
4 | class="video-channel" title="See this video channel" | ||
5 | > | ||
6 | <img [src]="videoChannel.avatarUrl" alt="Avatar" /> | ||
7 | |||
8 | <div class="video-channel-display-name">{{ videoChannel.displayName }}</div> | ||
9 | <div class="video-channel-followers">{{ videoChannel.followersCount }} subscribers</div> | ||
10 | </a> | ||
11 | </div> \ 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 @@ | |||
1 | @import '_variables'; | ||
2 | @import '_mixins'; | ||
3 | |||
4 | .row { | ||
5 | text-align: center; | ||
6 | } | ||
7 | |||
8 | a.video-channel { | ||
9 | @include disable-default-a-behaviour; | ||
10 | |||
11 | display: inline-block; | ||
12 | text-align: center; | ||
13 | color: #000; | ||
14 | margin: 10px 30px; | ||
15 | |||
16 | img { | ||
17 | @include avatar(80px); | ||
18 | |||
19 | margin-bottom: 10px; | ||
20 | } | ||
21 | |||
22 | .video-channel-display-name { | ||
23 | font-size: 20px; | ||
24 | font-weight: $font-bold; | ||
25 | } | ||
26 | |||
27 | .video-channel-followers { | ||
28 | font-size: 15px; | ||
29 | } | ||
30 | } \ 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 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | ||
2 | import { ActivatedRoute } from '@angular/router' | ||
3 | import 'rxjs/add/observable/from' | ||
4 | import 'rxjs/add/operator/concatAll' | ||
5 | import { Account } from '@app/shared/account/account.model' | ||
6 | import { AccountService } from '@app/shared/account/account.service' | ||
7 | import { VideoChannel } from '../../../../../shared/models/videos' | ||
8 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' | ||
9 | |||
10 | @Component({ | ||
11 | selector: 'my-account-video-channels', | ||
12 | templateUrl: './account-video-channels.component.html', | ||
13 | styleUrls: [ './account-video-channels.component.scss' ] | ||
14 | }) | ||
15 | export class AccountVideoChannelsComponent implements OnInit { | ||
16 | account: Account | ||
17 | videoChannels: VideoChannel[] = [] | ||
18 | |||
19 | constructor ( | ||
20 | protected route: ActivatedRoute, | ||
21 | private accountService: AccountService, | ||
22 | private videoChannelService: VideoChannelService | ||
23 | ) { } | ||
24 | |||
25 | ngOnInit () { | ||
26 | // Parent get the account for us | ||
27 | this.accountService.accountLoaded | ||
28 | .do(account => this.account = account) | ||
29 | .flatMap(account => this.videoChannelService.getVideoChannels(account.id)) | ||
30 | .map(res => res.data) | ||
31 | .subscribe(videoChannels => this.videoChannels = videoChannels) | ||
32 | } | ||
33 | } | ||
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 @@ | |||
2 | <div class="sub-menu"> | 2 | <div class="sub-menu"> |
3 | 3 | ||
4 | <div class="account"> | 4 | <div class="account"> |
5 | <img [src]="getAvatarUrl()" alt="Avatar" /> | 5 | <img [src]="account.avatarUrl" alt="Avatar" /> |
6 | 6 | ||
7 | <div class="account-info"> | 7 | <div class="account-info"> |
8 | <div class="account-display-name">{{ account.displayName }}</div> | 8 | <div class="account-display-name">{{ account.displayName }}</div> |
@@ -13,6 +13,8 @@ | |||
13 | <div class="links"> | 13 | <div class="links"> |
14 | <a routerLink="videos" routerLinkActive="active" class="title-page">Videos</a> | 14 | <a routerLink="videos" routerLinkActive="active" class="title-page">Videos</a> |
15 | 15 | ||
16 | <a routerLink="video-channels" routerLinkActive="active" class="title-page">Video channels</a> | ||
17 | |||
16 | <a routerLink="about" routerLinkActive="active" class="title-page">About</a> | 18 | <a routerLink="about" routerLinkActive="active" class="title-page">About</a> |
17 | </div> | 19 | </div> |
18 | </div> | 20 | </div> |
diff --git a/client/src/app/+account/account.component.ts b/client/src/app/+account/account.component.ts index ae5354ed9..d936ce2fe 100644 --- a/client/src/app/+account/account.component.ts +++ b/client/src/app/+account/account.component.ts | |||
@@ -22,8 +22,4 @@ export class AccountComponent implements OnInit { | |||
22 | this.accountService.getAccount(accountId) | 22 | this.accountService.getAccount(accountId) |
23 | .subscribe(account => this.account = account) | 23 | .subscribe(account => this.account = account) |
24 | } | 24 | } |
25 | |||
26 | getAvatarUrl () { | ||
27 | return Account.GET_ACCOUNT_AVATAR_URL(this.account) | ||
28 | } | ||
29 | } | 25 | } |
diff --git a/client/src/app/+account/account.module.ts b/client/src/app/+account/account.module.ts index 2fe67f3c5..82ef06e76 100644 --- a/client/src/app/+account/account.module.ts +++ b/client/src/app/+account/account.module.ts | |||
@@ -4,6 +4,7 @@ import { AccountRoutingModule } from './account-routing.module' | |||
4 | import { AccountComponent } from './account.component' | 4 | import { AccountComponent } from './account.component' |
5 | import { AccountVideosComponent } from './account-videos/account-videos.component' | 5 | import { AccountVideosComponent } from './account-videos/account-videos.component' |
6 | import { AccountAboutComponent } from './account-about/account-about.component' | 6 | import { AccountAboutComponent } from './account-about/account-about.component' |
7 | import { AccountVideoChannelsComponent } from './account-video-channels/account-video-channels.component' | ||
7 | 8 | ||
8 | @NgModule({ | 9 | @NgModule({ |
9 | imports: [ | 10 | imports: [ |
@@ -14,6 +15,7 @@ import { AccountAboutComponent } from './account-about/account-about.component' | |||
14 | declarations: [ | 15 | declarations: [ |
15 | AccountComponent, | 16 | AccountComponent, |
16 | AccountVideosComponent, | 17 | AccountVideosComponent, |
18 | AccountVideoChannelsComponent, | ||
17 | AccountAboutComponent | 19 | AccountAboutComponent |
18 | ], | 20 | ], |
19 | 21 | ||