From 6a6cb4658116d8ae8dcff8a22b28d8383ef588ee Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Tue, 3 Mar 2026 11:31:31 +0200 Subject: [PATCH] Fix translate hitslop by using Buttons --- src/components/Post/Translated/index.tsx | 36 ++++++++++------- .../components/ThreadItemAnchor.tsx | 39 ++++++++++--------- 2 files changed, 43 insertions(+), 32 deletions(-) diff --git a/src/components/Post/Translated/index.tsx b/src/components/Post/Translated/index.tsx index 68176577a0..07dc656910 100644 --- a/src/components/Post/Translated/index.tsx +++ b/src/components/Post/Translated/index.tsx @@ -4,10 +4,12 @@ import {msg} from '@lingui/core/macro' import {useLingui} from '@lingui/react' import {Trans} from '@lingui/react/macro' +import {HITSLOP_30} from '#/lib/constants' import {codeToLanguageName, languageName} from '#/locale/helpers' import {LANGUAGES} from '#/locale/languages' import {useLanguagePrefs} from '#/state/preferences' import {atoms as a, useTheme} from '#/alf' +import {Button} from '#/components/Button' import {Loader} from '#/components/Loader' import * as Select from '#/components/Select' import {Text} from '#/components/Typography' @@ -71,25 +73,27 @@ function TranslationResult({ return ( - - {langName ? ( - Translated from {langName} - ) : ( - Translated - )} + + + {langName ? ( + Translated from {langName} + ) : ( + Translated + )} + {sourceLanguage != null && ( <> {' '} - · - {' '} + ·{' '} + )} - + {translatedText} @@ -143,12 +147,18 @@ function TranslationLanguageSelect({ - + {({props}) => { return ( - - Change - + ) }} diff --git a/src/screens/PostThread/components/ThreadItemAnchor.tsx b/src/screens/PostThread/components/ThreadItemAnchor.tsx index 38a339f540..2167269c77 100644 --- a/src/screens/PostThread/components/ThreadItemAnchor.tsx +++ b/src/screens/PostThread/components/ThreadItemAnchor.tsx @@ -9,16 +9,13 @@ import { } from '@atproto/api' import {Plural, Trans, useLingui} from '@lingui/react/macro' +import {HITSLOP_30} from '#/lib/constants' import {useOpenComposer} from '#/lib/hooks/useOpenComposer' import {makeProfileLink} from '#/lib/routes/links' import {sanitizeDisplayName} from '#/lib/strings/display-names' import {sanitizeHandle} from '#/lib/strings/handles' import {niceDate} from '#/lib/strings/time' -import { - getPostLanguage, - getTranslatorLink, - isPostInLanguage, -} from '#/locale/helpers' +import {getPostLanguage, isPostInLanguage} from '#/locale/helpers' import { POST_TOMBSTONE, type Shadow, @@ -39,12 +36,12 @@ import { OUTER_SPACE, REPLY_LINE_WIDTH, } from '#/screens/PostThread/const' -import {atoms as a, useTheme} from '#/alf' +import {atoms as a, native, useTheme} from '#/alf' import {Button} from '#/components/Button' import {DebugFieldDisplay} from '#/components/DebugFieldDisplay' import {CalendarClock_Stroke2_Corner0_Rounded as CalendarClockIcon} from '#/components/icons/CalendarClock' import {Trash_Stroke2_Corner0_Rounded as TrashIcon} from '#/components/icons/Trash' -import {InlineLinkText, Link} from '#/components/Link' +import {Link} from '#/components/Link' import {Loader} from '#/components/Loader' import {ContentHider} from '#/components/moderation/ContentHider' import {LabelsOnMyPost} from '#/components/moderation/LabelsOnMe' @@ -627,21 +624,25 @@ function TranslateLink({ ) : translationState.status === 'success' ? ( - - Hide translation - + onPress={onHideTranslation} + hoverStyle={native({opacity: 0.5})} + hitSlop={HITSLOP_30}> + + Hide translation + + ) : ( - - Translate - + onPress={onTranslatePress} + hoverStyle={native({opacity: 0.5})} + hitSlop={HITSLOP_30}> + + Translate + + )} )