diff --git a/static/js/ReaderPanel.jsx b/static/js/ReaderPanel.jsx
index 6280d00279..4161704532 100644
--- a/static/js/ReaderPanel.jsx
+++ b/static/js/ReaderPanel.jsx
@@ -1384,10 +1384,12 @@ class ReaderControls extends Component {
);
const openTranslations = this.props.openConnectionsPanel.bind(null, [this.props.currentRef], null, {"connectionsMode": "Translations"});
+ const transCallToActionApplies = () => Sefaria.transCallToActionApplies(this.props.currentBook(), this.props.settings.language);
let banner = (hideHeader || connectionsHeader) ? null : (
);
const classes = classNames({
diff --git a/static/js/TextColumnBanner.jsx b/static/js/TextColumnBanner.jsx
index 097ed0d710..f93b5e0df1 100644
--- a/static/js/TextColumnBanner.jsx
+++ b/static/js/TextColumnBanner.jsx
@@ -8,12 +8,15 @@ import {
const cookie = Sefaria._inBrowser ? $.cookie : Sefaria.util.cookie;
const { translation_language_preference_suggestion } = Sefaria;
-export const TextColumnBannerChooser = ({ setTranslationLanguagePreference, openTranslations }) => {
+export const TextColumnBannerChooser = ({ setTranslationLanguagePreference, openTranslations, transCallToActionApplies }) => {
const [bannerAccepted, setBannerAccepted] = useState(false);
const shouldTransPrefBannerRender = () => {
// we haven't suggested yet and we have a suggestion
return !cookie("translation_language_preference_suggested") && translation_language_preference_suggestion
};
+ const shouldTransCallToActionRender = () => {
+ return transCallToActionApplies() && !cookie("translation_call_to_action_shown"); // && textMode in (bilingual, english) && category in (Tanakh, Mishnah, Bavli)
+ }
if (shouldTransPrefBannerRender()) {
return (;
}
- return ;
+ if (shouldTransCallToActionRender()) {
+ return ;
+ }
+ return null;
};
diff --git a/static/js/sefaria/sefaria.js b/static/js/sefaria/sefaria.js
index 9698478df8..6663c65909 100644
--- a/static/js/sefaria/sefaria.js
+++ b/static/js/sefaria/sefaria.js
@@ -1046,6 +1046,15 @@ Sefaria = extend(Sefaria, {
}
return ref ? this.getRefFromCache(ref) : null;
},
+ transCallToActionApplies: (book, textLanguage) => {
+ /**
+ * Should we display the translaiton call-to-action banner?
+ * Return `true` if `book`s corpus is Tanakh, Mishnah or Bavli AND textLanguage isn't Hebrew
+ */
+ const applicableCorpora = ["Tanakh", "Mishnah", "Bavli"];
+ const currCorpus = Sefaria.index(book)?.corpus;
+ return textLanguage !== "hebrew" && applicableCorpora.indexOf(currCorpus) !== -1;
+ },
_lookups: {},
// getName w/ refOnly true should work as a replacement for parseRef - it uses a callback rather than return value. Besides that - same data.