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

chore: pass highlightedRefsInSheet from SheetsWithRefPage #2246

Conversation

stevekaplan123
Copy link
Contributor

Description

We have a feature in production that was not implemented when we created the Sheets With Ref Page this summer. The feature is that if a user has "Exodus 7:1" open in the reader and opens a sheet from the sidebar, the sheet will scroll to highlight the source "Exodus 7:1" in the sheet. In modularization, when a user tries to open a sheet from the reader, they are taken to a new page, the Sheets With Ref Page which displays all the sheets for the given ref with appropriate topic filters (like the Search Page). However, previously in the modularization branch, when a user would click one of these sheets, the sheet would not scroll to "Exodus 7:1" and highlight it. This PR corrects this.

Code Changes

There's a function in ReaderPanel, handleSheetClick, which is used in production to implement this feature. I used the same function, by passing it to the SheetsWithRefPage component, which ultimately passes it all the way to SearchSheetResult. I had to slightly modify handleSheetClick in ReaderPanel and slightly modify the click handler in SearchSheetResult, which is confusingly also called handleSheetClick. The substantive difference in the SearchSheetResult click handler is that I need to check if the query passed is a search query (i.e. plain text) in which case we should use the this.props.onResultClick handler that was already being used before, OR if the query passed is in the form of a valid Sefaria ref, in which case we know that the function passed down as this.props.onResultClick is really the ReaderPanel's handleSheetClick.

static/js/SearchSheetResult.jsx Show resolved Hide resolved
static/js/SearchSheetResult.jsx Outdated Show resolved Hide resolved
Copy link
Contributor

@saengel saengel left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thank you for the helpful PR description.

@yitzhakc yitzhakc merged commit 38bfc8c into modularization-main Jan 26, 2025
14 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants