aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-12-09 15:00:02 +0100
committerChocobozzz <me@florianbigard.com>2020-12-09 15:33:16 +0100
commit5cac83a78d6ba5212755fafce2ed25f7c74b04e5 (patch)
treec0aa6473f7837fdb15f1dc2c814e7efa02d78c19 /client/src
parent0d8de2756fdc43be61a82a96c17d12ee52ba0143 (diff)
downloadPeerTube-5cac83a78d6ba5212755fafce2ed25f7c74b04e5.tar.gz
PeerTube-5cac83a78d6ba5212755fafce2ed25f7c74b04e5.tar.zst
PeerTube-5cac83a78d6ba5212755fafce2ed25f7c74b04e5.zip
Refactor views component
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.component.html8
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.module.ts4
-rw-r--r--client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts4
-rw-r--r--client/src/app/shared/shared-video-miniature/video-miniature.component.html5
-rw-r--r--client/src/app/shared/shared-video/index.ts1
-rw-r--r--client/src/app/shared/shared-video/shared-video.module.ts19
-rw-r--r--client/src/app/shared/shared-video/video-views-counter.component.html9
-rw-r--r--client/src/app/shared/shared-video/video-views-counter.component.scss0
-rw-r--r--client/src/app/shared/shared-video/video-views-counter.component.ts11
9 files changed, 50 insertions, 11 deletions
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.html b/client/src/app/+videos/+video-watch/video-watch.component.html
index 602214ac5..9cabe3bbc 100644
--- a/client/src/app/+videos/+video-watch/video-watch.component.html
+++ b/client/src/app/+videos/+video-watch/video-watch.component.html
@@ -53,12 +53,8 @@
53 53
54 <div class="video-info-date-views"> 54 <div class="video-info-date-views">
55 <ng-container i18n>Published <my-date-toggle [date]="video.publishedAt"></my-date-toggle></ng-container> 55 <ng-container i18n>Published <my-date-toggle [date]="video.publishedAt"></my-date-toggle></ng-container>
56 56
57 <span i18n [title]="video.getExactNumberOfViews()" class="views"> 57 <my-video-views-counter [video]="video"></my-video-views-counter>
58 • {{ video.views | myNumberFormatter }}
59 <ng-container *ngIf="!video.isLive">views</ng-container>
60 <ng-container *ngIf="video.isLive">viewers</ng-container>
61 </span>
62 </div> 58 </div>
63 </div> 59 </div>
64 60
diff --git a/client/src/app/+videos/+video-watch/video-watch.module.ts b/client/src/app/+videos/+video-watch/video-watch.module.ts
index 21aa33b84..fbda9b9c4 100644
--- a/client/src/app/+videos/+video-watch/video-watch.module.ts
+++ b/client/src/app/+videos/+video-watch/video-watch.module.ts
@@ -5,6 +5,7 @@ import { SharedMainModule } from '@app/shared/shared-main'
5import { SharedModerationModule } from '@app/shared/shared-moderation' 5import { SharedModerationModule } from '@app/shared/shared-moderation'
6import { SharedShareModal } from '@app/shared/shared-share-modal' 6import { SharedShareModal } from '@app/shared/shared-share-modal'
7import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscription' 7import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscription'
8import { SharedVideoModule } from '@app/shared/shared-video'
8import { SharedVideoCommentModule } from '@app/shared/shared-video-comment' 9import { SharedVideoCommentModule } from '@app/shared/shared-video-comment'
9import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature' 10import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature'
10import { SharedVideoPlaylistModule } from '@app/shared/shared-video-playlist' 11import { SharedVideoPlaylistModule } from '@app/shared/shared-video-playlist'
@@ -32,7 +33,8 @@ import { VideoWatchComponent } from './video-watch.component'
32 SharedModerationModule, 33 SharedModerationModule,
33 SharedGlobalIconModule, 34 SharedGlobalIconModule,
34 SharedVideoCommentModule, 35 SharedVideoCommentModule,
35 SharedShareModal 36 SharedShareModal,
37 SharedVideoModule
36 ], 38 ],
37 39
38 declarations: [ 40 declarations: [
diff --git a/client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts b/client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts
index 08c8da3dd..3035bcfb3 100644
--- a/client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts
+++ b/client/src/app/shared/shared-video-miniature/shared-video-miniature.module.ts
@@ -4,6 +4,7 @@ import { SharedFormModule } from '../shared-forms'
4import { SharedGlobalIconModule } from '../shared-icons' 4import { SharedGlobalIconModule } from '../shared-icons'
5import { SharedMainModule } from '../shared-main/shared-main.module' 5import { SharedMainModule } from '../shared-main/shared-main.module'
6import { SharedModerationModule } from '../shared-moderation' 6import { SharedModerationModule } from '../shared-moderation'
7import { SharedVideoModule } from '../shared-video'
7import { SharedThumbnailModule } from '../shared-thumbnail' 8import { SharedThumbnailModule } from '../shared-thumbnail'
8import { SharedVideoLiveModule } from '../shared-video-live' 9import { SharedVideoLiveModule } from '../shared-video-live'
9import { SharedVideoPlaylistModule } from '../shared-video-playlist/shared-video-playlist.module' 10import { SharedVideoPlaylistModule } from '../shared-video-playlist/shared-video-playlist.module'
@@ -20,7 +21,8 @@ import { VideosSelectionComponent } from './videos-selection.component'
20 SharedVideoPlaylistModule, 21 SharedVideoPlaylistModule,
21 SharedThumbnailModule, 22 SharedThumbnailModule,
22 SharedGlobalIconModule, 23 SharedGlobalIconModule,
23 SharedVideoLiveModule 24 SharedVideoLiveModule,
25 SharedVideoModule
24 ], 26 ],
25 27
26 declarations: [ 28 declarations: [
diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.html b/client/src/app/shared/shared-video-miniature/video-miniature.component.html
index 395a4df97..7a6df7b64 100644
--- a/client/src/app/shared/shared-video-miniature/video-miniature.component.html
+++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.html
@@ -28,9 +28,8 @@
28 28
29 <span class="views" [title]="video.getExactNumberOfViews()"> 29 <span class="views" [title]="video.getExactNumberOfViews()">
30 <ng-container *ngIf="displayOptions.date && displayOptions.views"> • </ng-container> 30 <ng-container *ngIf="displayOptions.date && displayOptions.views"> • </ng-container>
31 <ng-container i18n *ngIf="displayOptions.views"> 31
32 {video.views, plural, =1 {1 view} other {{{ video.views | myNumberFormatter }} views}} 32 <my-video-views-counter *ngIf="displayOptions.views" [video]="video"></my-video-views-counter>
33 </ng-container>
34 </span> 33 </span>
35 </span> 34 </span>
36 35
diff --git a/client/src/app/shared/shared-video/index.ts b/client/src/app/shared/shared-video/index.ts
new file mode 100644
index 000000000..33a8b560f
--- /dev/null
+++ b/client/src/app/shared/shared-video/index.ts
@@ -0,0 +1 @@
export * from './shared-video.module'
diff --git a/client/src/app/shared/shared-video/shared-video.module.ts b/client/src/app/shared/shared-video/shared-video.module.ts
new file mode 100644
index 000000000..dfac4e357
--- /dev/null
+++ b/client/src/app/shared/shared-video/shared-video.module.ts
@@ -0,0 +1,19 @@
1
2import { NgModule } from '@angular/core'
3import { SharedMainModule } from '../shared-main/shared-main.module'
4import { VideoViewsCounterComponent } from './video-views-counter.component'
5
6@NgModule({
7 imports: [
8 SharedMainModule
9 ],
10
11 declarations: [
12 VideoViewsCounterComponent
13 ],
14
15 exports: [
16 VideoViewsCounterComponent
17 ]
18})
19export class SharedVideoModule { }
diff --git a/client/src/app/shared/shared-video/video-views-counter.component.html b/client/src/app/shared/shared-video/video-views-counter.component.html
new file mode 100644
index 000000000..a6679f74d
--- /dev/null
+++ b/client/src/app/shared/shared-video/video-views-counter.component.html
@@ -0,0 +1,9 @@
1<span [title]="video.getExactNumberOfViews()">
2 <ng-container i18n *ngIf="!video.isLive">
3 {video.views, plural, =1 {1 view} other {{{ video.views | myNumberFormatter }} views}}
4 </ng-container>
5
6 <ng-container i18n *ngIf="video.isLive">
7 {video.views, plural, =1 {1 viewer} other {{{ video.views | myNumberFormatter }} viewers}}
8 </ng-container>
9</span>
diff --git a/client/src/app/shared/shared-video/video-views-counter.component.scss b/client/src/app/shared/shared-video/video-views-counter.component.scss
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/client/src/app/shared/shared-video/video-views-counter.component.scss
diff --git a/client/src/app/shared/shared-video/video-views-counter.component.ts b/client/src/app/shared/shared-video/video-views-counter.component.ts
new file mode 100644
index 000000000..17e6e37b9
--- /dev/null
+++ b/client/src/app/shared/shared-video/video-views-counter.component.ts
@@ -0,0 +1,11 @@
1import { Component, Input } from '@angular/core'
2import { Video } from '../shared-main'
3
4@Component({
5 selector: 'my-video-views-counter',
6 styleUrls: [ './video-views-counter.component.scss' ],
7 templateUrl: './video-views-counter.component.html'
8})
9export class VideoViewsCounterComponent {
10 @Input() video: Video
11}