-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fix link preview size #24052
Fix link preview size #24052
Conversation
@shawnborton @aimane-chnaif One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
||
useEffect(() => { | ||
setMaxImageSize(windowHeight / 2 < MAX_IMAGE_SIZE ? SMALL_SCREEN_MAX_IMAGE_SIZE : MAX_IMAGE_SIZE); |
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.
This condition was true for browsers on mobile, so mobile styles were being applied on browsers on mobile but not for mobile apps.
@@ -120,10 +124,10 @@ function LinkPreviewer(props) { | |||
styles.linkPreviewImage, | |||
{ | |||
aspectRatio: image.width / image.height, |
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.
image also keeps the aspect ratio maintained which also affects the height and width.
Hey @aimane-chnaif, PR is ready for review. |
Thanks for spinning this up! So after seeing this, I feel like we might want to make the max-height on desktop even smaller. Perhaps we just go with what mobile has at 180? |
Ok @shawnborton. I would also like to confirm - what should be the max-width on desktop - 180px/240px/350px? On mobile, it is 340px. |
Maybe we can do the same max-width for both desktop & mobile? And same for height? Just to keep things simple. So that might be say 340px max-width on desktop & mobile, 180px max-height on desktop & mobile. Thoughts? |
Nice, let's do that then. Thanks for being flexible here! |
@aimane-chnaif, PR and test proofs updated as per latest design. |
While testing, previews are randomly duplicated (i.e. google.com shows instagram logo in my video) but not a blocker as it's not caused by this PR. Screen.Recording.2023-08-02.at.8.41.40.PM.mov |
@Nikhil-Vats thanks for following design feedback and quick fixes. |
Reviewer Checklist
Screenshots/VideosWebweb.movMobile Web - Chromemchrome.movMobile Web - Safarimsafari.movDesktopdesktop.moviOSios.movAndroidandroid.mov |
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.
LGTM 🎉
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.
Code looks good! I see we had an update from @shawnborton that made this much simpler, since now desktop and mobile are just the same.
@Nikhil-Vats can you update your test steps in the PR description to match the new code? It's still saying desktop and mobile are different in the After section which - unless I misread - is not true anymore. Thank you!
Once that's done I can merge.
Hey @dangrous, I have updated the PR description. |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/dangrous in version: 1.3.50-0 🚀
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.3.50-3 🚀
|
🚀 Deployed to staging by https://github.com/dangrous in version: 1.3.51-0 🚀
|
🚀 Deployed to production by https://github.com/Julesssss in version: 1.3.51-2 🚀
|
Details
Size of link previews was very big, this PR reduces it for both mobiles and desktops.
Fixed Issues
$ #23179
PROPOSAL: #23179 (comment)
Tests
You can use the following links to compare the size of link previews -
facebook.com
,youtube.com
,cnn.com
.Before -
Large screen (web/desktop app) - max width = 350px, max height = 350px
Small screen (apps/browsers) - max width = 180px, max height = 180px but this was only being applied on browser (chrome/safari) and not on apps because of wrong logic in code
After -
On all screens sizes (mobile/desktop), preview size is same - max-width = 340px, max-height = 180px
Offline tests
Same as above.
QA Steps
Same as above.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
Before followed by after
Mobile Web - Chrome
Before followed by after - Here, mobile styles were being applied before as well, CNN preview was smaller because, max width was smaller (180px) and image also maintains the aspect ratio. Now, we have increased max width to 340px on all screens, so height is also allowed to be more (still less than max height 180px though).
Mobile Web - Safari
Before followed by after - Here, mobile styles were being applied before as well
Desktop
Before followed by after -
iOS
Before followed by after - Image also maintains the aspect ratio which also affects the width, height. See the formula.
Android
Before followed by after -