frontend icon indicating copy to clipboard operation
frontend copied to clipboard

add better text truncation method

Open michaelchadwick opened this issue 1 year ago • 12 comments

References ilios/ilios#3482

My first crack at changing our current <TruncateText> system to a <FadeText> system: instead of removing HTML and squishing text together, leave it all as-is but put a fade-to-bg effect on it. Only working on Session Objectives->Description for now, but could be expanded.

Old, Tired, Non-Ideal: Screenshot 2024-08-01 at 4 24 32 PM New, Wired, Superior(?): Screenshot 2024-08-01 at 4 28 07 PM

The vertical spacing it takes up can be adjusted. Here's another one with more faded away: Screenshot 2024-08-01 at 4 31 20 PM

michaelchadwick avatar Aug 01 '24 23:08 michaelchadwick

I like it on sessions, needs some attention on course objectives (and probably generically shouldn't specify it's own background, but should fade into whatever is behind it if possible) Screenshot 2024-08-06 at 3 16 19 PM

jrjohnson avatar Aug 06 '24 22:08 jrjohnson

@jrjohnson Good catch. I'm also realizing <TruncateText> is used in a few more places that I need to account for, so back to the drawing board.

michaelchadwick avatar Aug 07 '24 20:08 michaelchadwick

Places where <TruncateText> is currently used and <FadeText> could replace:

  • CourseObjectiveList
    • ObjectiveSortManager
  • SessionObjectiveList
    • OfferingManager (this seems like it shouldn't change; only location, so usually short)
  • SessionsGridOffering (this seems like it shouldn't change: only location, so usually short)
  • WeekAtAGlance, as seen on an event's description (this seems like it shouldn't change: not in a grid)
    • LearningMaterialListItem, as seen on WaaG in an LM's "Public Notes" (this could use some discussion, as it's essentially the same as the parent list item, except that it displays slightly differently when expanded)
  • MaterialListItem (this seems it shouldn't change: instructor name(s))

michaelchadwick avatar Aug 07 '24 21:08 michaelchadwick

@jrjohnson I believe I fixed the background color issue, but had to be specific instead of general (thankfully, there are only three places to be specific about right now).

michaelchadwick avatar Aug 07 '24 21:08 michaelchadwick

Note to self: attempt to create a mixin that can be used to facilitate the gradient from transparent->text background color.

michaelchadwick avatar Aug 15 '24 15:08 michaelchadwick

@jrjohnson I moved the component-specific styles in fade-text.scss into their respective component style files, which makes more sense. Two of them had to be in addition to the mixin they included because of different background colors, whereas the other one I was able to add to the mixin itself.

michaelchadwick avatar Aug 20 '24 21:08 michaelchadwick

@jrjohnson All good points. Will look into these.

michaelchadwick avatar Aug 21 '24 20:08 michaelchadwick

@jrjohnson I fixed all the stuff mentioned in point 1, but not sure how to approach point 2 without re-architecting the whole truncation system.

michaelchadwick avatar Aug 23 '24 18:08 michaelchadwick

@jrjohnson This has one failing testapp test, because it's testing for truncation length, and not the new visual fading thing. Not sure how to rewrite test, hmmm.

https://github.com/ilios/frontend/blob/master/packages/test-app/tests/integration/components/editable-field-test.js#L143-L154

michaelchadwick avatar Aug 26 '24 16:08 michaelchadwick

Having some issues with getting a JS triggered click to target the correct item (thus, test won't pass). Manually clicking with a mouse/touch works fine, though. Frustrating -_-

michaelchadwick avatar Sep 04 '24 14:09 michaelchadwick

image

image

dartajax avatar Sep 12 '24 19:09 dartajax

@dartajax Excellent catch. The fade overlay is too tall and interfering. Back to the drawing board.

michaelchadwick avatar Sep 12 '24 20:09 michaelchadwick

@stopfstedt @jrjohnson This needs a review again, and also there are two skipped tests in the fade-text-test.js file because I keep getting random results from the tests: sometimes it loads the text faded, sometimes it doesn't, almost like a race condition. Need another pair of eyes/brain cells on them, if possible.

michaelchadwick avatar Sep 23 '24 21:09 michaelchadwick

Comments and probably useless advice added but I tried. I did discover a maybe bug, it seems like expanding doesn't work, it only gets bigger for this objective? I clicked and the icon changed, but the text is still faded. Screenshot 2024-09-23 at 10 12 33 PM

Excellent bug catch. I made an uneducated change and introduced this bug, but figuring out why the bug happens now informs me to why not to make that uneducated change again.

michaelchadwick avatar Sep 24 '24 18:09 michaelchadwick

Fixes ilios/ilios#3482

michaelchadwick avatar Sep 24 '24 20:09 michaelchadwick

@dartajax I finally got every test to pass; just have Percy to finish. Can you take a look, and bring this one home? Thanks a bunch.

michaelchadwick avatar Sep 26 '24 17:09 michaelchadwick