Skip to content

Commit

Permalink
Merge pull request #2086 from Sefaria/fix-monkey-conundrum-he-interface
Browse files Browse the repository at this point in the history
Fix redirection for hebrewless topic pages and author topic pages
  • Loading branch information
nsantacruz authored Nov 3, 2024
2 parents 765cd5c + 9747ff6 commit e42d303
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions static/js/TopicPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -585,13 +585,16 @@ const TopicPage = ({

useEffect( ()=> {
// hack to redirect to temporary sheet content on topics page for those topics that only have sheet content.
if (document.querySelector('.filter-content') && !document.querySelector('.filter-content').firstChild) {
const interfaceIsHe = Sefaria.interfaceLang === "hebrew"
const topicPath = interfaceIsHe ? topicTitle.he : topicTitle.en;
const redirectUrl = `${document.location.origin}/search?q=${topicPath}&tab=sheet&tvar=1&tsort=relevance&stopics_${interfaceIsHe ? "he": "en"}Filters=${topicPath}&svar=1&ssort=relevance`
if (!Sefaria.is_moderator && !topicData.isLoading && Object.keys(topicData.tabs).length == 0 && topicData.subclass != "author"){
const interfaceIsHe = Sefaria.interfaceLang === "hebrew";
const interfaceLang = interfaceIsHe ? 'he' : 'en';
const coInterfaceLang = interfaceIsHe ? 'en' : 'he';
const topicPathLang = topicTitle[interfaceLang] ? interfaceLang : coInterfaceLang
const topicPath = topicTitle[topicPathLang]
const redirectUrl = `${document.location.origin}/search?q=${topicPath}&tab=sheet&tvar=1&tsort=relevance&stopics_${topicPathLang}Filters=${topicPath}&svar=1&ssort=relevance`
window.location.replace(redirectUrl);
}
},[loadedData])
},[topicData])

// Set up tabs and register incremental load hooks
const displayTabs = [];
Expand Down

0 comments on commit e42d303

Please sign in to comment.