Skip to content

Commit

Permalink
show in app ads on topic pages
Browse files Browse the repository at this point in the history
  • Loading branch information
nissamai committed Apr 8, 2022
1 parent 14d2606 commit f823b95
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion static/js/ReaderApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1790,7 +1790,17 @@ class ReaderApp extends Component {
}

getUserContext() {
const refs = this.state.panels.map(panel => panel.currentlyVisibleRef || panel.bookRef || panel.navigationCategories || panel.navigationTopic).flat();
const returnNullIfEmpty = (value) => {
if(Array.isArray(value)) {
if(value.length === 0) {
return null;
} else {
return value;
}
}

}
const refs = this.state.panels.map(panel => panel.currentlyVisibleRef || panel.bookRef || returnNullIfEmpty(panel.navigationCategories) || panel.navigationTopic).flat();
const books = refs.map(ref => Sefaria.parseRef(ref).book);
const triggers = refs.map(ref => Sefaria.refCategories(ref))
.concat(books)
Expand Down

0 comments on commit f823b95

Please sign in to comment.