diff options
author | Chocobozzz <me@florianbigard.com> | 2020-12-09 15:00:02 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-12-09 15:33:16 +0100 |
commit | 5cac83a78d6ba5212755fafce2ed25f7c74b04e5 (patch) | |
tree | c0aa6473f7837fdb15f1dc2c814e7efa02d78c19 /client/src/app/shared/shared-video | |
parent | 0d8de2756fdc43be61a82a96c17d12ee52ba0143 (diff) | |
download | PeerTube-5cac83a78d6ba5212755fafce2ed25f7c74b04e5.tar.gz PeerTube-5cac83a78d6ba5212755fafce2ed25f7c74b04e5.tar.zst PeerTube-5cac83a78d6ba5212755fafce2ed25f7c74b04e5.zip |
Refactor views component
Diffstat (limited to 'client/src/app/shared/shared-video')
5 files changed, 40 insertions, 0 deletions
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 | |||
2 | import { NgModule } from '@angular/core' | ||
3 | import { SharedMainModule } from '../shared-main/shared-main.module' | ||
4 | import { 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 | }) | ||
19 | export 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 @@ | |||
1 | import { Component, Input } from '@angular/core' | ||
2 | import { 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 | }) | ||
9 | export class VideoViewsCounterComponent { | ||
10 | @Input() video: Video | ||
11 | } | ||