mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-10 16:08:52 +01:00
Fix typo and logic
This commit is contained in:
parent
58bf8e16c2
commit
5502d08d28
1 changed files with 15 additions and 6 deletions
|
@ -57,7 +57,7 @@ import MenuLink from './menu-link';
|
||||||
import RelativeTime from './relative-time';
|
import RelativeTime from './relative-time';
|
||||||
import TranslationBlock from './translation-block';
|
import TranslationBlock from './translation-block';
|
||||||
|
|
||||||
const INLINE_TRASNSLATE_LIMIT = 140;
|
const INLINE_TRANSLATE_LIMIT = 140;
|
||||||
const throttle = pThrottle({
|
const throttle = pThrottle({
|
||||||
limit: 1,
|
limit: 1,
|
||||||
interval: 1000,
|
interval: 1000,
|
||||||
|
@ -254,13 +254,24 @@ function Status({
|
||||||
if (!snapStates.settings.contentTranslation) enableTranslate = false;
|
if (!snapStates.settings.contentTranslation) enableTranslate = false;
|
||||||
const inlineTranslate = useMemo(() => {
|
const inlineTranslate = useMemo(() => {
|
||||||
return (
|
return (
|
||||||
|
!readOnly &&
|
||||||
|
!previewMode &&
|
||||||
|
!withinContext &&
|
||||||
!spoilerText &&
|
!spoilerText &&
|
||||||
!poll &&
|
!poll &&
|
||||||
!mediaAttachments?.length &&
|
!mediaAttachments?.length &&
|
||||||
content?.length > 0 &&
|
content?.length > 0 &&
|
||||||
content?.length <= INLINE_TRASNSLATE_LIMIT
|
content?.length <= INLINE_TRANSLATE_LIMIT
|
||||||
);
|
);
|
||||||
}, [isSizeLarge, content, spoilerText, poll, mediaAttachments]);
|
}, [
|
||||||
|
readOnly,
|
||||||
|
previewMode,
|
||||||
|
withinContext,
|
||||||
|
spoilerText,
|
||||||
|
poll,
|
||||||
|
mediaAttachments,
|
||||||
|
content,
|
||||||
|
]);
|
||||||
|
|
||||||
const [showEdited, setShowEdited] = useState(false);
|
const [showEdited, setShowEdited] = useState(false);
|
||||||
const [showReactions, setShowReactions] = useState(false);
|
const [showReactions, setShowReactions] = useState(false);
|
||||||
|
@ -1103,9 +1114,7 @@ function Status({
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{(((enableTranslate || inlineTranslate) &&
|
{((enableTranslate && !!content.trim() && differentLanguage) ||
|
||||||
!!content.trim() &&
|
|
||||||
differentLanguage) ||
|
|
||||||
forceTranslate) && (
|
forceTranslate) && (
|
||||||
<TranslationBlock
|
<TranslationBlock
|
||||||
forceTranslate={forceTranslate || inlineTranslate}
|
forceTranslate={forceTranslate || inlineTranslate}
|
||||||
|
|
Loading…
Reference in a new issue