From bbe0f0645ca958d33a3f409b15166609733b663f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 15 Jun 2018 16:52:15 +0200 Subject: Add ability to schedule video publication --- .../my-account-videos.component.html | 6 ++--- .../my-account-videos.component.scss | 1 + .../my-account-videos.component.ts | 29 ++++++++++++++++------ 3 files changed, 25 insertions(+), 11 deletions(-) (limited to 'client/src/app/+my-account') diff --git a/client/src/app/+my-account/my-account-videos/my-account-videos.component.html b/client/src/app/+my-account/my-account-videos/my-account-videos.component.html index eb24de7a7..7ac6371db 100644 --- a/client/src/app/+my-account/my-account-videos/my-account-videos.component.html +++ b/client/src/app/+my-account/my-account-videos/my-account-videos.component.html @@ -18,7 +18,7 @@
{{ video.name }} {{ video.createdAt | myFromNow }} - {{ video.views | myNumberFormatter }} views -
{{ video.privacy.label }} - {{ getStateLabel(video) }}
+
{{ video.privacy.label }}{{ getStateLabel(video) }}
@@ -28,9 +28,9 @@ Cancel - + - Delete + Delete 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 f276ea389..1f22aec71 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 @@ -75,6 +75,7 @@ color: #000; display: block; + width: fit-content; font-size: 16px; font-weight: $font-semibold; } diff --git a/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts b/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts index afc01073c..e698b75ec 100644 --- a/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts +++ b/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts @@ -1,6 +1,6 @@ import { from as observableFrom, Observable } from 'rxjs' import { concatAll, tap } from 'rxjs/operators' -import { Component, OnDestroy, OnInit } from '@angular/core' +import { Component, OnDestroy, OnInit, Inject, LOCALE_ID } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' import { Location } from '@angular/common' import { immutableAssign } from '@app/shared/misc/utils' @@ -12,7 +12,8 @@ import { AbstractVideoList } from '../../shared/video/abstract-video-list' import { Video } from '../../shared/video/video.model' import { VideoService } from '../../shared/video/video.service' import { I18n } from '@ngx-translate/i18n-polyfill' -import { VideoState } from '../../../../../shared/models/videos' +import { VideoPrivacy, VideoState } from '../../../../../shared/models/videos' +import { ScreenService } from '@app/shared/misc/screen.service' @Component({ selector: 'my-account-videos', @@ -39,8 +40,10 @@ export class MyAccountVideosComponent extends AbstractVideoList implements OnIni protected notificationsService: NotificationsService, protected confirmService: ConfirmService, protected location: Location, + protected screenService: ScreenService, protected i18n: I18n, - private videoService: VideoService + private videoService: VideoService, + @Inject(LOCALE_ID) private localeId: string ) { super() @@ -131,12 +134,22 @@ export class MyAccountVideosComponent extends AbstractVideoList implements OnIni } getStateLabel (video: Video) { - if (video.state.id === VideoState.PUBLISHED) return this.i18n('Published') - - if (video.state.id === VideoState.TO_TRANSCODE && video.waitTranscoding === true) return this.i18n('Waiting transcoding') - if (video.state.id === VideoState.TO_TRANSCODE) return this.i18n('To transcode') + let suffix: string + + if (video.privacy.id !== VideoPrivacy.PRIVATE && video.state.id === VideoState.PUBLISHED) { + suffix = this.i18n('Published') + } else if (video.scheduledUpdate) { + const updateAt = new Date(video.scheduledUpdate.updateAt.toString()).toLocaleString(this.localeId) + suffix = this.i18n('Publication scheduled on ') + updateAt + } else if (video.state.id === VideoState.TO_TRANSCODE && video.waitTranscoding === true) { + suffix = this.i18n('Waiting transcoding') + } else if (video.state.id === VideoState.TO_TRANSCODE) { + suffix = this.i18n('To transcode') + } else { + return '' + } - return this.i18n('Unknown state') + return ' - ' + suffix } protected buildVideoHeight () { -- cgit v1.2.3