Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix channel toggle for RTL

Chocobozzz6f0bd573d9ae
diff --git a/client/src/app/shared/shared-channels/channel-toggle.component.html b/client/src/app/shared/shared-channels/channel-toggle.component.html
index 8c50ac834c..bb1690c7f3 100644
--- a/client/src/app/shared/shared-channels/channel-toggle.component.html
+++ b/client/src/app/shared/shared-channels/channel-toggle.component.html
@@ -1,5 +1,5 @@
-<button class="root button-unstyle" [ngClass]="{ active: checked() }" [title]="label()" (click)="toggle()">
- <my-actor-avatar [actor]="channel()" actorType="channel" size="34"></my-actor-avatar>
+<button class="root button-unstyle" [class]="{ active: checked() }" [title]="label()" (click)="toggle()">
+ <my-actor-avatar [class]="{ 'is-rtl': isRTL() }" [actor]="channel()" actorType="channel" size="34"></my-actor-avatar>
<div class="info" [ngClass]="{ 'has-collaborator-state': user.isCollaboratingToChannels() }">
<div class="name">{{ channel().displayName }}</div>
diff --git a/client/src/app/shared/shared-channels/channel-toggle.component.scss b/client/src/app/shared/shared-channels/channel-toggle.component.scss
index 7429948246..3332c57c66 100644
--- a/client/src/app/shared/shared-channels/channel-toggle.component.scss
+++ b/client/src/app/shared/shared-channels/channel-toggle.component.scss
@@ -43,9 +43,16 @@
my-actor-avatar {
position: absolute;
- left: 0;
border: 2px solid pvar(--bg-secondary-400);
border-radius: $channel-avatar-radius;
+
+ &.is-rtl {
+ right: 0;
+ }
+
+ &:not(.is-rtl) {
+ left: 0;
+ }
}
.root.active {
diff --git a/client/src/app/shared/shared-channels/channel-toggle.component.ts b/client/src/app/shared/shared-channels/channel-toggle.component.ts
index 709ee17bb4..e8a0f229f1 100644
--- a/client/src/app/shared/shared-channels/channel-toggle.component.ts
+++ b/client/src/app/shared/shared-channels/channel-toggle.component.ts
@@ -1,5 +1,5 @@
-import { CommonModule } from '@angular/common'
-import { Component, forwardRef, inject, input, model } from '@angular/core'
+import { CommonModule, getLocaleDirection } from '@angular/common'
+import { Component, forwardRef, inject, input, LOCALE_ID, model } from '@angular/core'
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
import { AuthService } from '@app/core'
import { VideoChannel } from '@peertube/peertube-models'
@@ -26,6 +26,7 @@ import { CollaboratorStateComponent } from '../shared-main/channel/collaborator-
})
export class ChannelToggleComponent implements ControlValueAccessor {
private authService = inject(AuthService)
+ private localeId = inject(LOCALE_ID)
readonly checked = model(false)
readonly channel = input.required<VideoChannel>()
@@ -36,6 +37,10 @@ export class ChannelToggleComponent implements ControlValueAccessor {
return this.authService.getUser()
}
+ isRTL () {
+ return getLocaleDirection(this.localeId) === 'rtl'
+ }
+
propagateChange = (_: any) => {
// empty
}
diff --git a/client/src/sass/class-helpers/_custom-bootstrap-helpers.scss b/client/src/sass/class-helpers/_custom-bootstrap-helpers.scss
index c4f2285870..d93924f4b0 100644
--- a/client/src/sass/class-helpers/_custom-bootstrap-helpers.scss
+++ b/client/src/sass/class-helpers/_custom-bootstrap-helpers.scss
@@ -1,5 +1,5 @@
-@use '_variables' as *;
-@use '_mixins' as *;
+@use "_variables" as *;
+@use "_mixins" as *;
// Font sizes
@@ -27,7 +27,6 @@
// ---
-
.ms-0 {
@include margin-left(0 !important);
}