Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update env.config.jsx according to tutor-mfe#240 PR #109

Merged
merged 5 commits into from
Dec 10, 2024

Conversation

hinakhadim
Copy link
Collaborator

@hinakhadim hinakhadim commented Dec 2, 2024

Add env-patches to add code in env.config.jsx and updated plugin.py for updating footer_slot.

Update required for overhangio/tutor-mfe#240

import typing as t

import importlib_resources
from glob import glob
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of these two imports is unnecessary.

tutorindigo/plugin.py Show resolved Hide resolved
@@ -57,7 +57,7 @@
.xmodule_display.xmodule_HtmlBlock ul,
.xmodule_display.xmodule_StaticTabBlock ol,
.xmodule_display.xmodule_StaticTabBlock ul {
color: $text-color-d;
color: $text-color-d !important;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK !important css tags are bad practice. Is there a legitimate reason to use them here? Is there any way to avoid them?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CSS changes will be removed in this PR. We've done in #111

tutorindigo/plugin.py Show resolved Hide resolved
Copy link

@arbrandes arbrandes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I know why this isn't working: see my inline comments.

@@ -0,0 +1,4 @@


const Footer = await import(/* webpackIgnore: true */`@edly-io/indigo-frontend-component-footer`).catch(() => null); // Fallback to null if not available
Copy link

@arbrandes arbrandes Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const Footer = await import(/* webpackIgnore: true */`@edly-io/indigo-frontend-component-footer`).catch(() => null); // Fallback to null if not available
const { default: IndigoFooter } = await import('@edly-io/indigo-frontend-component-footer');

First: instead of having to use Footer.default below, it's less confusing to just rename default to the component we want. (I suggest IndigoFooter to avoid confusion.)

Second: as far as I can tell, webpackIgnore will make it so webpack never imports the footer component, so we can't use that. And I'm not convinced a catch would work as intended, here. This is already in a try/catch block, which is the only way to get Webpack to actually do an optional import as of v5.90.2.

Now, this does indeed break the build in frontend-app-ora-grading: webpack is not generating code that treats the import as optional. I tracked this down to the fact this MFE is not configuring browserslist properly in package.json (see PR that fixes it). We'll fix the MFE, but I have a question in the meantime: any particular reason why the Indigo footer is not being npm-installed for frontend-app-ora-grading?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any particular reason why the Indigo footer is not being npm-installed for frontend-app-ora-grading?

Adding IndigoFooter to ORA requires styles from indigo-brand-openedx package (otherwise indigo-footer doesn't look appealing). And if we apply indigo-brand-openedx package, then dark-theme automatically applies to body and it shows inconsistent, unreadable page of ora-grading MFE. We have planned to work on ora-grading styling after sumac. We'll include at that time.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks!

I'm hoping to get the ORA grading MFE fixed today (including in the Sumac branch).

tutorindigo/plugin.py Outdated Show resolved Hide resolved
Copy link

@arbrandes arbrandes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of suggestions, but otherwise looks good to me!

FYI, both ora-grading and learner-dashboard have been fixed so that optional imports work (openedx/frontend-app-ora-grading#380, openedx/frontend-app-learner-dashboard#524).

tutorindigo/plugin.py Outdated Show resolved Hide resolved
tutorindigo/plugin.py Outdated Show resolved Hide resolved
@hinakhadim
Copy link
Collaborator Author

hinakhadim commented Dec 6, 2024

Thanks everyone for your continuous support & help. I've tested on my system.
Steps:

  1. git checkout arbrandes:frontend-plugin-support-take-2 (of tutor-mfe)
  2. tutor images build mfe --no-cache

Tests: (All tests are successful)

  • Image building is successful
  • Indigo Footer is loaded correctly
  • Dark Theme component is working as expected (loading dark-theme on MFE load)

We just need confirmation from one more team member regarding testing, and then we’ll be ready to proceed with the merge. tutor-mfe and this PR.

@hinakhadim hinakhadim force-pushed the fix/update-envConfigJsx branch from b1474e1 to df5abfb Compare December 9, 2024 08:22
@Danyal-Faheem
Copy link
Contributor

I tested the changes with the updated branches of tutor-indigo and tutor-mfe and they seem to be working as expected! 🚀

@hinakhadim hinakhadim merged commit 62fabc1 into overhangio:main Dec 10, 2024
1 check passed
hinakhadim added a commit that referenced this pull request Dec 10, 2024
* fix: update env.config.jsx according to tutor-mfe#240 PR

* chore: install tutor-mfe main branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

4 participants