Experiment longer captions for no-content single-media post

pull/441/head
Lim Chee Aun 2024-02-29 13:25:30 +08:00
rodzic bb3621e424
commit 69d77c368e
2 zmienionych plików z 11 dodań i 1 usunięć

Wyświetl plik

@ -54,6 +54,7 @@ const AltBadge = (props) => {
};
const MEDIA_CAPTION_LIMIT = 140;
const MEDIA_CAPTION_LIMIT_LONGER = 280;
export const isMediaCaptionLong = mem((caption) =>
caption?.length
? caption.length > MEDIA_CAPTION_LIMIT ||
@ -69,6 +70,7 @@ function Media({
showOriginal,
autoAnimate,
showCaption,
allowLongerCaption,
altIndex,
onClick = () => {},
}) {
@ -198,8 +200,15 @@ function Media({
};
const longDesc = isMediaCaptionLong(description);
const showInlineDesc =
let showInlineDesc =
!!showCaption && !showOriginal && !!description && !longDesc;
if (
allowLongerCaption &&
!showInlineDesc &&
description?.length <= MEDIA_CAPTION_LIMIT_LONGER
) {
showInlineDesc = true;
}
const Figure = !showInlineDesc
? Fragment
: (props) => {

Wyświetl plik

@ -1783,6 +1783,7 @@ function Status({
media={media}
autoAnimate={isSizeLarge}
showCaption={mediaAttachments.length === 1}
allowLongerCaption={!content}
lang={language}
altIndex={
showMultipleMediaCaptions &&