Add "back to book" button on gameboards#2193
Conversation
To facilitate a "back to book" button
A "back to subject overview" button might be a good idea, but it adds additional complexity and nobody's asked for it.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2193 +/- ##
==========================================
- Coverage 43.55% 43.51% -0.04%
==========================================
Files 597 597
Lines 25207 25253 +46
Branches 8389 8421 +32
==========================================
+ Hits 10979 10989 +10
- Misses 14172 14207 +35
- Partials 56 57 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
sjd210
left a comment
There was a problem hiding this comment.
I wasn't here for the tech meeting discussion, but I'd imagine that content also want the button to still be on the question deck when navigating to a question, then back to the deck. There are a few different links that do this, but it should mostly just be propagating the url parameter in those different places too, which seems reasonable.
Also this definitely wasn't requested, but I imagine this would be also be useful for concept pages which are also very commonly linked from book pages. Maybe something to mention?
| <ListView | ||
| type="gameboard" | ||
| items={convertToALVIGameboards(page.gameboards as GameboardDTO[])} | ||
| items={convertToALVIGameboards(page.gameboards as GameboardDTO[], window.location.pathname)} |
There was a problem hiding this comment.
I really don't like us embedding so much of one url into another url. The slashes make it difficult to figure out where the actual pages url ends and this one begins at a glance, and it just makes things unnecessarily long.
We could certainly slice the /books/ from the front since these are only ever meant to link to book pages so we definitely know to include it. We could maybe then also split the ?book=$book/$section into ?book=$book§ion=$section although then that's a tradeoff between clarity and length so I'm not 100% sold. I'll leave that to you.
| }; | ||
|
|
||
| type ALVIGameboard = GameboardDTO & {type?: string}; | ||
| type ALVIGameboard = GameboardDTO & {type?: string} & {linkedBookPath?: string}; |
There was a problem hiding this comment.
Any reason we call it bookPagePath in other files but linkedBookPath here? It feels easier to track use if we stick with one consistent name
This is no longer a path.
for reuse in other sidebars
…dual gameboards This url param will be the same for every gameboard in the listview, so we only need to pass it in once instead of augmenting every single gameboard.
In case we ever end up adding additional url params here. Also avoids repeated conversions between URLSearchParams and strings.
There was a problem hiding this comment.
Hate to be feature-creeping this - but for consistency, we probably should also apply this to wildcards.
Generic and Concept pages as wildcards in a gameboard have a GameboardContentSidebar for us to propagate this through, plus it'll need to be added to the ShortcutListViewItem.
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
|
If a gameboard is accessed from a book page, show a "Back to book section" button in the sidebar that links back to the book page.