Skip to content
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 work's add-cover carousel #8942

Merged

Conversation

jimchamp
Copy link
Collaborator

@jimchamp jimchamp commented Mar 21, 2024

Closes #8906

Restores "next" and "previous" page buttons to the work add-cover carousel.

Technical

An input with name carousel-i18n-strings does not exist on the work's add-cover page. This caused an error during instantiation when i18n strings were parsed, preventing the Carousel from being created.

Now, we check for the carousel-i18n-strings input before attempting to parse its value.

Testing

Screenshot

image

Stakeholders

@seabelis

@codecov-commenter
Copy link

codecov-commenter commented Mar 21, 2024

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 15.95%. Comparing base (9222960) to head (136727a).

Files Patch % Lines
...ibrary/plugins/openlibrary/js/carousel/Carousel.js 0.00% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8942      +/-   ##
==========================================
- Coverage   15.96%   15.95%   -0.01%     
==========================================
  Files          89       89              
  Lines        4710     4712       +2     
  Branches      821      822       +1     
==========================================
  Hits          752      752              
- Misses       3449     3450       +1     
- Partials      509      510       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jimchamp jimchamp force-pushed the 8906/bug/fix-work-cover-carousel branch 2 times, most recently from 6cd2f51 to 5db1db2 Compare March 21, 2024 23:34
@jimchamp jimchamp force-pushed the 8906/bug/fix-work-cover-carousel branch from 5db1db2 to 136727a Compare March 21, 2024 23:41
@jimchamp jimchamp changed the title Catch JSON.parse errors Fix work's add-cover carousel Mar 21, 2024
@jimchamp jimchamp marked this pull request as ready for review March 21, 2024 23:46
@mekarpeles mekarpeles added the Priority: 2 Important, as time permits. [managed] label Mar 25, 2024
Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm! Tested:

I'm not sure how we might want to best handle this in the long run; it seems a touch funky that the i18n is optional, in terms of what the interface for this component is? But I think we can resolve that if we ever come across this use case again; I reckon it's pretty niche!

@cdrini cdrini added On testing.openlibrary.org This PR has been deployed to testing.openlibrary.org for testing and removed Needs: Testing labels Mar 28, 2024
@cdrini cdrini merged commit 4043d67 into internetarchive:master Mar 28, 2024
3 checks passed
@jimchamp
Copy link
Collaborator Author

I'm not sure how we might want to best handle this in the long run; it seems a touch funky that the i18n is optional, in terms of what the interface for this component is? But I think we can resolve that if we ever come across this use case again; I reckon it's pretty niche!

It may be nice if Carousel.js only handled functionality that applies to all carousels, and maybe some BookCarousel subclass could define functionality that applies specifically to carousels of books? Not sure if something like this would be worth the effort unless it was done in support of creating some other novel variety of carousel.

@cdrini
Copy link
Collaborator

cdrini commented Mar 28, 2024

Yeah that was my thinking exactly; but I agree it seems like a lot of work just to handle this random one-off carousel :P If we find that we hit this issue again with another carousel, seems worth considering though!

@jimchamp jimchamp removed the On testing.openlibrary.org This PR has been deployed to testing.openlibrary.org for testing label Apr 2, 2024
@jimchamp jimchamp deleted the 8906/bug/fix-work-cover-carousel branch April 24, 2024 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: 2 Important, as time permits. [managed]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Work cover selector lost ability to scroll
4 participants