Skip to content

feat: support design tokens and paragon 23 #1436

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dcoa
Copy link
Contributor

@dcoa dcoa commented Feb 27, 2025

Warning

This PR should not be merge to master directly, it should point to master-design-tokens once the branch has been created.

Description

This PR updates frontend app authn to support CSS variables and the corresponding paragon design tokens.

Changes implemented:

  • Replace Paragon SCSS variables with CSS variables.

Important

This PR requires a compatible version with paragon 23 of dependencies, because of that the following PRs need to be merged first:

How to test

Navigate the sandbox

@dcoa dcoa requested a review from a team as a code owner February 27, 2025 22:44
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Feb 27, 2025
@openedx-webhooks
Copy link

openedx-webhooks commented Feb 27, 2025

Thanks for the pull request, @dcoa!

This repository is currently maintained by @openedx/2u-infinity.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions Feb 27, 2025
@dcoa dcoa marked this pull request as draft February 27, 2025 22:44
@dcoa dcoa changed the title Dcoa/design tokens support [WIP] feat: support design tokens and paragon 23 Feb 27, 2025
@dcoa dcoa force-pushed the dcoa/design-tokens-support branch from 4df75f7 to c707d82 Compare February 27, 2025 22:59
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Mar 3, 2025
@dcoa dcoa force-pushed the dcoa/design-tokens-support branch from c707d82 to b4faf7a Compare March 18, 2025 07:18
Copy link

codecov bot commented Mar 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.69%. Comparing base (9323f11) to head (5f03a07).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1436   +/-   ##
=======================================
  Coverage   87.69%   87.69%           
=======================================
  Files         124      124           
  Lines        2299     2299           
  Branches      646      642    -4     
=======================================
  Hits         2016     2016           
  Misses        274      274           
  Partials        9        9           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dcoa dcoa added the create-sandbox open-craft-grove should create a sandbox environment from this PR label Mar 18, 2025
@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@dcoa dcoa marked this pull request as ready for review March 18, 2025 20:54
@dcoa dcoa requested a review from brian-smith-tcril March 18, 2025 20:55
@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@dcoa
Copy link
Contributor Author

dcoa commented Mar 19, 2025

The styles are not been displayed due to the url is not correct as you can see in the error:

The stylesheet https://app.pr-1436-1ec6b4.sandboxes.opencraft.hosting/authn/app.pr-1436-1ec6b4.sandboxes.opencraft.hosting/authn/paragon-theme-core.6f6c779f694ae379b95d.css was not loaded because its MIME type, “text/html”, is not “text/css”.

This is because frontend-platform uses BASE_URL to create the url, as you can see here

export const fallbackThemeUrl = (url) => {
  const baseUrl = getConfig().BASE_URL || window.location?.origin;
  return `${baseUrl}${basename}${url}`;
};

Problem

The problem is the url does not have the protocol on it, so is resolve as a path instead of a full url, is being defined by tutor-mfe like:

MFE_CONFIG = {
    "BASE_URL": "{{ MFE_HOST }}",
}

There is 2 ways to solve it:

  1. Update the tutor-mfe patches to handle the protocol
  2. Validate in frontend-platform if the variable has the protocol or not and add it if needed.

For the second point we might add some consistency in the MFEs variables (for development) most of the apps has the protocol on it but some of them not (as shown here)

Checked (has the http on it):

  • frontend-app-account
  • frontend-app-authn
  • frontend-app-authoring
  • frontend-app-communications
  • frontend-app-discussions
  • frontend-app-gradebook
  • frontend-app-learner-dashboard
  • frontend-app-learner-record
  • frontend-app-learning
  • frontend-app-ora
  • frontend-app-ora-grading
  • frontend-app-profile
  • frontend-app-publisher
  • frontend-app-support-tools
  • frontend-template-application

I would like to have your opinion before making any change @brian-smith-tcril

@brian-smith-tcril
Copy link
Contributor

@dcoa I would worry that updating the tutor-mfe patches to handle the protocol could lead to unexpected side effects, so I'd lean towards addressing this in fallbackThemeUrl.

we might add some consistency in the MFEs variables (for development) most of the apps has the protocol on it but some of them not

I think ideally we'd be able to handle both, so example.com/my.css and http(s)://example.com/my.css would work.

@adamstankiewicz thoughts?

@adamstankiewicz
Copy link
Member

I agree this would ideally be handled within @edx/frontend-platform itself, as it could impact non-tutor MFEs as well. In the case where no protocol (http/https) exists on the fallbackThemeUrl, perhaps // could be prepended (protocol-relative URL, e.g. docs)?

Example:

<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/@openedx/[email protected]/dist/light.css">

In this case, the URL would use the same protocol as the current page (i.e., https if the app is hosted on https, http if the app is hosted on http).

@dcoa dcoa force-pushed the dcoa/design-tokens-support branch from 8c93fa5 to ad38966 Compare March 21, 2025 20:50
@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@dcoa
Copy link
Contributor Author

dcoa commented Mar 21, 2025

@brian-smith-tcril, this PR is ready for review ☺️

@dcoa dcoa force-pushed the dcoa/design-tokens-support branch from ad38966 to 4b48b92 Compare March 26, 2025 00:32
@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@dcoa dcoa force-pushed the dcoa/design-tokens-support branch from 4b48b92 to e6940e5 Compare March 31, 2025 00:10
@dcoa dcoa changed the title [WIP] feat: support design tokens and paragon 23 feat: support design tokens and paragon 23 Mar 31, 2025
@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@dcoa dcoa force-pushed the dcoa/design-tokens-support branch from e6940e5 to 856ee5c Compare April 11, 2025 04:11
@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@dcoa dcoa force-pushed the dcoa/design-tokens-support branch from 856ee5c to 5f03a07 Compare April 13, 2025 21:43
@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
create-sandbox open-craft-grove should create a sandbox environment from this PR open-source-contribution PR author is not from Axim or 2U
Projects
Status: Waiting on Author
Development

Successfully merging this pull request may close these issues.

5 participants