Skip to content

Conversation

@stevekaplan123
Copy link
Contributor

@stevekaplan123 stevekaplan123 commented Dec 10, 2025

Description

If there is a note on a sheet, link it to voices module. The previous functionality was actually wrong. I've now added a function getNoteURL because the behavior is quite different. This comment explains:
// This helper function returns the a tag linking to the given ref of the note When the URL is to a ref in the library,
// returning the appropriate a tag is very simple, but when the ref is to a sheet, we need to modify the ref and set the data-target-module attribute to the voices module.
// If the ref is to a sheet, the ref will be something like "Sheet 3.4" but it needs to link to "/sheets/3.4" in the voices module.

Comment on lines 40 to 51
let path, noteURL;
const module = isSheet ? Sefaria.VOICES_MODULE : Sefaria.LIBRARY_MODULE;
if (isSheet) {
const parsedRef = Sefaria.parseRef(ref);
path = `/sheets/${parsedRef.sections.join('.')}`;
noteURL = new URL(path, Sefaria.getModuleURL(module));
}
else {
path = `/${ref}`;
noteURL = new URL(path, Sefaria.getModuleURL(module));
noteURL.searchParams.set('with', 'Notes'); // side panel should only open to show notes in Library module
}
Copy link
Contributor

Choose a reason for hiding this comment

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

you can insert the module into the if-else blocks to avoid checking isSheet twice.
it still will have noteURL = new URL(path, Sefaria.getModuleURL(module)); twich which i really don't like, but i didn't find the right way to do it. it's worth to give it another think. maybe some of the logic here can be generalized to a separate helper function in Sefaria.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK I just pushed again. Let me know what you think of my re-factor. I used a helper function we already had with some changes.

@stevekaplan123 stevekaplan123 changed the base branch from modularization-main to modularization-future January 5, 2026 09:21
stevekaplan123 and others added 2 commits January 5, 2026 12:23
Co-authored-by: YishaiGlasner <60393023+YishaiGlasner@users.noreply.github.com>
Co-authored-by: YishaiGlasner <60393023+YishaiGlasner@users.noreply.github.com>
@stevekaplan123 stevekaplan123 marked this pull request as ready for review January 5, 2026 10:24
@stevekaplan123 stevekaplan123 merged commit 37b9361 into modularization-future Jan 6, 2026
17 of 27 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.

2 participants