Conversation
Mirrors the Browse popover: featured rows for My Books, Loans & History and My Lists, then Reading Log shelves and the remaining My Books pages. Browse's styles are renamed to shared nav-popover classes, and the now-unused lib/header_dropdown.html template and its tests are removed.
for more information, see https://pre-commit.ci
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.
Closes #
feature
"My Books" in the header was a plain link to the My Books overview. To reach a specific shelf, loans, lists, notes or the import page, patrons had to land on the overview first and then find the page in its sidebar. Browse, sitting right next to it, already opens a menu of destinations, so the two nav items behaved differently.
My Books now opens a popover built the same way as Browse. The top three rows are featured with an icon and a short description (My Books, Loans & History, My Lists). Below them are the four Reading Log shelves, then My Feed, My Notes, My Reviews, My Reading Stats and Import & Export Options. It also appears in the mobile tray, just like Browse.
Technical
The destinations live in a new
mybooks_links()inplugins/openlibrary/nav.py, next to the existingbrowse_links(). It returns groups rather than a flat list: the first group is featured, and each later group is set off by a divider. Every link uses an/account/...path, which redirects to the patron's own page (or to login when signed out), so the template doesn't need the username. As with Browse, the icons and blurbs stay in the template (lib/mybooks_popover.html), with fallbacks so a new destination can't break the header.To avoid copying Browse's CSS, its classes are renamed to shared ones:
browse-popover__*becomesnav-popover__*, andbrowse-feature*becomesnav-feature*. Each popover keeps its own root class (browse-popover,mybooks-popover). The open-tracking listener inmain.jsnow matches.nav-popover[data-ol-open-track], so both menus send an open event. This sets up a pattern where any future header menu can use thenav-popoverclasses and a*_links()function innav.py.Analytics follow the Browse format:
MainNav|<Destination>|<rank>for clicks, andMainNav|MyBooksOpenfor opens (MainNavMobilein the mobile tray). The previous single link sentMainNav|MyBooks, which becomesMainNav|MyBooks|1.lib/header_dropdown.htmlhas no remaining callers, so it's deleted along with its two attribute-escaping tests. The.header-dropdownCSS and the jQuery close handlers stay because the language picker still uses them.Testing
pytest openlibrary/tests/test_link_track_attribute_escaping.pypasses.Screenshot
Stakeholders