-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: implement content truncation for Action Plan cards (M2-7861) #541
base: dev
Are you sure you want to change the base?
Conversation
This pull request is automatically being deployed by Amplify Hosting (learn more). |
b729820
to
8359686
Compare
8359686
to
48c564b
Compare
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.
Hey @qiushihe, amazing algorithmic work!! Your focus on this to take care of so many truncation edge cases is greatly appreciated. 🙏🏻❤️🙏🏻 I had some very minor comments but the code looks great otherwise.
I'm still encountering that same discrepancy in pagination between desktop and mobile browsers as I identified in your previous PR. With max page height set to 512, I'm getting quite a significant difference in # of pages generated:
Web (Chromium) | Mobile (Safari) |
---|---|
@farmerpaul the issue with the mobile browser vs. desktop browser truncation height difference is due to font-size and line-height calculation. Those 2 values are not set directly, but are calculated using I also addressed those other comments, so if you can take another look that would be great. I'll just be tweaking the font-size/line-height stuff in the background for a bit. |
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.
Hey @qiushihe, I recorded a Loom with a simple proposed solution to the aspect ratio issue, check it out: https://www.loom.com/share/898fea7503ef4f5696985e15eebf3fe4
See what you think, hopefully that will be adequate. I'll pre-approve regardless. 🙂
Edit: In my loom I demoed the solution with useXScaledDimension
, but I supposed useYScaledDimension
is actually the right one? Doesn't seem to make a whole lot of difference which one you use.
That's actually really cool! I never thought about also scaling the max height value. And it seems easy enough, so I'll make the change. Thanks @farmerpaul! |
📝 Description
🔗 Jira Ticket M2-7861
This PR updates the Action Plan cards rendering code to implement a binary-searched based truncation algorithm. The algorithm will not only truncate at phrasal field level, but also at phrasal field content level, to ensure each card contains the maximum amount of content. Overflowing contents at the end of a card, and corresponding continuation content at the beginning of the following card, are connected by a set of ellipses.
For a walkthrough of implementation detail, please see this loom recording: https://www.loom.com/share/0f3fd7416f814e769ca1318e2ac13a28
📸 Screenshots
Text Truncation Start
Text Truncation Both Ends
Text Truncation End
**List Truncation Start/End **
List Truncation Both Ends
List Truncation when Rendered as Sentence
🪤 Peer Testing
✏️ Notes
Although the AC of the ticket only specified truncation of text content, the implementation actually also truncate list items. The reason being: if a list is too long, it should just be truncated anyway. Otherwise, we'll have to deal with all sort of complication around list content overflowing/cut-off, etc. If we REALLY don't want to truncate list items, we can still set a flag in the code to turn that off.