fix(web): resize long album names (Closes #26533)#27024
Closed
updatemike wants to merge 1 commit intoimmich-app:mainfrom
Closed
fix(web): resize long album names (Closes #26533)#27024updatemike wants to merge 1 commit intoimmich-app:mainfrom
updatemike wants to merge 1 commit intoimmich-app:mainfrom
Conversation
Reduce the album title font size for large titles. Signed-off-by: Michael Maycock <michael.maycock@tecnico.ulisboa.pt>
|
Label error. Requires exactly 1 of: changelog:.*. Found: 🖥️web. A maintainer will add the required label. |
Member
|
Does this duplicate #27012? |
Member
|
Yes, it does. Sorry! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes the issue where long album titles will cause them to overflow from the screen without any attempt to resize it.
I added two things for this fix: size classes for the Album title and a method for calculating the Album title's current size and choosing which size class to pick.
The size classes' values follow the project's guidelines starting with the largest size, which are the same as the original default values, and reducing the size in tiers. These classes use tailwind css and follow project's specification for different sized viewports.
To calculate the Album title's text size I found two options: the use of Canvas2D or creating a temporary invisible DOM element. I chose the latter because the project's tooling mentioned lack of support for Canvas2D. After calculating the title's size, the method calculates which size class the title should have to fit in the viewport.
For visibility reasons the size classes don't go any lower than what was set as the smallest size class but if needed it is very easy to add and/or remove size tiers. I verified that my fix worked as intended and created e2e tests for it.
Fixes #26533 (issue)
How Has This Been Tested?
Screenshots (if appropriate)
Checklist:
src/services/uses repositories implementations for database calls, filesystem operations, etc.src/repositories/is pretty basic/simple and does not have any immich specific logic (that belongs insrc/services/)Please describe to which degree, if any, an LLM was used in creating this pull request.
I used a LLM for grammar and spell checking and also for some questioning about alternative methods of implementation.
...