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 --- .../app/+my-account/my-account-routing.module.ts | 10 +++++ .../my-account-subscriptions.component.html | 23 ++++++++++ .../my-account-subscriptions.component.scss | 49 ++++++++++++++++++++++ .../my-account-subscriptions.component.ts | 30 +++++++++++++ .../my-account-video-channel-update.component.ts | 4 +- .../my-account-video-channels.component.scss | 15 ++----- .../my-account-videos.component.scss | 6 +-- .../src/app/+my-account/my-account.component.html | 6 ++- client/src/app/+my-account/my-account.module.ts | 4 +- .../shared/actor-avatar-info.component.scss | 2 +- 10 files changed, 127 insertions(+), 22 deletions(-) create mode 100644 client/src/app/+my-account/my-account-subscriptions/my-account-subscriptions.component.html create mode 100644 client/src/app/+my-account/my-account-subscriptions/my-account-subscriptions.component.scss create mode 100644 client/src/app/+my-account/my-account-subscriptions/my-account-subscriptions.component.ts (limited to 'client/src/app/+my-account') diff --git a/client/src/app/+my-account/my-account-routing.module.ts b/client/src/app/+my-account/my-account-routing.module.ts index 6f0806e8a..c1c979151 100644 --- a/client/src/app/+my-account/my-account-routing.module.ts +++ b/client/src/app/+my-account/my-account-routing.module.ts @@ -9,6 +9,7 @@ import { MyAccountVideoChannelsComponent } from '@app/+my-account/my-account-vid import { MyAccountVideoChannelCreateComponent } from '@app/+my-account/my-account-video-channels/my-account-video-channel-create.component' import { MyAccountVideoChannelUpdateComponent } from '@app/+my-account/my-account-video-channels/my-account-video-channel-update.component' import { MyAccountVideoImportsComponent } from '@app/+my-account/my-account-video-imports/my-account-video-imports.component' +import { MyAccountSubscriptionsComponent } from '@app/+my-account/my-account-subscriptions/my-account-subscriptions.component' const myAccountRoutes: Routes = [ { @@ -74,6 +75,15 @@ const myAccountRoutes: Routes = [ title: 'Account video imports' } } + }, + { + path: 'subscriptions', + component: MyAccountSubscriptionsComponent, + data: { + meta: { + title: 'Account subscriptions' + } + } } ] } diff --git a/client/src/app/+my-account/my-account-subscriptions/my-account-subscriptions.component.html b/client/src/app/+my-account/my-account-subscriptions/my-account-subscriptions.component.html new file mode 100644 index 000000000..4c68cd1a5 --- /dev/null +++ b/client/src/app/+my-account/my-account-subscriptions/my-account-subscriptions.component.html @@ -0,0 +1,23 @@ +
+ +
diff --git a/client/src/app/+my-account/my-account-subscriptions/my-account-subscriptions.component.scss b/client/src/app/+my-account/my-account-subscriptions/my-account-subscriptions.component.scss new file mode 100644 index 000000000..2fbfa335b --- /dev/null +++ b/client/src/app/+my-account/my-account-subscriptions/my-account-subscriptions.component.scss @@ -0,0 +1,49 @@ +@import '_variables'; +@import '_mixins'; + +.video-channel { + @include row-blocks; + + img { + @include avatar(80px); + + margin-right: 10px; + } + + .video-channel-info { + flex-grow: 1; + + a.video-channel-names { + @include disable-default-a-behaviour; + + width: fit-content; + display: flex; + align-items: baseline; + color: #000; + + .video-channel-display-name { + font-weight: $font-semibold; + font-size: 18px; + } + + .video-channel-name { + font-size: 14px; + color: $grey-actor-name; + margin-left: 5px; + } + } + } + + .actor-owner { + @include actor-owner; + } + + my-subscribe-button { + /deep/ span[role=button] { + padding: 7px 12px; + font-size: 16px; + } + } +} + + diff --git a/client/src/app/+my-account/my-account-subscriptions/my-account-subscriptions.component.ts b/client/src/app/+my-account/my-account-subscriptions/my-account-subscriptions.component.ts new file mode 100644 index 000000000..1e94cf90b --- /dev/null +++ b/client/src/app/+my-account/my-account-subscriptions/my-account-subscriptions.component.ts @@ -0,0 +1,30 @@ +import { Component, OnInit } from '@angular/core' +import { NotificationsService } from 'angular2-notifications' +import { VideoChannel } from '@app/shared/video-channel/video-channel.model' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { UserSubscriptionService } from '@app/shared/user-subscription' + +@Component({ + selector: 'my-account-subscriptions', + templateUrl: './my-account-subscriptions.component.html', + styleUrls: [ './my-account-subscriptions.component.scss' ] +}) +export class MyAccountSubscriptionsComponent implements OnInit { + videoChannels: VideoChannel[] = [] + + constructor ( + private userSubscriptionService: UserSubscriptionService, + private notificationsService: NotificationsService, + private i18n: I18n + ) {} + + ngOnInit () { + this.userSubscriptionService.listSubscriptions() + .subscribe( + res => { console.log(res); this.videoChannels = res.data }, + + error => this.notificationsService.error(this.i18n('Error'), error.message) + ) + } + +} diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts index e25037e24..56697030b 100644 --- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts +++ b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts @@ -78,7 +78,7 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE support: body.support || null } - this.videoChannelService.updateVideoChannel(this.videoChannelToUpdate.uuid, videoChannelUpdate).subscribe( + this.videoChannelService.updateVideoChannel(this.videoChannelToUpdate.name, videoChannelUpdate).subscribe( () => { this.authService.refreshUserInformation() this.notificationsService.success( @@ -93,7 +93,7 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE } onAvatarChange (formData: FormData) { - this.videoChannelService.changeVideoChannelAvatar(this.videoChannelToUpdate.uuid, formData) + this.videoChannelService.changeVideoChannelAvatar(this.videoChannelToUpdate.name, formData) .subscribe( data => { this.notificationsService.success(this.i18n('Success'), this.i18n('Avatar changed.')) diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.scss b/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.scss index f8fd2684e..5c892be01 100644 --- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.scss +++ b/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.scss @@ -12,11 +12,7 @@ } .video-channel { - display: flex; - min-height: 130px; - padding-bottom: 20px; - margin-bottom: 20px; - border-bottom: 1px solid #C6C6C6; + @include row-blocks; img { @include avatar(80px); @@ -42,7 +38,7 @@ .video-channel-name { font-size: 14px; - color: #777272; + color: $grey-actor-name; margin-left: 5px; } } @@ -64,12 +60,9 @@ } .video-channel { - flex-direction: column; - height: auto; - text-align: center; - .video-channel-names { - justify-content: center; + flex-direction: column; + align-items: center !important; } img { diff --git a/client/src/app/+my-account/my-account-videos/my-account-videos.component.scss b/client/src/app/+my-account/my-account-videos/my-account-videos.component.scss index 64a04fa20..cd805be73 100644 --- a/client/src/app/+my-account/my-account-videos/my-account-videos.component.scss +++ b/client/src/app/+my-account/my-account-videos/my-account-videos.component.scss @@ -42,11 +42,7 @@ } .video { - display: flex; - min-height: 130px; - padding-bottom: 20px; - margin-bottom: 20px; - border-bottom: 1px solid #C6C6C6; + @include row-blocks; &:first-child { margin-top: 47px; diff --git a/client/src/app/+my-account/my-account.component.html b/client/src/app/+my-account/my-account.component.html index ddb0570db..74742649c 100644 --- a/client/src/app/+my-account/my-account.component.html +++ b/client/src/app/+my-account/my-account.component.html @@ -2,11 +2,13 @@
diff --git a/client/src/app/+my-account/my-account.module.ts b/client/src/app/+my-account/my-account.module.ts index 29b49e8d9..c93f38d4b 100644 --- a/client/src/app/+my-account/my-account.module.ts +++ b/client/src/app/+my-account/my-account.module.ts @@ -14,6 +14,7 @@ import { MyAccountVideoChannelUpdateComponent } from '@app/+my-account/my-accoun import { ActorAvatarInfoComponent } from '@app/+my-account/shared/actor-avatar-info.component' import { MyAccountVideoImportsComponent } from '@app/+my-account/my-account-video-imports/my-account-video-imports.component' import { MyAccountDangerZoneComponent } from '@app/+my-account/my-account-settings/my-account-danger-zone' +import { MyAccountSubscriptionsComponent } from '@app/+my-account/my-account-subscriptions/my-account-subscriptions.component' @NgModule({ imports: [ @@ -34,7 +35,8 @@ import { MyAccountDangerZoneComponent } from '@app/+my-account/my-account-settin MyAccountVideoChannelUpdateComponent, ActorAvatarInfoComponent, MyAccountVideoImportsComponent, - MyAccountDangerZoneComponent + MyAccountDangerZoneComponent, + MyAccountSubscriptionsComponent ], exports: [ diff --git a/client/src/app/+my-account/shared/actor-avatar-info.component.scss b/client/src/app/+my-account/shared/actor-avatar-info.component.scss index 36a792f82..0b0c83de5 100644 --- a/client/src/app/+my-account/shared/actor-avatar-info.component.scss +++ b/client/src/app/+my-account/shared/actor-avatar-info.component.scss @@ -25,7 +25,7 @@ position: relative; top: 2px; font-size: 14px; - color: #777272; + color: $grey-actor-name; } } -- cgit v1.2.3