-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reader Refresh: rule-pick-canonical-media #9288
Reader Refresh: rule-pick-canonical-media #9288
Conversation
…d classification - added the rule pick-canonical-media as a replacement for our featured-asset component - modified how we classify cards so that a card featuring a video will not be styled as if it were PHOTO_ONLY
22ff283
to
2a6776b
Compare
} | ||
|
||
const featuredMedia = find( post.content_media, isCandidateForFeature ); | ||
const canonicalMedia = find( post.content_media, isCandidateForFeature ); | ||
post.canonical_media = { ...canonicalMedia }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the copy here?
if ( ! canonicalImage || post.content_embeds.length === 1 ) { | ||
displayType ^= DISPLAY_TYPES.FEATURED_VIDEO; | ||
} | ||
if ( post.canonical_media && post.canonical_media.mediaType === 'video' ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
niiiiiiice
hasShortContent( post ) ) { | ||
displayType ^= DISPLAY_TYPES.PHOTO_ONLY; | ||
} | ||
|
||
if ( canonicalImage ) { | ||
// TODO do we still need aspect logic here and any of these? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we may for the old streams.
…ge (#9149) * Reader Refresh: Prefer first media in assence of canonical image * addressed some of blowery's offline comments * fixed the height:0 issue BUT now its a UX issue ... * fixed order of Object.assign for height/width * changes needed after eagerly grab height/width landed * added a check for featured images to be large enough based on post_thumbnail * Reader Refresh: rule-pick-canonical-media (#9288) * Reader Refresh: add canonical_media detection as a rule to enable card classification - added the rule pick-canonical-media as a replacement for our featured-asset component - modified how we classify cards so that a card featuring a video will not be styled as if it were PHOTO_ONLY * don't copy the canonical media and only set it to a found value
…ge (#9149) * Reader Refresh: Prefer first media in assence of canonical image * addressed some of blowery's offline comments * fixed the height:0 issue BUT now its a UX issue ... * fixed order of Object.assign for height/width * changes needed after eagerly grab height/width landed * added a check for featured images to be large enough based on post_thumbnail * Reader Refresh: rule-pick-canonical-media (#9288) * Reader Refresh: add canonical_media detection as a rule to enable card classification - added the rule pick-canonical-media as a replacement for our featured-asset component - modified how we classify cards so that a card featuring a video will not be styled as if it were PHOTO_ONLY * don't copy the canonical media and only set it to a found value
As was suggested in here, I've created
rule-pick-canonical-media
to help with post-classification and styling of cards.This also obviates the need for
FeaturedAsset
as its own Component.Fixes #9239.
This change is dependent on #9149 landing
To test:
canonical_media
prop if you check react dev tools