ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix RTL for video miniatures
Chocobozzze73409487165
diff --git a/client/src/app/shared/shared-thumbnail/video-thumbnail.component.html b/client/src/app/shared/shared-thumbnail/video-thumbnail.component.htmlindex b4a0484d8f..cd0169cc87 100644--- a/client/src/app/shared/shared-thumbnail/video-thumbnail.component.html+++ b/client/src/app/shared/shared-thumbnail/video-thumbnail.component.html@@ -1,24 +1,34 @@@if (videoHref()) {- <a [ariaLabel]="ariaLabel()" [href]="videoHref()" [target]="videoTarget()" class="video-thumbnail" tabindex="-1">+ <a [ariaLabel]="ariaLabel()" [href]="videoHref()" [target]="videoTarget()" class="video-thumbnail" [class]="{ 'is-rtl': isRTL() }" tabindex="-1"><ng-container *ngTemplateOutlet="aContent"></ng-container></a>} @else {- <a [ariaLabel]="ariaLabel()" [routerLink]="getVideoRouterLink()" [queryParams]="queryParams()" class="video-thumbnail" tabindex="-1">+ <a+ [ariaLabel]="ariaLabel()"+ [routerLink]="getVideoRouterLink()"+ [queryParams]="queryParams()"+ class="video-thumbnail"+ [class]="{ 'is-rtl': isRTL() }"+ tabindex="-1"+ ><ng-container *ngTemplateOutlet="aContent"></ng-container></a>}<ng-template #aContent>- <img alt="" [attr.src]="src" [srcset]="srcset" [sizes]="sizes()" [ngClass]="{ 'blur-filter': blur() }" />+ <img alt="" [attr.src]="src" [srcset]="srcset" [sizes]="sizes()" [ngClass]="{ 'blur-filter': blur() }" />@if (displayWatchLaterPlaylist()) {<div class="actions-overlay"><buttonclass="watch-icon-overlay button-unstyle"- placement="left" [ngbTooltip]="getWatchIconText()" container="body" #watchLaterTooltip="ngbTooltip"- (click)="onWatchLaterClick($event)" [attr.aria-label]="inWatchLaterPlaylist() ? removeFromWatchLaterText : addToWatchLaterText"- >-+ placement="left"+ [ngbTooltip]="getWatchIconText()"+ container="body"+ #watchLaterTooltip="ngbTooltip"+ (click)="onWatchLaterClick($event)"+ [attr.aria-label]="inWatchLaterPlaylist() ? removeFromWatchLaterText : addToWatchLaterText"+ >@if (inWatchLaterPlaylist()) {<my-global-icon iconName="tick"></my-global-icon>} @else {@@ -32,7 +42,7 @@<div class="label-overlay pt-badge badge-danger"><ng-content select="label-danger"></ng-content></div>@if (video().isLive) {- <div class="live-overlay" [ngClass]="{ 'live-streaming': isLiveStreaming(), 'ended-live': isEndedLive() }">+ <div class="live-overlay" [ngClass]="{ 'live-streaming': isLiveStreaming(), 'ended-live': isEndedLive() }">@if (isLiveStreaming()) {<ng-container i18n>LIVE</ng-container>} @else if (isEndedLive()) {diff --git a/client/src/app/shared/shared-thumbnail/video-thumbnail.component.scss b/client/src/app/shared/shared-thumbnail/video-thumbnail.component.scssindex a094913df5..1e90a5045c 100644--- a/client/src/app/shared/shared-thumbnail/video-thumbnail.component.scss+++ b/client/src/app/shared/shared-thumbnail/video-thumbnail.component.scss@@ -1,6 +1,6 @@-@use '_variables' as *;-@use '_mixins' as *;-@use '_miniature' as *;+@use "_variables" as *;+@use "_mixins" as *;+@use "_miniature" as *;.video-thumbnail {@include miniature-thumbnail;@@ -43,20 +43,21 @@.live-overlay {position: absolute;padding: 2px 8px;- right: 0;- bottom: 0;border-top-left-radius: 4px;++ bottom: 0;+ // right property is defined below}.live-overlay {font-weight: $font-bold;- color: #F4F4F5;+ color: #f4f4f5;&.live-streaming {- color: #F4F4F5;+ color: #f4f4f5;&::before {- content: '';+ content: "";display: inline-block;width: 6px;height: 6px;@@ -74,12 +75,12 @@position: absolute;display: flex;flex-direction: column;- right: 5px;- top: 5px;opacity: 0;-font-weight: $font-semibold;+ top: 5px;+ // right property is defined below+div:not(:first-child) {margin-top: 2px;}@@ -93,6 +94,28 @@width: 22px;height: 22px;- color: #F4F4F5;+ color: #f4f4f5;+ }+}++.video-thumbnail.is-rtl {+ .duration-overlay,+ .live-overlay {+ left: 0;+ }++ .actions-overlay {+ left: 5px;+ }+}++.video-thumbnail:not(.is-rtl) {+ .duration-overlay,+ .live-overlay {+ right: 0;+ }++ .actions-overlay {+ right: 5px;}}diff --git a/client/src/app/shared/shared-thumbnail/video-thumbnail.component.ts b/client/src/app/shared/shared-thumbnail/video-thumbnail.component.tsindex a1c632d2ee..fc10d4641f 100644--- a/client/src/app/shared/shared-thumbnail/video-thumbnail.component.ts+++ b/client/src/app/shared/shared-thumbnail/video-thumbnail.component.ts@@ -1,5 +1,5 @@-import { CommonModule } from '@angular/common'-import { booleanAttribute, Component, input, OnChanges, output, viewChild } from '@angular/core'+import { CommonModule, getLocaleDirection } from '@angular/common'+import { booleanAttribute, Component, inject, input, LOCALE_ID, OnChanges, output, viewChild } from '@angular/core'import { RouterLink } from '@angular/router'import { NgbTooltip } from '@ng-bootstrap/ng-bootstrap'import { Video as VideoServerModel, VideoState } from '@peertube/peertube-models'@@ -28,6 +28,8 @@ export type VideoThumbnailInput = Pick<imports: [ CommonModule, RouterLink, NgbTooltip, GlobalIconComponent, FromNowPipe ]})export class VideoThumbnailComponent implements OnChanges {+ private localeId = inject(LOCALE_ID)+readonly video = input.required<VideoThumbnailInput>()readonly sizes = input.required<string>()@@ -76,6 +78,10 @@ export class VideoThumbnailComponent implements OnChanges {.join(', ')}+ isRTL () {+ return getLocaleDirection(this.localeId) === 'rtl'+ }+getWatchIconText () {if (this.inWatchLaterPlaylist()) return this.removeFromWatchLaterText