From a95da2d6da7f1864489998b20aad09159f308931 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Mon, 8 Jun 2026 10:39:52 -0500 Subject: [PATCH] Simplify some props --- src/components/Post/Embed/ImageEmbed.tsx | 15 +++++++-------- src/components/Post/Embed/index.tsx | 3 +-- src/components/Post/Embed/types.ts | 11 ++++++----- .../PostThread/components/ThreadItemAnchor.tsx | 3 +-- .../PostThread/components/ThreadItemPost.tsx | 3 +-- .../PostThread/components/ThreadItemTreePost.tsx | 3 +-- src/view/com/post/Post.tsx | 3 +-- src/view/com/posts/PostFeedItem.tsx | 3 +-- 8 files changed, 19 insertions(+), 25 deletions(-) diff --git a/src/components/Post/Embed/ImageEmbed.tsx b/src/components/Post/Embed/ImageEmbed.tsx index 3648604219..7016147a10 100644 --- a/src/components/Post/Embed/ImageEmbed.tsx +++ b/src/components/Post/Embed/ImageEmbed.tsx @@ -46,14 +46,13 @@ export function ImageEmbed({ const layout: 'single' | 'grid' | 'carousel' = images.length === 1 ? 'single' : useExpandedLayout ? 'carousel' : 'grid' - const postContext = - rest.uri && rest.authorDid - ? { - uri: rest.uri, - authorDid: rest.authorDid, - feedDescriptor: rest.feedDescriptor, - } - : undefined + const postContext = rest.post + ? { + uri: rest.post.uri, + authorDid: rest.post.author.did, + feedDescriptor: rest.feedDescriptor, + } + : undefined const metricsContext: LightboxMetricsContext | undefined = postContext ? {layout, ...postContext} : undefined diff --git a/src/components/Post/Embed/index.tsx b/src/components/Post/Embed/index.tsx index 4f863749a7..69d92983ed 100644 --- a/src/components/Post/Embed/index.tsx +++ b/src/components/Post/Embed/index.tsx @@ -347,8 +347,7 @@ export function QuoteEmbed({ } // The photo embed belongs to the quoted post, so attribute its // analytics to the quoted post rather than the parent. - uri={quote.uri} - authorDid={quote.author.did} + post={quote} /> )} diff --git a/src/components/Post/Embed/types.ts b/src/components/Post/Embed/types.ts index 74d7ba4a9b..77319b0e86 100644 --- a/src/components/Post/Embed/types.ts +++ b/src/components/Post/Embed/types.ts @@ -15,11 +15,12 @@ export type CommonProps = { viewContext?: PostEmbedViewContext isWithinQuote?: boolean allowNestedQuotes?: boolean - // Post context for analytics on photo embed events (post:photoEmbed:*). - // When the embed has no owning post (e.g. previews), leave these undefined - // and no events will be emitted. - uri?: string - authorDid?: string + /** + * The post that contains this embed. Used for analytics on photo embed + * events (post:photoEmbed:*). When the embed has no owning post (e.g. + * composer previews), leave this undefined and no events will be emitted. + */ + post?: AppBskyFeedDefs.PostView feedDescriptor?: string } diff --git a/src/screens/PostThread/components/ThreadItemAnchor.tsx b/src/screens/PostThread/components/ThreadItemAnchor.tsx index 69d78c8149..1c55b67256 100644 --- a/src/screens/PostThread/components/ThreadItemAnchor.tsx +++ b/src/screens/PostThread/components/ThreadItemAnchor.tsx @@ -414,8 +414,7 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({ moderation={moderation} viewContext={PostEmbedViewContext.ThreadHighlighted} onOpen={onOpenEmbed} - uri={post.uri} - authorDid={post.author.did} + post={post} /> )} diff --git a/src/screens/PostThread/components/ThreadItemPost.tsx b/src/screens/PostThread/components/ThreadItemPost.tsx index 1ae44bfe8b..c1e27222ff 100644 --- a/src/screens/PostThread/components/ThreadItemPost.tsx +++ b/src/screens/PostThread/components/ThreadItemPost.tsx @@ -349,8 +349,7 @@ const ThreadItemPostInner = memo(function ThreadItemPostInner({ embed={post.embed} moderation={moderation} viewContext={PostEmbedViewContext.Feed} - uri={post.uri} - authorDid={post.author.did} + post={post} /> )} diff --git a/src/screens/PostThread/components/ThreadItemTreePost.tsx b/src/screens/PostThread/components/ThreadItemTreePost.tsx index 6fbe6bed3d..9868786648 100644 --- a/src/screens/PostThread/components/ThreadItemTreePost.tsx +++ b/src/screens/PostThread/components/ThreadItemTreePost.tsx @@ -371,8 +371,7 @@ const ThreadItemTreePostInner = memo(function ThreadItemTreePostInner({ embed={post.embed} moderation={moderation} viewContext={PostEmbedViewContext.Feed} - uri={post.uri} - authorDid={post.author.did} + post={post} /> )} diff --git a/src/view/com/post/Post.tsx b/src/view/com/post/Post.tsx index 8686db10ee..c952224553 100644 --- a/src/view/com/post/Post.tsx +++ b/src/view/com/post/Post.tsx @@ -255,8 +255,7 @@ function PostInner({ embed={post.embed} moderation={moderation} viewContext={PostEmbedViewContext.Feed} - uri={post.uri} - authorDid={post.author.did} + post={post} /> ) : null} diff --git a/src/view/com/posts/PostFeedItem.tsx b/src/view/com/posts/PostFeedItem.tsx index 97531d6312..c0ff26206d 100644 --- a/src/view/com/posts/PostFeedItem.tsx +++ b/src/view/com/posts/PostFeedItem.tsx @@ -531,8 +531,7 @@ let PostContent = ({ moderation={moderation} onOpen={onOpenEmbed} viewContext={PostEmbedViewContext.Feed} - uri={post.uri} - authorDid={post.author.did} + post={post} feedDescriptor={feedDescriptor} />