Skip to content

Commit

Permalink
Merge pull request #2042 from Sefaria/strapi-bannels-and-modals-resur…
Browse files Browse the repository at this point in the history
…rection

Resurrection of Strapi
  • Loading branch information
edamboritz authored Sep 19, 2024
2 parents 238bb03 + 68a9e4f commit 52c13c2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
3 changes: 1 addition & 2 deletions static/js/Promotions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ const Promotions = () => {
const context = useContext(AdContext);
const strapi = useContext(StrapiDataContext);
useEffect(() => {
// Disable Strapi for Sidebar Ads during Unbounce trial
if (false && strapi.dataFromStrapiHasBeenReceived) {
if (strapi.dataFromStrapiHasBeenReceived) {
Sefaria._inAppAds = [];

const sidebarAds = strapi.strapiData?.sidebarAds?.data;
Expand Down
26 changes: 16 additions & 10 deletions static/js/ReaderApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2252,17 +2252,23 @@ toggleSignUpModal(modalContentKind = SignUpModalKind.Default) {
var classes = classNames(classDict);

return (
<AdContext.Provider value={this.getUserContext()}>
<div id="readerAppWrap">
<div className={classes} onClick={this.handleInAppLinkClick}>
{header}
{panels}
{signUpModal}
{communityPagePreviewControls}
<CookiesNotification />
// The Strapi context is put at the highest level of scope so any component or children within ReaderApp can use the static content received
// InterruptingMessage modals and Banners will always render if available but stay hidden initially
<StrapiDataProvider>
<AdContext.Provider value={this.getUserContext()}>
<div id="readerAppWrap">
<InterruptingMessage />
<Banner onClose={this.setContainerMode} />
<div className={classes} onClick={this.handleInAppLinkClick}>
{header}
{panels}
{signUpModal}
{communityPagePreviewControls}
<CookiesNotification />
</div>
</div>
</div>
</AdContext.Provider>
</AdContext.Provider>
</StrapiDataProvider>
);
}
}
Expand Down
3 changes: 1 addition & 2 deletions static/js/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ function StrapiDataProvider({ children }) {
const [modal, setModal] = useState(null);
const [banner, setBanner] = useState(null);
useEffect(() => {
// Disable Strapi API calls during Unbounce trial
if (false && typeof STRAPI_INSTANCE !== "undefined" && STRAPI_INSTANCE) {
if (typeof STRAPI_INSTANCE !== "undefined" && STRAPI_INSTANCE) {
const getStrapiData = async () => {
let getDateWithoutTime = (date) => date.toISOString().split("T")[0];
let getJSONDateStringInLocalTimeZone = (date) => {
Expand Down

0 comments on commit 52c13c2

Please sign in to comment.