-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Refactors and improves the My Books UI + architecture #8597
Conversation
fea1dfc
to
8dfd08f
Compare
8dfd08f
to
13b545f
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8597 +/- ##
=======================================
Coverage 17.61% 17.61%
=======================================
Files 85 85
Lines 4456 4456
Branches 782 782
=======================================
Hits 785 785
Misses 3187 3187
Partials 484 484 ☔ View full report in Codecov by Sentry. |
- Refactors mybooks.py routes into separate endpoints - Cleans up the main My Books Wrapper template - Makes /people/{username}/books visitable and sharable when readinglog set to public - Standardizes the page title using breadcrumb navigation dropper - Adds avatar image to mybooks breadcrumbs - Standardizes Edit --vanilla btn styling - Adds My Books Wrapper treatment to Lists and List - Shows "My" or patron's username in breadcrumb to clarify which page one is on - Standardizes chip buttons beneath header across pages - Moves "share" btn to its own spot in header Known Bugs: - [X] Public "{username}'s books" breadcrumb breaks, shows just as "{username}'s" - [X] Breadcrumb dropdown unclickable, likely z-index error - [X] My Sponsorships broken - [X] URLs on My Books page carousels should reflect page owner, not logged in patron - [X] Observations breaks for public user (e.g. incognito /people/mekBot/books/observations) - [X] Private accounts breadcrumbs shouldn't show readinglog counts - [ ] Public List not rendering with my books sidebar - [ ] Share button does not preserve port Tested - [X] "My Books" works (as me), shows share, (stats, privacy & export chips) - [X] "My Books" loans, readinglogs, reviews, notes, stats all work - [X] Public "mekBot's Books" incognito works, notes + stats + loans all blocked - [X] Public "mekBot's" sponsorships and observations are blocked? - [X] "jachamp's Books" incognito successfully shows "private" + shows public lists + lists & list work - [X] Public account works for all 3 reading logs, NOT notes
13b545f
to
75f38c5
Compare
ff1044d
to
3cd6ed6
Compare
3cd6ed6
to
7bbf270
Compare
And robust to usernames with special characters
mb = MyBooksTemplate(username, 'lists') | ||
template = self.render_template(path, show_header=False) | ||
return mb.render(template=template, header_title=_("Lists"), page=mb.user) | ||
if path.startswith("/people/"): |
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.
I wonder if we should simply break the path
regex into different functions rather than trying to collapse them into one, just a suggestion.
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.
Long term these should be two separate classes I reckon. They're pretty different in terms of function.
- top menu chips now wrap - my books stats permissions work on mobile, (chrome, safari) - deleted duplicate share buttons - fixed mobile alignment of share button
for more information, see https://pre-commit.ci
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.
Tested:
- ✅ non-people
/lists
page - ✅ people /lists page
- ✅ Imports & exports
- Nitpick: dropper says "My Imports and exports", sidebar says "Imports & Exports Options"
- ✅ /account/loans
- Bug (pre-existing): "Loans" not highlighted in sidebar when on loans page
- ✅ stats works / is private
- ✅ sorting reading log works for myself and others
- ✅ Searching reading log works for myself and others
- Bug (pre-existing): A search with no matches confusingly shows the "You have no books on this shelf" screen"
ratings=None, | ||
year=None, | ||
): | ||
if self.me and self.is_my_page and self.key in self.ALL_KEYS: |
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.
if self.me and self.is_my_page and self.key in self.ALL_KEYS: | |
if self.is_my_page and self.key in self.ALL_KEYS: |
mb = MyBooksTemplate(username, 'lists') | ||
template = self.render_template(path, show_header=False) | ||
return mb.render(template=template, header_title=_("Lists"), page=mb.user) | ||
if path.startswith("/people/"): |
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.
Long term these should be two separate classes I reckon. They're pretty different in terms of function.
$if owners_page: | ||
<div> | ||
<h1 class="details-title">My Stats</h1> |
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.
<h1 class="details-title">My Stats</h1> | |
<h1 class="details-title">$_('My Stats')</h1> |
@@ -0,0 +1,25 @@ | |||
$def with (mb) | |||
|
|||
$ readinglog = mb.key in ['currently-reading', 'already-read', 'want-to-read'] |
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.
This would be better in the MyBooks class; some is_readinglog(key: str) -> bool
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.
This should be name mybooks_shell.html
. view.html makes me think it's /people/ScarTissue
, the profile page, since {type}/view.html
correspond to infogamy types
@@ -75,24 +75,27 @@ a.cta-btn { | |||
border: 2px solid @link-blue; | |||
background: lighten(desaturate(@link-blue, 56%), 67%); | |||
} | |||
&--vanilla { | |||
&--vanilla, &--vanilla:visited, &--vanilla:link { |
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.
Why are we doing this? I think this is frowned upon for accessibility.
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.
Lgtm! Small suggestions left. Merge at your discretion
Sidebar is broken on account settings page: https://staging.openlibrary.org/account?debug=true Suspect this is due to |
Known Bugs:
Missing book cover should gracefully fall-back to placeholder
request.fullpath
notctx.path
? (nice-to-have)Tested (http://ol-dev1.us.archive.org:1337/)
Prepares for #739 done in https://github.com/internetarchive/openlibrary/tree/follows-and-mb-refactor
Technical
Testing
Screenshot
Stakeholders