From 62fabc19512f75d769bb92186a83a63d636a441f Mon Sep 17 00:00:00 2001 From: Hina Khadim Date: Tue, 10 Dec 2024 14:07:43 +0500 Subject: [PATCH 1/7] fix: update env.config.jsx according to tutor-mfe#240 PR (#109) * fix: update env.config.jsx according to tutor-mfe#240 PR * chore: install tutor-mfe main branch --- .github/workflows/test.yml | 1 + .../mfe-env-config-buildtime-definitions} | 37 ------ .../patches/mfe-env-config-buildtime-imports | 4 + .../mfe-env-config-runtime-definitions | 2 + tutorindigo/plugin.py | 118 ++++++++++-------- 5 files changed, 73 insertions(+), 89 deletions(-) rename tutorindigo/{templates/indigo/env.config.jsx => patches/mfe-env-config-buildtime-definitions} (75%) create mode 100644 tutorindigo/patches/mfe-env-config-buildtime-imports create mode 100644 tutorindigo/patches/mfe-env-config-runtime-definitions diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5a023449b..e78ba603c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,5 +20,6 @@ jobs: - name: Install dependencies run: | pip install .[dev] + pip install --upgrade --editable git+https://github.com/overhangio/tutor-mfe.git@main#egg=tutor-mfe - name: Test lint, types, and format run: make test diff --git a/tutorindigo/templates/indigo/env.config.jsx b/tutorindigo/patches/mfe-env-config-buildtime-definitions similarity index 75% rename from tutorindigo/templates/indigo/env.config.jsx rename to tutorindigo/patches/mfe-env-config-buildtime-definitions index ca3b70448..96bf159bf 100644 --- a/tutorindigo/templates/indigo/env.config.jsx +++ b/tutorindigo/patches/mfe-env-config-buildtime-definitions @@ -1,9 +1,4 @@ -import React, { useEffect } from 'react'; -import Cookies from 'universal-cookie'; -import Footer from '@edly-io/indigo-frontend-component-footer'; -import { getConfig } from '@edx/frontend-platform'; -import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework'; let themeCookie = 'indigo-toggle-dark'; let themeCookieExpiry = 90; // days @@ -70,35 +65,3 @@ const AddDarkTheme = () => { return (
); }; - -const themePluginSlot = { - keepDefault: false, - plugins: [ - { - op: PLUGIN_OPERATIONS.Insert, - widget: { - id: 'default_contents', - type: DIRECT_PLUGIN, - priority: 1, - RenderWidget:
, - }, - }, - { - op: PLUGIN_OPERATIONS.Insert, - widget: { - id: 'read_theme_cookie', - type: DIRECT_PLUGIN, - priority: 2, - RenderWidget: AddDarkTheme, - }, - }, - ], -}; - -const config = { - pluginSlots: { - footer_slot: themePluginSlot, - }, -}; - -export default config; diff --git a/tutorindigo/patches/mfe-env-config-buildtime-imports b/tutorindigo/patches/mfe-env-config-buildtime-imports new file mode 100644 index 000000000..911c11c73 --- /dev/null +++ b/tutorindigo/patches/mfe-env-config-buildtime-imports @@ -0,0 +1,4 @@ +import React, { useEffect } from 'react'; +import Cookies from 'universal-cookie'; + +import { getConfig } from '@edx/frontend-platform'; diff --git a/tutorindigo/patches/mfe-env-config-runtime-definitions b/tutorindigo/patches/mfe-env-config-runtime-definitions new file mode 100644 index 000000000..2204c7301 --- /dev/null +++ b/tutorindigo/patches/mfe-env-config-runtime-definitions @@ -0,0 +1,2 @@ + +const { default: IndigoFooter } = await import('@edly-io/indigo-frontend-component-footer'); diff --git a/tutorindigo/plugin.py b/tutorindigo/plugin.py index 1a3311dd4..64d290093 100644 --- a/tutorindigo/plugin.py +++ b/tutorindigo/plugin.py @@ -1,10 +1,12 @@ from __future__ import annotations import os +from glob import glob import typing as t import importlib_resources from tutor import hooks +from tutormfe.hooks import PLUGIN_SLOTS from tutor.__about__ import __version_suffix__ from .__about__ import __version__ @@ -102,70 +104,38 @@ def _override_openedx_docker_image( hooks.Filters.CONFIG_OVERRIDES.add_items(list(config["overrides"].items())) +# MFEs that are styled using Indigo +indigo_styled_mfes = [ + "learning", + "learner-dashboard", + "profile", + "account", + "discussions", +] + 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", + f"mfe-dockerfile-post-npm-install-{mfe}", """ -RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.1.1' -RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^3.1.3' + RUN npm install @edly-io/indigo-frontend-component-footer@^2.0.0 - -COPY indigo/env.config.jsx /openedx/app/ -""", - ), - ( - "mfe-dockerfile-post-npm-install-authn", - """ -RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.1.1' -""", - ), - # Tutor-Indigo v2.1 targets the styling updates in discussions and learner-dashboard MFE - # brand-openedx is related to styling updates while others are for header and footer updates - ( - "mfe-dockerfile-post-npm-install-discussions", - """ -RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.1.1' RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^3.1.3' -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.1.1' -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.1.1' -RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^3.1.3' -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.1.1' -RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^3.1.3' -RUN npm install @edly-io/indigo-frontend-component-footer@^2.0.0 - -COPY indigo/env.config.jsx /openedx/app/ -""", - ), + ) + for mfe in indigo_styled_mfes ] ) +hooks.Filters.ENV_PATCHES.add_item( + ( + "mfe-dockerfile-post-npm-install-authn", + "RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.1.1'", + ) +) + # Include js file in lms main.html, main_django.html, and certificate.html hooks.Filters.ENV_PATCHES.add_items( @@ -204,3 +174,47 @@ def _override_openedx_docker_image( ), ] ) + + +# Apply patches from tutor-indigo +for path in glob( + os.path.join( + str(importlib_resources.files("tutorindigo") / "patches"), + "*", + ) +): + with open(path, encoding="utf-8") as patch_file: + hooks.Filters.ENV_PATCHES.add_item((os.path.basename(path), patch_file.read())) + + +for mfe in indigo_styled_mfes: + PLUGIN_SLOTS.add_item( + ( + mfe, + "footer_slot", + """ + { + op: PLUGIN_OPERATIONS.Hide, + widgetId: 'default_contents', + }, + { + op: PLUGIN_OPERATIONS.Insert, + widget: { + id: 'default_contents', + type: DIRECT_PLUGIN, + priority: 1, + RenderWidget: , + }, + }, + { + op: PLUGIN_OPERATIONS.Insert, + widget: { + id: 'read_theme_cookie', + type: DIRECT_PLUGIN, + priority: 2, + RenderWidget: AddDarkTheme, + }, + }, + """, + ), + ) From 48569049ea67a453c73c8853377f17791cd46afb Mon Sep 17 00:00:00 2001 From: hinakhadim Date: Tue, 22 Oct 2024 11:50:40 +0500 Subject: [PATCH 2/7] fix: upgrade frontend-component-header to install header package in learner-dashboard --- tutorindigo/plugin.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tutorindigo/plugin.py b/tutorindigo/plugin.py index 64d290093..fae55b94d 100644 --- a/tutorindigo/plugin.py +++ b/tutorindigo/plugin.py @@ -120,8 +120,8 @@ def _override_openedx_docker_image( """ RUN npm install @edly-io/indigo-frontend-component-footer@^2.0.0 -RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^3.1.3' -RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.1.1' +RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^3.2.2' +RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.2.2' """, ) @@ -129,10 +129,11 @@ def _override_openedx_docker_image( ] ) + hooks.Filters.ENV_PATCHES.add_item( ( "mfe-dockerfile-post-npm-install-authn", - "RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.1.1'", + "RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.2.2'", ) ) From a51a4011a8a29e82d4ab2e65b22daccfa812c4f0 Mon Sep 17 00:00:00 2001 From: hinakhadim Date: Tue, 22 Oct 2024 11:51:32 +0500 Subject: [PATCH 3/7] v19.0.0 Upgrade to Sumac --- README.rst | 4 ++-- changelog.d/20241018_170502_hina.khadim_sumac.md | 1 + setup.py | 4 ++-- tutorindigo/__about__.py | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 changelog.d/20241018_170502_hina.khadim_sumac.md diff --git a/README.rst b/README.rst index 5868f50f2..1d53d7c24 100644 --- a/README.rst +++ b/README.rst @@ -86,11 +86,11 @@ Overriding the default "about", "contact", etc. static pages By default, the ``/about`` and ``/contact`` pages contain a simple line of text: "This page left intentionally blank. Feel free to add your own content". This is of course unusable in production. In the following, we detail how to override just any of the static templates used in Open edX. -The static templates used by Open edX to render those pages are all stored in the `edx-platform/lms/templates/static_templates `__ folder. To override those templates, you should add your own in the following folder:: +The static templates used by Open edX to render those pages are all stored in the `edx-platform/lms/templates/static_templates `__ folder. To override those templates, you should add your own in the following folder:: ls tutorindigo/templates/indigo/lms/templates/static_templates" -For instance, edit the "donate.html" file in this directory. We can derive the content of this file from the contents of the `donate.html `__ static template in edx-platform: +For instance, edit the "donate.html" file in this directory. We can derive the content of this file from the contents of the `donate.html `__ static template in edx-platform: .. code-block:: mako diff --git a/changelog.d/20241018_170502_hina.khadim_sumac.md b/changelog.d/20241018_170502_hina.khadim_sumac.md new file mode 100644 index 000000000..53536307c --- /dev/null +++ b/changelog.d/20241018_170502_hina.khadim_sumac.md @@ -0,0 +1 @@ +- 💥[Feature] Upgrade to Sumac (by @hinakhadim) diff --git a/setup.py b/setup.py index 6cdca5a7e..2a27cb9bd 100644 --- a/setup.py +++ b/setup.py @@ -45,8 +45,8 @@ def load_about(): packages=find_packages(exclude=["tests*"]), include_package_data=True, python_requires=">=3.9", - install_requires=["tutor>=18.0.0,<19.0.0", "tutor-mfe>=18.0.0,<19.0.0"], - extras_require={"dev": "tutor[dev]>=18.0.0,<19.0.0"}, + install_requires=["tutor>=19.0.0,<20.0.0", "tutor-mfe>=19.0.0,<20.0.0"], + extras_require={"dev": "tutor[dev]>=19.0.0,<20.0.0"}, entry_points={"tutor.plugin.v1": ["indigo = tutorindigo.plugin"]}, classifiers=[ "Development Status :: 5 - Production/Stable", diff --git a/tutorindigo/__about__.py b/tutorindigo/__about__.py index 22ed76922..0122a6fac 100644 --- a/tutorindigo/__about__.py +++ b/tutorindigo/__about__.py @@ -1 +1 @@ -__version__ = "18.3.0" +__version__ = "19.0.0" From a603840d35c41c790001c1d2b8001c07c447b811 Mon Sep 17 00:00:00 2001 From: hinakhadim Date: Tue, 12 Nov 2024 15:25:44 +0500 Subject: [PATCH 4/7] fix: sync programs HTML templates with edx-platform --- .../templates/indigo/lms/templates/courseware/courses.html | 3 ++- .../lms/templates/learner_dashboard/program_card.underscore | 5 ----- .../lms/templates/learner_dashboard/programs_fragment.html | 3 --- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/tutorindigo/templates/indigo/lms/templates/courseware/courses.html b/tutorindigo/templates/indigo/lms/templates/courseware/courses.html index 4eaf3faea..a95151a5d 100644 --- a/tutorindigo/templates/indigo/lms/templates/courseware/courses.html +++ b/tutorindigo/templates/indigo/lms/templates/courseware/courses.html @@ -25,7 +25,8 @@ ${course_discovery_meanings | n, dump_js_escaped_json}, getParameterByName('search_query'), "${user_language | n, js_escaped_string}", - "${user_timezone | n, js_escaped_string}" + "${user_timezone | n, js_escaped_string}", + ${set_default_filter | n, dump_js_escaped_json} ); diff --git a/tutorindigo/templates/indigo/lms/templates/learner_dashboard/program_card.underscore b/tutorindigo/templates/indigo/lms/templates/learner_dashboard/program_card.underscore index 6aeafb29c..67c9ddd24 100644 --- a/tutorindigo/templates/indigo/lms/templates/learner_dashboard/program_card.underscore +++ b/tutorindigo/templates/indigo/lms/templates/learner_dashboard/program_card.underscore @@ -63,8 +63,3 @@
-<% if (isSubscribed) { %> -
- <%- gettext('Subscribed') %> -
-<% } %> diff --git a/tutorindigo/templates/indigo/lms/templates/learner_dashboard/programs_fragment.html b/tutorindigo/templates/indigo/lms/templates/learner_dashboard/programs_fragment.html index dd3e94bcb..2c7eb2b4d 100644 --- a/tutorindigo/templates/indigo/lms/templates/learner_dashboard/programs_fragment.html +++ b/tutorindigo/templates/indigo/lms/templates/learner_dashboard/programs_fragment.html @@ -31,11 +31,8 @@ ProgramListFactory({ marketingUrl: '${marketing_url | n, js_escaped_string}', programsData: ${programs | n, dump_js_escaped_json}, - programsSubscriptionData: ${programs_subscription_data | n, dump_js_escaped_json}, - subscriptionUpsellData: ${subscription_upsell_data | n, dump_js_escaped_json}, userProgress: ${progress | n, dump_js_escaped_json}, userPreferences: ${user_preferences | n, dump_js_escaped_json}, - isUserB2CSubscriptionsEnabled: ${is_user_b2c_subscriptions_enabled | n, dump_js_escaped_json}, mobileOnly: ${mobile_only | n, dump_js_escaped_json} }); From 377230239b8bb08fc2c433d4414bde52c954f3b0 Mon Sep 17 00:00:00 2001 From: hinakhadim Date: Wed, 20 Nov 2024 18:45:29 +0500 Subject: [PATCH 5/7] fix: upgrade header to v5.8.0 of openedx for sumac and make video icon visible on course about page --- tutorindigo/plugin.py | 2 +- .../indigo/lms/static/sass/courseware/_about.scss | 3 +++ .../indigo/lms/static/sass/xblock/_xblock.scss | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tutorindigo/plugin.py b/tutorindigo/plugin.py index fae55b94d..19aea2651 100644 --- a/tutorindigo/plugin.py +++ b/tutorindigo/plugin.py @@ -118,7 +118,7 @@ def _override_openedx_docker_image( ( f"mfe-dockerfile-post-npm-install-{mfe}", """ - + RUN npm install @edly-io/indigo-frontend-component-footer@^2.0.0 RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^3.2.2' RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.2.2' diff --git a/tutorindigo/templates/indigo/lms/static/sass/courseware/_about.scss b/tutorindigo/templates/indigo/lms/static/sass/courseware/_about.scss index e5732d2be..ae727313c 100644 --- a/tutorindigo/templates/indigo/lms/static/sass/courseware/_about.scss +++ b/tutorindigo/templates/indigo/lms/static/sass/courseware/_about.scss @@ -84,6 +84,9 @@ border-radius: 8px; border: 1px solid $primary-light; } + .play-intro{ + z-index: 10; + } } } } diff --git a/tutorindigo/templates/indigo/lms/static/sass/xblock/_xblock.scss b/tutorindigo/templates/indigo/lms/static/sass/xblock/_xblock.scss index a5f13dbcd..d1b6120ac 100644 --- a/tutorindigo/templates/indigo/lms/static/sass/xblock/_xblock.scss +++ b/tutorindigo/templates/indigo/lms/static/sass/xblock/_xblock.scss @@ -464,6 +464,20 @@ } + #feedback-container{ + background: $body-bg-d; + border: 1px solid $text-color-d; + p{ + color: $text-color-d; + } + } + + .emoji-button{ + background-color: $body-bg-d; + } + .xblock.xmodule_display.xmodule_HtmlBlock .blue-text{color: $primary;} + + .edx-notes-wrapper{ .annotator-hl{ background: orange; From b25956d28c62ab43e7b152302bdf4b3775357f58 Mon Sep 17 00:00:00 2001 From: Hina Khadim Date: Tue, 10 Dec 2024 12:12:16 +0500 Subject: [PATCH 6/7] chore: install tutor-mfe main branch --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e78ba603c..5a023449b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,6 +20,5 @@ jobs: - name: Install dependencies run: | pip install .[dev] - pip install --upgrade --editable git+https://github.com/overhangio/tutor-mfe.git@main#egg=tutor-mfe - name: Test lint, types, and format run: make test From b7a1033c28047cec2b75e6720d88b750db8facd4 Mon Sep 17 00:00:00 2001 From: Hina Khadim Date: Wed, 11 Dec 2024 18:43:21 +0500 Subject: [PATCH 7/7] chore: add sumac v19 changelog --- CHANGELOG.md | 5 +++++ changelog.d/20241018_170502_hina.khadim_sumac.md | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) delete mode 100644 changelog.d/20241018_170502_hina.khadim_sumac.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 38d6a7f1b..ae8468af7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,11 @@ instructions, because git commits are used to generate release notes: + +## v19.0.0 (2024-12-11) + +- 💥[Feature] Upgrade to Sumac (by @hinakhadim) + ## v18.3.0 (2024-12-11) diff --git a/changelog.d/20241018_170502_hina.khadim_sumac.md b/changelog.d/20241018_170502_hina.khadim_sumac.md deleted file mode 100644 index 53536307c..000000000 --- a/changelog.d/20241018_170502_hina.khadim_sumac.md +++ /dev/null @@ -1 +0,0 @@ -- 💥[Feature] Upgrade to Sumac (by @hinakhadim)