From 27bc95867442c772841fb183a625bbda61dede51 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 7 Jun 2021 17:38:31 +0200 Subject: Bidi support --- .../comment/video-comment-add.component.html | 5 ++- .../comment/video-comment-add.component.scss | 15 +++++-- .../comment/video-comment-add.component.ts | 22 +++++++++- .../comment/video-comment.component.scss | 24 +++++----- .../comment/video-comments.component.scss | 10 +++-- .../recommended-videos.component.scss | 9 ++-- .../video-avatar-channel.component.scss | 2 +- .../video-watch-playlist.component.scss | 6 +-- .../+video-watch/video-watch.component.scss | 51 ++++++++++++++-------- 9 files changed, 97 insertions(+), 47 deletions(-) (limited to 'client/src/app/+videos/+video-watch') diff --git a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.html b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.html index 42adfed8d..3ee818c8b 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.html +++ b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.html @@ -10,7 +10,10 @@ (keyup.control.enter)="onValidKey()" (keyup.meta.enter)="onValidKey()" #textarea> - + Markdown compatible that supports: diff --git a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.scss b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.scss index 7743bd41d..5c97fb13c 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.scss +++ b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.scss @@ -14,7 +14,7 @@ form { margin-bottom: 10px; my-actor-avatar { - margin-right: 10px; + @include margin-right(10px); } .form-group { @@ -26,12 +26,12 @@ form { textarea { @include peertube-textarea(100%, $peertube-textarea-height); @include button-focus(pvar(--mainColorLightest)); + @include padding-right($markdown-icon-width + 15px !important); min-height: calc(#{$peertube-textarea-height} - 15px * 2); - padding-right: $markdown-icon-width + 15px !important; @media screen and (max-width: 600px) { - padding-right: $markdown-icon-width + 19px !important; + @include padding-right($markdown-icon-width + 19px !important); } &:focus::placeholder { @@ -45,6 +45,12 @@ form { top: 5px; right: 9px; + // inset-inline is not well supported by web browsers + &.is-rtl { + right: unset; + left: 9px; + } + ::ng-deep .help-tooltip-button { my-global-icon { height: $markdown-icon-height; @@ -86,9 +92,10 @@ form { flex: 1; code { + @include margin-left(5px); + display: inline-block; vertical-align: middle; - margin-left: 5px; } } } diff --git a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts index 0e1362ad3..c926d8d70 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts +++ b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts @@ -1,5 +1,18 @@ import { Observable } from 'rxjs' -import { Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core' +import { getLocaleDirection } from '@angular/common' +import { + Component, + ElementRef, + EventEmitter, + Inject, + Input, + LOCALE_ID, + OnChanges, + OnInit, + Output, + SimpleChanges, + ViewChild +} from '@angular/core' import { Router } from '@angular/router' import { Notifier, User } from '@app/core' import { VIDEO_COMMENT_TEXT_VALIDATOR } from '@app/shared/form-validators/video-comment-validators' @@ -37,7 +50,8 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges, private notifier: Notifier, private videoCommentService: VideoCommentService, private modalService: NgbModal, - private router: Router + private router: Router, + @Inject(LOCALE_ID) private localeId: string ) { super() } @@ -153,6 +167,10 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges, this.form.value['text'] = this.textareaElement.nativeElement.value = '' } + isRTL () { + return getLocaleDirection(this.localeId) === 'rtl' + } + private addCommentReply (commentCreate: VideoCommentCreate) { return this.videoCommentService .addCommentReply(this.video.id, this.parentComment.id, commentCreate) diff --git a/client/src/app/+videos/+video-watch/comment/video-comment.component.scss b/client/src/app/+videos/+video-watch/comment/video-comment.component.scss index a4d2e237c..7868991ba 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comment.component.scss +++ b/client/src/app/+videos/+video-watch/comment/video-comment.component.scss @@ -6,10 +6,11 @@ display: flex; .left { + @include margin-right(10px); + display: flex; flex-direction: column; align-items: center; - margin-right: 10px; .vertical-border { width: 2px; @@ -51,6 +52,9 @@ my-actor-avatar { } .video-author { + @include padding-right(6px); + @include padding-left(6px); + height: 20px; background-color: #888888; border-radius: 12px; @@ -60,8 +64,6 @@ my-actor-avatar { flex-direction: row; align-items: center; display: inline-flex; - padding-right: 6px; - padding-left: 6px; color: #fff !important; } @@ -86,9 +88,10 @@ my-actor-avatar { } .comment-date { + @include margin-left(5px); + font-size: 90%; color: pvar(--greyForegroundColor); - margin-left: 5px; text-decoration: none; &:hover { @@ -129,9 +132,10 @@ my-actor-avatar { ::ng-deep .dropdown-toggle, .comment-action-reply { + @include margin-right(10px); + color: pvar(--greyForegroundColor); cursor: pointer; - margin-right: 10px; &:hover, &:active, @@ -162,25 +166,25 @@ my-video-comment-add { } .left { - margin-right: 6px; + @include margin-right(6px); } } @media screen and (max-width: 1200px) { .children { - margin-left: -10px; + @include margin-left(-10px); } } @media screen and (max-width: 600px) { .children { - margin-left: -20px; + @include margin-left(-20px); .left { align-items: flex-start; .vertical-border { - margin-left: 2px; + @include margin-left(2px); } } } @@ -189,7 +193,7 @@ my-video-comment-add { flex-direction: column; .comment-date { - margin-left: 0; + @include margin-left(0); } } } diff --git a/client/src/app/+videos/+video-watch/comment/video-comments.component.scss b/client/src/app/+videos/+video-watch/comment/video-comments.component.scss index a7e858069..29a00ee3f 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comments.component.scss +++ b/client/src/app/+videos/+video-watch/comment/video-comments.component.scss @@ -13,19 +13,21 @@ .glyphicon, .comment-thread-loading { - margin-right: 5px; + @include margin-right(5px); + display: inline-block; font-size: 13px; } .title-block { .title-page { - margin-right: 0; + @include margin-right(0); } my-feed { + @include margin-left(5px); + display: inline-block; - margin-left: 5px; opacity: 0; transition: ease-in .2s opacity; width: 12px; @@ -47,7 +49,7 @@ @media screen and (max-width: 600px) { .view-replies { - margin-left: 46px; + @include margin-left(46px); } } diff --git a/client/src/app/+videos/+video-watch/recommendations/recommended-videos.component.scss b/client/src/app/+videos/+video-watch/recommendations/recommended-videos.component.scss index 5e0373afc..89d44c067 100644 --- a/client/src/app/+videos/+video-watch/recommendations/recommended-videos.component.scss +++ b/client/src/app/+videos/+video-watch/recommendations/recommended-videos.component.scss @@ -10,8 +10,9 @@ .title-page.active, .title-page.title-page-single { + @include margin-right(.5rem !important); + margin-bottom: unset; - margin-right: .5rem !important; } } @@ -20,14 +21,16 @@ } .title-page-autoplay { + @include margin-left(auto); + display: flex; width: max-content; height: max-content; align-items: center; - margin-left: auto; span { - margin-right: 0.3rem; + @include margin-right(0.3rem); + text-transform: uppercase; font-size: 85%; font-weight: 600; diff --git a/client/src/app/+videos/+video-watch/video-avatar-channel.component.scss b/client/src/app/+videos/+video-watch/video-avatar-channel.component.scss index 20e32240c..f269398cb 100644 --- a/client/src/app/+videos/+video-watch/video-avatar-channel.component.scss +++ b/client/src/app/+videos/+video-watch/video-avatar-channel.component.scss @@ -15,9 +15,9 @@ .wrapper { @include actor-avatar-size(35px); + @include margin-right(5px); position: relative; - margin-right: 5px; margin-bottom: 5px; &.generic-channel { diff --git a/client/src/app/+videos/+video-watch/video-watch-playlist.component.scss b/client/src/app/+videos/+video-watch/video-watch-playlist.component.scss index b3f93b83c..d1a0f97f7 100644 --- a/client/src/app/+videos/+video-watch/video-watch-playlist.component.scss +++ b/client/src/app/+videos/+video-watch/video-watch-playlist.component.scss @@ -26,7 +26,7 @@ display: flex; .playlist-by { - margin-right: 5px; + @include margin-right(5px); } .playlist-index span:first-child::after { @@ -40,7 +40,7 @@ margin: 10px 0; my-global-icon:not(:last-child) { - margin-right: .5rem; + @include margin-right(.5rem); } my-global-icon { @@ -59,7 +59,7 @@ ::ng-deep { .video { .position { - margin-right: 0; + @include margin-right(0); } .video-info { diff --git a/client/src/app/+videos/+video-watch/video-watch.component.scss b/client/src/app/+videos/+video-watch/video-watch.component.scss index af807a208..4a2e05c62 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.scss +++ b/client/src/app/+videos/+video-watch/video-watch.component.scss @@ -152,7 +152,7 @@ $video-info-margin-left: 44px; .video-info-name { @include peertube-word-wrap; - margin-right: 30px; + @include margin-right(30px); min-height: 40px; // Align with the action buttons font-size: 27px; font-weight: $font-semibold; @@ -167,9 +167,10 @@ $video-info-margin-left: 44px; } .video-info-date-views { - align-self: start; + @include margin-right(10px); + margin-bottom: 10px; - margin-right: 10px; + align-self: start; font-size: 1em; } @@ -209,15 +210,19 @@ $video-info-margin-left: 44px; } my-subscribe-button { - margin-left: 5px; + @include margin-left(5px); } } .video-actions-rates { - margin: 0 0 10px; + @include margin-left(auto); + @include margin-right(0); + + margin-top: 0; + margin-bottom: 10px; + align-items: start; width: max-content; - margin-left: auto; .video-actions { height: 40px; // Align with the title @@ -227,7 +232,7 @@ $video-info-margin-left: 44px; .action-button:not(:first-child), .action-dropdown, my-video-actions-dropdown { - margin-left: 5px; + @include margin-left(5px); } ::ng-deep.action-button { @@ -305,7 +310,7 @@ $video-info-margin-left: 44px; } .icon-text { - margin-left: 3px; + @include margin-left(3px); } } } @@ -341,8 +346,11 @@ $video-info-margin-left: 44px; } .video-info-description { - margin: 20px 0; - margin-left: $video-info-margin-left; + @include margin-left($video-info-margin-left); + @include margin-right(0); + + margin-top: 20px; + margin-bottom: 20px; font-size: 15px; .video-info-description-html { @@ -355,7 +363,7 @@ $video-info-margin-left: 44px; .glyphicon, .description-loading { - margin-left: 3px; + @include margin-left(3px); } .description-loading { @@ -376,7 +384,7 @@ $video-info-margin-left: 44px; } .video-attributes { - margin-left: $video-info-margin-left; + @include margin-left($video-info-margin-left); } .video-attributes .video-attribute { @@ -385,8 +393,9 @@ $video-info-margin-left: 44px; margin-bottom: 12px; .video-attribute-label { + @include padding-right(5px); + min-width: 142px; - padding-right: 5px; display: inline-block; color: pvar(--greyForegroundColor); font-weight: $font-bold; @@ -413,8 +422,9 @@ $video-info-margin-left: 44px; } my-recommended-videos { + @include padding-left(15px); + display: block; - padding-left: 15px; min-width: 250px; } @@ -432,14 +442,15 @@ my-video-comments { @media screen and (max-width: $small-view) { .privacy-concerns { - margin-left: $menu-width - 15px; // Menu is absolute + @include margin-left($menu-width - 15px); // Menu is absolute } } :host-context(.expanded) { .privacy-concerns { + @include margin-left(-15px); + width: 100%; - margin-left: -15px; } } @@ -473,8 +484,9 @@ my-video-comments { } .privacy-concerns-button { + @include margin-left(auto); + padding: 5px 8px 5px 7px; - margin-left: auto; border-radius: 3px; white-space: nowrap; cursor: pointer; @@ -487,8 +499,9 @@ my-video-comments { } .privacy-concerns-okay { + @include margin-left(10px); + background-color: pvar(--mainColor); - margin-left: 10px; } } @@ -525,7 +538,7 @@ my-video-comments { } my-recommended-videos { - padding-left: 0; + @include padding-left(0); } } -- cgit v1.2.3