1
0
Fork 0

Redirect to search page for origin instance

This commit is contained in:
Chocobozzz 2021-07-29 15:35:41 +02:00
parent af7fd04a67
commit 7e8f19603b
No known key found for this signature in database
GPG key ID: 583A612D890159BE
3 changed files with 55 additions and 37 deletions

View file

@ -1,54 +1,62 @@
<div class="video-attribute"> <div class="attribute">
<span i18n class="video-attribute-label">Privacy</span> <span i18n class="attribute-label">Privacy</span>
<span class="video-attribute-value">{{ video.privacy.label }}</span> <span class="attribute-value">{{ video.privacy.label }}</span>
</div> </div>
<div *ngIf="video.isLocal === false" class="video-attribute"> <div *ngIf="video.isLocal === false" class="attribute">
<span i18n class="video-attribute-label">Origin</span> <span i18n class="attribute-label">Origin</span>
<a class="video-attribute-value" target="_blank" rel="noopener noreferrer" [href]="getVideoUrl()">{{ video.originInstanceHost }}</a>
</div>
<div *ngIf="!!video.originallyPublishedAt" class="video-attribute">
<span i18n class="video-attribute-label">Originally published</span>
<span class="video-attribute-value">{{ video.originallyPublishedAt | date: 'dd MMMM yyyy' }}</span>
</div>
<div class="video-attribute">
<span i18n class="video-attribute-label">Category</span>
<span *ngIf="!video.category.id" class="video-attribute-value">{{ video.category.label }}</span>
<a <a
*ngIf="video.category.id" class="video-attribute-value" class="attribute-value" target="_blank" rel="noopener noreferrer"
routerLink="/search" [queryParams]="{ host: getVideoHost() }"
>{{ video.originInstanceHost }}</a>
<a
i18n-title title="Open the video on the origin instance" class="glyphicon glyphicon-new-window"
target="_blank" rel="noopener noreferrer" [href]="getVideoUrl()"
></a>
</div>
<div *ngIf="!!video.originallyPublishedAt" class="attribute">
<span i18n class="attribute-label">Originally published</span>
<span class="attribute-value">{{ video.originallyPublishedAt | date: 'dd MMMM yyyy' }}</span>
</div>
<div class="attribute">
<span i18n class="attribute-label">Category</span>
<span *ngIf="!video.category.id" class="attribute-value">{{ video.category.label }}</span>
<a
*ngIf="video.category.id" class="attribute-value"
[routerLink]="[ '/search' ]" [queryParams]="{ categoryOneOf: [ video.category.id ] }" [routerLink]="[ '/search' ]" [queryParams]="{ categoryOneOf: [ video.category.id ] }"
>{{ video.category.label }}</a> >{{ video.category.label }}</a>
</div> </div>
<div class="video-attribute"> <div class="attribute">
<span i18n class="video-attribute-label">Licence</span> <span i18n class="attribute-label">Licence</span>
<span *ngIf="!video.licence.id" class="video-attribute-value">{{ video.licence.label }}</span> <span *ngIf="!video.licence.id" class="attribute-value">{{ video.licence.label }}</span>
<a <a
*ngIf="video.licence.id" class="video-attribute-value" *ngIf="video.licence.id" class="attribute-value"
[routerLink]="[ '/search' ]" [queryParams]="{ licenceOneOf: [ video.licence.id ] }" [routerLink]="[ '/search' ]" [queryParams]="{ licenceOneOf: [ video.licence.id ] }"
>{{ video.licence.label }}</a> >{{ video.licence.label }}</a>
</div> </div>
<div class="video-attribute"> <div class="attribute">
<span i18n class="video-attribute-label">Language</span> <span i18n class="attribute-label">Language</span>
<span *ngIf="!video.language.id" class="video-attribute-value">{{ video.language.label }}</span> <span *ngIf="!video.language.id" class="attribute-value">{{ video.language.label }}</span>
<a <a
*ngIf="video.language.id" class="video-attribute-value" *ngIf="video.language.id" class="attribute-value"
[routerLink]="[ '/search' ]" [queryParams]="{ languageOneOf: [ video.language.id ] }" [routerLink]="[ '/search' ]" [queryParams]="{ languageOneOf: [ video.language.id ] }"
>{{ video.language.label }}</a> >{{ video.language.label }}</a>
</div> </div>
<div class="video-attribute video-attribute-tags"> <div class="attribute attribute-tags">
<span i18n class="video-attribute-label">Tags</span> <span i18n class="attribute-label">Tags</span>
<a <a
*ngFor="let tag of getVideoTags()" *ngFor="let tag of getVideoTags()"
class="video-attribute-value" [routerLink]="[ '/search' ]" [queryParams]="{ tagsOneOf: [ tag ] }" class="attribute-value" [routerLink]="[ '/search' ]" [queryParams]="{ tagsOneOf: [ tag ] }"
>{{ tag }}</a> >{{ tag }}</a>
</div> </div>
<div class="video-attribute" *ngIf="!video.isLive"> <div class="attribute" *ngIf="!video.isLive">
<span i18n class="video-attribute-label">Duration</span> <span i18n class="attribute-label">Duration</span>
<span class="video-attribute-value">{{ video.duration | myDurationFormatter }}</span> <span class="attribute-value">{{ video.duration | myDurationFormatter }}</span>
</div> </div>

View file

@ -1,13 +1,13 @@
@use '_variables' as *; @use '_variables' as *;
@use '_mixins' as *; @use '_mixins' as *;
.video-attribute { .attribute {
font-size: 13px; font-size: 13px;
display: block; display: block;
margin-bottom: 12px; margin-bottom: 12px;
} }
.video-attribute-label { .attribute-label {
@include padding-right(5px); @include padding-right(5px);
min-width: 142px; min-width: 142px;
@ -16,7 +16,7 @@
font-weight: $font-bold; font-weight: $font-bold;
} }
a.video-attribute-value { a.attribute-value {
@include disable-default-a-behaviour; @include disable-default-a-behaviour;
color: pvar(--mainForegroundColor); color: pvar(--mainForegroundColor);
@ -25,16 +25,22 @@ a.video-attribute-value {
} }
} }
.video-attribute-tags { .attribute-tags {
.video-attribute-value:not(:nth-child(2)) { .attribute-value:not(:nth-child(2)) {
&::before { &::before {
content: ', '; content: ', ';
} }
} }
} }
.glyphicon-new-window {
color: pvar(--inputPlaceholderColor);
margin-left: 5px;
font-size: 12px;
}
@media screen and (max-width: 1600px) { @media screen and (max-width: 1600px) {
.video-attributes .video-attribute { .attributes .attribute {
margin-bottom: 5px; margin-bottom: 5px;
} }
} }

View file

@ -17,6 +17,10 @@ export class VideoAttributesComponent {
return this.video.url return this.video.url
} }
getVideoHost () {
return this.video.channel.host
}
getVideoTags () { getVideoTags () {
if (!this.video || Array.isArray(this.video.tags) === false) return [] if (!this.video || Array.isArray(this.video.tags) === false) return []