From 4dd706ff96c34f53904b0dd609d0097f8d71ae6d Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sat, 30 Sep 2023 23:23:34 +0800 Subject: [PATCH] Pass lang into media description - Assume status lang applies to media description - Allow RTL for media description --- src/components/media-alt-modal.jsx | 4 ++-- src/components/media-modal.jsx | 15 +++++++++++---- src/components/media.jsx | 31 +++++++++++++++++++++++------- src/components/modals.jsx | 3 ++- src/components/status.jsx | 1 + src/pages/status.jsx | 1 + 6 files changed, 41 insertions(+), 14 deletions(-) diff --git a/src/components/media-alt-modal.jsx b/src/components/media-alt-modal.jsx index 95745764..09f94db4 100644 --- a/src/components/media-alt-modal.jsx +++ b/src/components/media-alt-modal.jsx @@ -4,7 +4,7 @@ import { useState } from 'preact/hooks'; import Icon from './icon'; import TranslationBlock from './translation-block'; -export default function MediaAltModal({ alt, onClose }) { +export default function MediaAltModal({ alt, lang, onClose }) { const [forceTranslate, setForceTranslate] = useState(false); return (
@@ -36,7 +36,7 @@ export default function MediaAltModal({ alt, onClose }) {
-
+

{}, }) { @@ -138,14 +139,19 @@ function MediaModal({ class="media-alt" hidden={!showControls} onClick={() => { - setShowMediaAlt(media.description); + setShowMediaAlt({ + alt: media.description, + lang, + }); }} > ALT - {media.description} + + {media.description} + )} - + ); })} @@ -279,7 +285,8 @@ function MediaModal({ }} > setShowMediaAlt(false)} /> diff --git a/src/components/media.jsx b/src/components/media.jsx index 37c4b7fc..2ba4985c 100644 --- a/src/components/media.jsx +++ b/src/components/media.jsx @@ -29,7 +29,7 @@ audio = Audio track const dataAltLabel = 'ALT'; const AltBadge = (props) => { - const { alt, ...rest } = props; + const { alt, lang, ...rest } = props; if (!alt || !alt.trim()) return null; return (