From f9a90a4ad0543a88b0b034b1242396cbd6375f1e Mon Sep 17 00:00:00 2001 From: Hina Khadim Date: Tue, 27 Aug 2024 15:46:11 +0500 Subject: [PATCH] fix: problem displaying /account/ page after upgraded to redwood (#96) * fix: account-mfe bug * refactor: remove unused useEffect in env.config.jsx and add comment --- tutorindigo/plugin.py | 30 ++++++++++++++------- tutorindigo/templates/indigo/env.config.jsx | 27 +++++++++++++++++++ 2 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 tutorindigo/templates/indigo/env.config.jsx diff --git a/tutorindigo/plugin.py b/tutorindigo/plugin.py index 982983f16..918c20658 100644 --- a/tutorindigo/plugin.py +++ b/tutorindigo/plugin.py @@ -47,6 +47,7 @@ hooks.Filters.ENV_TEMPLATE_TARGETS.add_items( [ ("indigo", "build/openedx/themes"), + ("indigo/env.config.jsx", "plugins/mfe/build/mfe"), ], ) @@ -103,12 +104,16 @@ def _override_openedx_docker_image( hooks.Filters.ENV_PATCHES.add_items( [ + # MFE will install header version 3.0.x and will include indigo-footer as a + # separate package for use in env.config.jsx ( "mfe-dockerfile-post-npm-install-learning", """ RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.0.0'{% if INDIGO_ENABLE_DARK_THEME %} --theme=dark{% endif %} -RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^3.0.0' -RUN npm install '@edx/frontend-component-footer@npm:@edly-io/indigo-frontend-component-footer@^2.0.0' +RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@~3.0.0' +RUN npm install @edly-io/indigo-frontend-component-footer@^2.0.0 + +COPY indigo/env.config.jsx /openedx/app/ """, ), ( @@ -123,32 +128,39 @@ def _override_openedx_docker_image( "mfe-dockerfile-post-npm-install-discussions", """ RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.0.0'{% if INDIGO_ENABLE_DARK_THEME %} --theme=dark{% endif %} -RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^3.0.0' -RUN npm install '@edx/frontend-component-footer@npm:@edly-io/indigo-frontend-component-footer@^2.0.0' +RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@~3.0.0' +RUN npm install @edly-io/indigo-frontend-component-footer@^2.0.0 + +COPY indigo/env.config.jsx /openedx/app/ """, ), ( "mfe-dockerfile-post-npm-install-learner-dashboard", """ RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.0.0'{% if INDIGO_ENABLE_DARK_THEME %} --theme=dark{% endif %} -RUN npm install '@edx/frontend-component-footer@npm:@edly-io/indigo-frontend-component-footer@^2.0.0' +RUN npm install @edly-io/indigo-frontend-component-footer@^2.0.0 + +COPY indigo/env.config.jsx /openedx/app/ """, ), ( "mfe-dockerfile-post-npm-install-profile", """ RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.0.0'{% if INDIGO_ENABLE_DARK_THEME %} --theme=dark{% endif %} -RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^3.0.0' -RUN npm install '@edx/frontend-component-footer@npm:@edly-io/indigo-frontend-component-footer@^2.0.0' +RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@~3.0.0' +RUN npm install @edly-io/indigo-frontend-component-footer@^2.0.0 +COPY indigo/env.config.jsx /openedx/app/ """, ), ( "mfe-dockerfile-post-npm-install-account", """ RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.0.0'{% if INDIGO_ENABLE_DARK_THEME %} --theme=dark{% endif %} -RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^3.0.0' -RUN npm install '@edx/frontend-component-footer@npm:@edly-io/indigo-frontend-component-footer@^2.0.0' +RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@~3.0.0' +RUN npm install @edly-io/indigo-frontend-component-footer@^2.0.0 + +COPY indigo/env.config.jsx /openedx/app/ """, ), ] diff --git a/tutorindigo/templates/indigo/env.config.jsx b/tutorindigo/templates/indigo/env.config.jsx new file mode 100644 index 000000000..87b96313c --- /dev/null +++ b/tutorindigo/templates/indigo/env.config.jsx @@ -0,0 +1,27 @@ +import React from 'react'; + +import Footer from '@edly-io/indigo-frontend-component-footer'; +import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework'; + +const themePluginSlot = { + keepDefault: false, + plugins: [ + { + op: PLUGIN_OPERATIONS.Insert, + widget: { + id: 'default_contents', + type: DIRECT_PLUGIN, + priority: 1, + RenderWidget: