Simplify some props
This commit is contained in:
@@ -46,14 +46,13 @@ export function ImageEmbed({
|
|||||||
const layout: 'single' | 'grid' | 'carousel' =
|
const layout: 'single' | 'grid' | 'carousel' =
|
||||||
images.length === 1 ? 'single' : useExpandedLayout ? 'carousel' : 'grid'
|
images.length === 1 ? 'single' : useExpandedLayout ? 'carousel' : 'grid'
|
||||||
|
|
||||||
const postContext =
|
const postContext = rest.post
|
||||||
rest.uri && rest.authorDid
|
? {
|
||||||
? {
|
uri: rest.post.uri,
|
||||||
uri: rest.uri,
|
authorDid: rest.post.author.did,
|
||||||
authorDid: rest.authorDid,
|
feedDescriptor: rest.feedDescriptor,
|
||||||
feedDescriptor: rest.feedDescriptor,
|
}
|
||||||
}
|
: undefined
|
||||||
: undefined
|
|
||||||
const metricsContext: LightboxMetricsContext | undefined = postContext
|
const metricsContext: LightboxMetricsContext | undefined = postContext
|
||||||
? {layout, ...postContext}
|
? {layout, ...postContext}
|
||||||
: undefined
|
: undefined
|
||||||
|
|||||||
@@ -347,8 +347,7 @@ export function QuoteEmbed({
|
|||||||
}
|
}
|
||||||
// The photo embed belongs to the quoted post, so attribute its
|
// The photo embed belongs to the quoted post, so attribute its
|
||||||
// analytics to the quoted post rather than the parent.
|
// analytics to the quoted post rather than the parent.
|
||||||
uri={quote.uri}
|
post={quote}
|
||||||
authorDid={quote.author.did}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -15,11 +15,12 @@ export type CommonProps = {
|
|||||||
viewContext?: PostEmbedViewContext
|
viewContext?: PostEmbedViewContext
|
||||||
isWithinQuote?: boolean
|
isWithinQuote?: boolean
|
||||||
allowNestedQuotes?: 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
|
* The post that contains this embed. Used for analytics on photo embed
|
||||||
// and no events will be emitted.
|
* events (post:photoEmbed:*). When the embed has no owning post (e.g.
|
||||||
uri?: string
|
* composer previews), leave this undefined and no events will be emitted.
|
||||||
authorDid?: string
|
*/
|
||||||
|
post?: AppBskyFeedDefs.PostView
|
||||||
feedDescriptor?: string
|
feedDescriptor?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -414,8 +414,7 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({
|
|||||||
moderation={moderation}
|
moderation={moderation}
|
||||||
viewContext={PostEmbedViewContext.ThreadHighlighted}
|
viewContext={PostEmbedViewContext.ThreadHighlighted}
|
||||||
onOpen={onOpenEmbed}
|
onOpen={onOpenEmbed}
|
||||||
uri={post.uri}
|
post={post}
|
||||||
authorDid={post.author.did}
|
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -349,8 +349,7 @@ const ThreadItemPostInner = memo(function ThreadItemPostInner({
|
|||||||
embed={post.embed}
|
embed={post.embed}
|
||||||
moderation={moderation}
|
moderation={moderation}
|
||||||
viewContext={PostEmbedViewContext.Feed}
|
viewContext={PostEmbedViewContext.Feed}
|
||||||
uri={post.uri}
|
post={post}
|
||||||
authorDid={post.author.did}
|
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -371,8 +371,7 @@ const ThreadItemTreePostInner = memo(function ThreadItemTreePostInner({
|
|||||||
embed={post.embed}
|
embed={post.embed}
|
||||||
moderation={moderation}
|
moderation={moderation}
|
||||||
viewContext={PostEmbedViewContext.Feed}
|
viewContext={PostEmbedViewContext.Feed}
|
||||||
uri={post.uri}
|
post={post}
|
||||||
authorDid={post.author.did}
|
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -255,8 +255,7 @@ function PostInner({
|
|||||||
embed={post.embed}
|
embed={post.embed}
|
||||||
moderation={moderation}
|
moderation={moderation}
|
||||||
viewContext={PostEmbedViewContext.Feed}
|
viewContext={PostEmbedViewContext.Feed}
|
||||||
uri={post.uri}
|
post={post}
|
||||||
authorDid={post.author.did}
|
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
@@ -531,8 +531,7 @@ let PostContent = ({
|
|||||||
moderation={moderation}
|
moderation={moderation}
|
||||||
onOpen={onOpenEmbed}
|
onOpen={onOpenEmbed}
|
||||||
viewContext={PostEmbedViewContext.Feed}
|
viewContext={PostEmbedViewContext.Feed}
|
||||||
uri={post.uri}
|
post={post}
|
||||||
authorDid={post.author.did}
|
|
||||||
feedDescriptor={feedDescriptor}
|
feedDescriptor={feedDescriptor}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
Reference in New Issue
Block a user