Simplify some props
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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}
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
|
||||
@@ -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}
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
|
||||
@@ -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}
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
|
||||
@@ -255,8 +255,7 @@ function PostInner({
|
||||
embed={post.embed}
|
||||
moderation={moderation}
|
||||
viewContext={PostEmbedViewContext.Feed}
|
||||
uri={post.uri}
|
||||
authorDid={post.author.did}
|
||||
post={post}
|
||||
/>
|
||||
</View>
|
||||
) : null}
|
||||
|
||||
@@ -531,8 +531,7 @@ let PostContent = ({
|
||||
moderation={moderation}
|
||||
onOpen={onOpenEmbed}
|
||||
viewContext={PostEmbedViewContext.Feed}
|
||||
uri={post.uri}
|
||||
authorDid={post.author.did}
|
||||
post={post}
|
||||
feedDescriptor={feedDescriptor}
|
||||
/>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user