diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-30 09:49:45 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-30 09:49:45 +0200 |
commit | c894a1ea72fd1f16c9f1fc0dae14213b2937152d (patch) | |
tree | e99f5f064eecf82356637d92ec72b3debf1e9335 /client/src/app/+videos/+video-watch/shared | |
parent | 2453589a286e1f65843af582512387b2fa17b502 (diff) | |
download | PeerTube-c894a1ea72fd1f16c9f1fc0dae14213b2937152d.tar.gz PeerTube-c894a1ea72fd1f16c9f1fc0dae14213b2937152d.tar.zst PeerTube-c894a1ea72fd1f16c9f1fc0dae14213b2937152d.zip |
Move watch attributes in a dedicated component
Diffstat (limited to 'client/src/app/+videos/+video-watch/shared')
6 files changed, 124 insertions, 1 deletions
diff --git a/client/src/app/+videos/+video-watch/shared/information/video-alert.component.scss b/client/src/app/+videos/+video-watch/shared/information/video-alert.component.scss index 109c31c57..7b8a876ab 100644 --- a/client/src/app/+videos/+video-watch/shared/information/video-alert.component.scss +++ b/client/src/app/+videos/+video-watch/shared/information/video-alert.component.scss | |||
@@ -1,3 +1,6 @@ | |||
1 | @use '_variables' as *; | ||
2 | @use '_mixins' as *; | ||
3 | |||
1 | .alert { | 4 | .alert { |
2 | text-align: center; | 5 | text-align: center; |
3 | border-radius: 0; | 6 | border-radius: 0; |
diff --git a/client/src/app/+videos/+video-watch/shared/metadata/index.ts b/client/src/app/+videos/+video-watch/shared/metadata/index.ts index 7f7ee797b..de9abe97e 100644 --- a/client/src/app/+videos/+video-watch/shared/metadata/index.ts +++ b/client/src/app/+videos/+video-watch/shared/metadata/index.ts | |||
@@ -1,2 +1,3 @@ | |||
1 | export * from './video-attributes.component' | ||
1 | export * from './video-avatar-channel.component' | 2 | export * from './video-avatar-channel.component' |
2 | export * from './video-description.component' | 3 | export * from './video-description.component' |
diff --git a/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.html b/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.html new file mode 100644 index 000000000..598bc485d --- /dev/null +++ b/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.html | |||
@@ -0,0 +1,54 @@ | |||
1 | <div class="video-attribute"> | ||
2 | <span i18n class="video-attribute-label">Privacy</span> | ||
3 | <span class="video-attribute-value">{{ video.privacy.label }}</span> | ||
4 | </div> | ||
5 | |||
6 | <div *ngIf="video.isLocal === false" class="video-attribute"> | ||
7 | <span i18n class="video-attribute-label">Origin</span> | ||
8 | <a class="video-attribute-value" target="_blank" rel="noopener noreferrer" [href]="getVideoUrl()">{{ video.originInstanceHost }}</a> | ||
9 | </div> | ||
10 | |||
11 | <div *ngIf="!!video.originallyPublishedAt" class="video-attribute"> | ||
12 | <span i18n class="video-attribute-label">Originally published</span> | ||
13 | <span class="video-attribute-value">{{ video.originallyPublishedAt | date: 'dd MMMM yyyy' }}</span> | ||
14 | </div> | ||
15 | |||
16 | <div class="video-attribute"> | ||
17 | <span i18n class="video-attribute-label">Category</span> | ||
18 | <span *ngIf="!video.category.id" class="video-attribute-value">{{ video.category.label }}</span> | ||
19 | <a | ||
20 | *ngIf="video.category.id" class="video-attribute-value" | ||
21 | [routerLink]="[ '/search' ]" [queryParams]="{ categoryOneOf: [ video.category.id ] }" | ||
22 | >{{ video.category.label }}</a> | ||
23 | </div> | ||
24 | |||
25 | <div class="video-attribute"> | ||
26 | <span i18n class="video-attribute-label">Licence</span> | ||
27 | <span *ngIf="!video.licence.id" class="video-attribute-value">{{ video.licence.label }}</span> | ||
28 | <a | ||
29 | *ngIf="video.licence.id" class="video-attribute-value" | ||
30 | [routerLink]="[ '/search' ]" [queryParams]="{ licenceOneOf: [ video.licence.id ] }" | ||
31 | >{{ video.licence.label }}</a> | ||
32 | </div> | ||
33 | |||
34 | <div class="video-attribute"> | ||
35 | <span i18n class="video-attribute-label">Language</span> | ||
36 | <span *ngIf="!video.language.id" class="video-attribute-value">{{ video.language.label }}</span> | ||
37 | <a | ||
38 | *ngIf="video.language.id" class="video-attribute-value" | ||
39 | [routerLink]="[ '/search' ]" [queryParams]="{ languageOneOf: [ video.language.id ] }" | ||
40 | >{{ video.language.label }}</a> | ||
41 | </div> | ||
42 | |||
43 | <div class="video-attribute video-attribute-tags"> | ||
44 | <span i18n class="video-attribute-label">Tags</span> | ||
45 | <a | ||
46 | *ngFor="let tag of getVideoTags()" | ||
47 | class="video-attribute-value" [routerLink]="[ '/search' ]" [queryParams]="{ tagsOneOf: [ tag ] }" | ||
48 | >{{ tag }}</a> | ||
49 | </div> | ||
50 | |||
51 | <div class="video-attribute" *ngIf="!video.isLive"> | ||
52 | <span i18n class="video-attribute-label">Duration</span> | ||
53 | <span class="video-attribute-value">{{ video.duration | myDurationFormatter }}</span> | ||
54 | </div> | ||
diff --git a/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.scss b/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.scss new file mode 100644 index 000000000..45190a3e3 --- /dev/null +++ b/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.scss | |||
@@ -0,0 +1,40 @@ | |||
1 | @use '_variables' as *; | ||
2 | @use '_mixins' as *; | ||
3 | |||
4 | .video-attribute { | ||
5 | font-size: 13px; | ||
6 | display: block; | ||
7 | margin-bottom: 12px; | ||
8 | } | ||
9 | |||
10 | .video-attribute-label { | ||
11 | @include padding-right(5px); | ||
12 | |||
13 | min-width: 142px; | ||
14 | display: inline-block; | ||
15 | color: pvar(--greyForegroundColor); | ||
16 | font-weight: $font-bold; | ||
17 | } | ||
18 | |||
19 | a.video-attribute-value { | ||
20 | @include disable-default-a-behaviour; | ||
21 | color: pvar(--mainForegroundColor); | ||
22 | |||
23 | &:hover { | ||
24 | opacity: 0.9; | ||
25 | } | ||
26 | } | ||
27 | |||
28 | .video-attribute-tags { | ||
29 | .video-attribute-value:not(:nth-child(2)) { | ||
30 | &::before { | ||
31 | content: ', '; | ||
32 | } | ||
33 | } | ||
34 | } | ||
35 | |||
36 | @media screen and (max-width: 1600px) { | ||
37 | .video-attributes .video-attribute { | ||
38 | margin-bottom: 5px; | ||
39 | } | ||
40 | } | ||
diff --git a/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.ts b/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.ts new file mode 100644 index 000000000..5cb77f0c8 --- /dev/null +++ b/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.ts | |||
@@ -0,0 +1,25 @@ | |||
1 | import { Component, Input } from '@angular/core' | ||
2 | import { VideoDetails } from '@app/shared/shared-main' | ||
3 | |||
4 | @Component({ | ||
5 | selector: 'my-video-attributes', | ||
6 | templateUrl: './video-attributes.component.html', | ||
7 | styleUrls: [ './video-attributes.component.scss' ] | ||
8 | }) | ||
9 | export class VideoAttributesComponent { | ||
10 | @Input() video: VideoDetails | ||
11 | |||
12 | getVideoUrl () { | ||
13 | if (!this.video.url) { | ||
14 | return this.video.originInstanceUrl + VideoDetails.buildWatchUrl(this.video) | ||
15 | } | ||
16 | |||
17 | return this.video.url | ||
18 | } | ||
19 | |||
20 | getVideoTags () { | ||
21 | if (!this.video || Array.isArray(this.video.tags) === false) return [] | ||
22 | |||
23 | return this.video.tags | ||
24 | } | ||
25 | } | ||
diff --git a/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts b/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts index 0a4d6bfd1..8b3ed4964 100644 --- a/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts +++ b/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts | |||
@@ -130,7 +130,7 @@ export class VideoWatchPlaylistComponent { | |||
130 | 130 | ||
131 | setTimeout(() => { | 131 | setTimeout(() => { |
132 | document.querySelector('.element-' + this.currentPlaylistPosition).scrollIntoView(false) | 132 | document.querySelector('.element-' + this.currentPlaylistPosition).scrollIntoView(false) |
133 | }, 0) | 133 | }) |
134 | 134 | ||
135 | return | 135 | return |
136 | } | 136 | } |