From 25011cac0a30968dc18c0dbdbc89c52ca3fbe6f1 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Tue, 10 Jun 2025 15:23:54 -0500 Subject: [PATCH] Rename --- ...{ThreadAnchor.tsx => ThreadItemAnchor.tsx} | 30 +++++++++---------- src/screens/PostThread/index.tsx | 12 ++++---- 2 files changed, 21 insertions(+), 21 deletions(-) rename src/screens/PostThread/components/{ThreadAnchor.tsx => ThreadItemAnchor.tsx} (96%) diff --git a/src/screens/PostThread/components/ThreadAnchor.tsx b/src/screens/PostThread/components/ThreadItemAnchor.tsx similarity index 96% rename from src/screens/PostThread/components/ThreadAnchor.tsx rename to src/screens/PostThread/components/ThreadItemAnchor.tsx index eb519be6b8..6571689df9 100644 --- a/src/screens/PostThread/components/ThreadAnchor.tsx +++ b/src/screens/PostThread/components/ThreadItemAnchor.tsx @@ -1,4 +1,4 @@ -import React, {useMemo} from 'react' +import {memo,useCallback, useMemo} from 'react' import {type GestureResponderEvent, Text as RNText, View} from 'react-native' import { type AppBskyFeedDefs, @@ -60,7 +60,7 @@ import {VerificationCheckButton} from '#/components/verification/VerificationChe import {WhoCanReply} from '#/components/WhoCanReply' import * as bsky from '#/types/bsky' -export function ThreadAnchor({ +export function ThreadItemAnchor({ item, onPostSuccess, threadgateRecord, @@ -74,11 +74,11 @@ export function ThreadAnchor({ const isRoot = threadRootUri === item.uri if (postShadow === POST_TOMBSTONE) { - return + return } return ( - onPostSuccess?: (data: OnPostSuccessData) => void threadgateRecord?: AppBskyFeedThreadgate.Record -}): React.ReactNode => { +}) { const t = useTheme() const {_, i18n} = useLingui() const {openComposer} = useOpenComposer() @@ -192,15 +192,15 @@ let PostThreadItemLoaded = ({ const authorTitle = post.author.handle const isThreadAuthor = getThreadAuthor(post, record) === currentAccount?.did - const likesHref = React.useMemo(() => { + const likesHref = useMemo(() => { const urip = new AtUri(post.uri) return makeProfileLink(post.author, 'post', urip.rkey, 'liked-by') }, [post.uri, post.author]) - const repostsHref = React.useMemo(() => { + const repostsHref = useMemo(() => { const urip = new AtUri(post.uri) return makeProfileLink(post.author, 'post', urip.rkey, 'reposted-by') }, [post.uri, post.author]) - const quotesHref = React.useMemo(() => { + const quotesHref = useMemo(() => { const urip = new AtUri(post.uri) return makeProfileLink(post.author, 'post', urip.rkey, 'quotes') }, [post.uri, post.author]) @@ -208,7 +208,7 @@ let PostThreadItemLoaded = ({ const threadgateHiddenReplies = useMergedThreadgateHiddenReplies({ threadgateRecord, }) - const additionalPostAlerts: AppModerationCause[] = React.useMemo(() => { + const additionalPostAlerts: AppModerationCause[] = useMemo(() => { const isPostHiddenByThreadgate = threadgateHiddenReplies.has(post.uri) const isControlledByViewer = new AtUri(threadRootUri).host === currentAccount?.did @@ -228,7 +228,7 @@ let PostThreadItemLoaded = ({ const showFollowButton = currentAccount?.did !== post.author.did && !onlyFollowersCanReply - const onPressReply = React.useCallback(() => { + const onPressReply = useCallback(() => { openComposer({ replyTo: { uri: post.uri, @@ -425,7 +425,7 @@ let PostThreadItemLoaded = ({ ) -} +}) function ExpandedPostDetails({ post, @@ -452,7 +452,7 @@ function ExpandedPostDetails({ [post, langPrefs.primaryLanguage], ) - const onTranslatePress = React.useCallback( + const onTranslatePress = useCallback( (e: GestureResponderEvent) => { e.preventDefault() openLink(translatorUrl, true) @@ -609,7 +609,7 @@ function getThreadAuthor( } } -export function ThreadAnchorSkeleton() { +export function ThreadItemAnchorSkeleton() { return ( diff --git a/src/screens/PostThread/index.tsx b/src/screens/PostThread/index.tsx index ab0b7645c7..790ef75bfc 100644 --- a/src/screens/PostThread/index.tsx +++ b/src/screens/PostThread/index.tsx @@ -15,11 +15,11 @@ import {type OnPostSuccessData} from '#/state/shell/composer' import {PostThreadComposePrompt} from '#/view/com/post-thread/PostThreadComposePrompt' import {List, type ListMethods} from '#/view/com/util/List' import {HeaderDropdown} from '#/screens/PostThread/components/HeaderDropdown' -import { - ThreadAnchor, - ThreadAnchorSkeleton, -} from '#/screens/PostThread/components/ThreadAnchor' import {ThreadError} from '#/screens/PostThread/components/ThreadError' +import { + ThreadItemAnchor, + ThreadItemAnchorSkeleton, +} from '#/screens/PostThread/components/ThreadItemAnchor' import {ThreadItemAnchorNoUnauthenticated} from '#/screens/PostThread/components/ThreadItemAnchorNoUnauthenticated' import { ThreadItemPost, @@ -378,7 +378,7 @@ export function PostThread({uri}: {uri: string | undefined}) { ref={anchorRef} onLayout={() => setDeferParents(false)} /> - } else if (item.type === 'skeleton') { if (item.item === 'anchor') { - return + return } else if (item.item === 'reply') { if (thread.state.view === 'linear') { return