aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+accounts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-01-07 23:51:14 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-01-10 10:12:09 +0100
commit41eb700fceee1085dd0e1a9ce78ecbd0e111eb6e (patch)
tree41d39a5e8604cd769e9487d5046876629c638316 /client/src/app/+accounts
parentfc2df421a99e87ad20ca1f758491b6af476efd56 (diff)
downloadPeerTube-41eb700fceee1085dd0e1a9ce78ecbd0e111eb6e.tar.gz
PeerTube-41eb700fceee1085dd0e1a9ce78ecbd0e111eb6e.tar.zst
PeerTube-41eb700fceee1085dd0e1a9ce78ecbd0e111eb6e.zip
Refactor my-subscribe-button to support full account subscription
Diffstat (limited to 'client/src/app/+accounts')
-rw-r--r--client/src/app/+accounts/account-video-channels/account-video-channels.component.html10
-rw-r--r--client/src/app/+accounts/accounts.component.html9
-rw-r--r--client/src/app/+accounts/accounts.component.scss10
-rw-r--r--client/src/app/+accounts/accounts.component.ts10
4 files changed, 34 insertions, 5 deletions
diff --git a/client/src/app/+accounts/account-video-channels/account-video-channels.component.html b/client/src/app/+accounts/account-video-channels/account-video-channels.component.html
index 4ebad514c..93f43a350 100644
--- a/client/src/app/+accounts/account-video-channels/account-video-channels.component.html
+++ b/client/src/app/+accounts/account-video-channels/account-video-channels.component.html
@@ -9,14 +9,18 @@
9 <img [src]="videoChannel.avatarUrl" alt="Avatar" /> 9 <img [src]="videoChannel.avatarUrl" alt="Avatar" />
10 10
11 <div>{{ videoChannel.displayName }}</div> 11 <div>{{ videoChannel.displayName }}</div>
12 <div i18n class="followers">{{ videoChannel.followersCount }} subscribers</div> 12 <div class="followers">{{ videoChannel.followersCount }}
13 <ng-container *ngIf="videoChannel.followersCount === 1; then single; else multiple"></ng-container>
14 <ng-template i18n #single>subscriber</ng-template>
15 <ng-template i18n #multiple>subscribers</ng-template>
16 </div>
13 </a> 17 </a>
14 18
15 <my-subscribe-button [videoChannel]="videoChannel"></my-subscribe-button> 19 <my-subscribe-button [videoChannels]="[videoChannel]"></my-subscribe-button>
16 </div> 20 </div>
17 21
18 <div *ngIf="getVideosOf(videoChannel)" class="videos"> 22 <div *ngIf="getVideosOf(videoChannel)" class="videos">
19 <div class="no-results" i18n *ngIf="getVideosOf(videoChannel).length === 0">This channel does not have videos.</div> 23 <div class="no-results my-5" i18n *ngIf="getVideosOf(videoChannel).length === 0">This channel doesn't have any videos.</div>
20 24
21 <my-video-miniature 25 <my-video-miniature
22 *ngFor="let video of getVideosOf(videoChannel)" 26 *ngFor="let video of getVideosOf(videoChannel)"
diff --git a/client/src/app/+accounts/accounts.component.html b/client/src/app/+accounts/accounts.component.html
index 70257162d..1b6eb480e 100644
--- a/client/src/app/+accounts/accounts.component.html
+++ b/client/src/app/+accounts/accounts.component.html
@@ -28,8 +28,15 @@
28 > 28 >
29 </my-user-moderation-dropdown> 29 </my-user-moderation-dropdown>
30 </div> 30 </div>
31 <div i18n class="actor-followers">{{ account.followersCount }} subscribers</div> 31 <div class="actor-followers">
32 {{ account.followersCount }}
33 <ng-container *ngIf="account.followersCount === 1; then single; else multiple"></ng-container>
34 <ng-template i18n #single>subscriber</ng-template>
35 <ng-template i18n #multiple>subscribers</ng-template>
36 </div>
32 </div> 37 </div>
38
39 <my-subscribe-button *ngIf="videoChannels" [account]="account" [videoChannels]="videoChannels"></my-subscribe-button>
33 </div> 40 </div>
34 41
35 <div class="links"> 42 <div class="links">
diff --git a/client/src/app/+accounts/accounts.component.scss b/client/src/app/+accounts/accounts.component.scss
index 273e5c43a..ab3aece54 100644
--- a/client/src/app/+accounts/accounts.component.scss
+++ b/client/src/app/+accounts/accounts.component.scss
@@ -3,6 +3,16 @@
3 3
4.sub-menu { 4.sub-menu {
5 @include sub-menu-with-actor; 5 @include sub-menu-with-actor;
6
7 .actor {
8 width: 100%;
9 }
10}
11
12my-subscribe-button {
13 height: max-content;
14 margin-left: auto;
15 margin-top: 20px;
6} 16}
7 17
8my-user-moderation-dropdown, 18my-user-moderation-dropdown,
diff --git a/client/src/app/+accounts/accounts.component.ts b/client/src/app/+accounts/accounts.component.ts
index 3118d7562..e3a503f4c 100644
--- a/client/src/app/+accounts/accounts.component.ts
+++ b/client/src/app/+accounts/accounts.component.ts
@@ -8,6 +8,8 @@ import { Subscription } from 'rxjs'
8import { AuthService, Notifier, RedirectService } from '@app/core' 8import { AuthService, Notifier, RedirectService } from '@app/core'
9import { User, UserRight } from '../../../../shared' 9import { User, UserRight } from '../../../../shared'
10import { I18n } from '@ngx-translate/i18n-polyfill' 10import { I18n } from '@ngx-translate/i18n-polyfill'
11import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
12import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
11 13
12@Component({ 14@Component({
13 templateUrl: './accounts.component.html', 15 templateUrl: './accounts.component.html',
@@ -16,6 +18,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
16export class AccountsComponent implements OnInit, OnDestroy { 18export class AccountsComponent implements OnInit, OnDestroy {
17 account: Account 19 account: Account
18 user: User 20 user: User
21 videoChannels: VideoChannel[]
19 22
20 private routeSub: Subscription 23 private routeSub: Subscription
21 24
@@ -23,6 +26,7 @@ export class AccountsComponent implements OnInit, OnDestroy {
23 private route: ActivatedRoute, 26 private route: ActivatedRoute,
24 private userService: UserService, 27 private userService: UserService,
25 private accountService: AccountService, 28 private accountService: AccountService,
29 private videoChannelService: VideoChannelService,
26 private notifier: Notifier, 30 private notifier: Notifier,
27 private restExtractor: RestExtractor, 31 private restExtractor: RestExtractor,
28 private redirectService: RedirectService, 32 private redirectService: RedirectService,
@@ -40,7 +44,11 @@ export class AccountsComponent implements OnInit, OnDestroy {
40 catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ])) 44 catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ]))
41 ) 45 )
42 .subscribe( 46 .subscribe(
43 account => this.account = account, 47 account => {
48 this.account = account
49 this.videoChannelService.listAccountVideoChannels(account)
50 .subscribe(videoChannels => this.videoChannels = videoChannels.data)
51 },
44 52
45 err => this.notifier.error(err.message) 53 err => this.notifier.error(err.message)
46 ) 54 )