Skip to content

About

Front-end for the Open edX course experience, implemented using React and Paragon.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

72 stars

Watchers

50 watching

Forks

Latest commit

 

History

1,694 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

frontend-app-learning

License Continuous Integration Codecov semantic-release

Learning is a frontend-base app: a library that a site plugs into the Open edX frontend shell, not a standalone micro-frontend with its own webpack build. It is published to NPM as @openedx/frontend-app-learning.

Purpose

This app renders the learner-facing pages of a course: the course home and its outline, the dates, progress and live tabs, and the courseware itself, where learners work through units.

Branches and Releases

This app is published to NPM by semantic-release. Its branches follow OEP-10 ADR 0002:

master
Unstable. Every merge publishes a prerelease, which goes out on the latest dist-tag until stable first publishes. Breaking changes land here with no DEPR process and no warning, so it is not supported in production. All changes, including bug fixes, should target this branch first.
stable
Will carry the newest stable major and own the latest dist-tag. It is cut, but has not published yet.
n.x and n.m.x
Maintenance branches for majors and minors that stable has moved past. Each owns the dist-tag matching its own name.

The first release is 1.0.0-alpha.1, on the latest dist-tag. Both .releaserc and the Release CI workflow already know the whole layout, so a new line starts publishing as soon as its branch is pushed.

This repository is no longer branched or tagged for Open edX releases in its own right. It participates by published version instead, per OEP-10 ADR 0003.

The legacy micro-frontend lives on in the legacy-mfe branch, cut from the last commit before this conversion. Open edX releases that still ship the micro-frontend are cut from there.

Getting Started

Prerequisites

A running Open edX instance serves this app's backend APIs. Tutor in development mode is the usual choice, and site.config.dev.tsx already points at its default hostnames.

Cloning and Startup

  1. Clone the repo:

    git clone https://github.com/openedx/frontend-app-learning.git

  2. Use the version of Node specified in the .nvmrc file.

    Other major versions of Node may work, but they are unsupported. The .nvmrc file helps set the right version via nvm.

  3. Install npm dependencies:

    cd frontend-app-learning && npm ci

  4. Start the dev server:

    npm run dev

The dev server runs with PORT=2000 PUBLIC_PATH=/learning (set in the dev script in package.json) and is available at http://apps.local.openedx.io:2000/learning. It uses the site defined in site.config.dev.tsx.

Local Development Against frontend-base

To develop this app and a local checkout of frontend-base together, use the built-in npm workspace support:

mkdir -p packages/frontend-base
sudo mount --bind /path/to/frontend-base packages/frontend-base
npm install
npm run dev:packages

Bind mounts are used instead of symlinks because Node resolves symlinks to their real paths, which breaks hoisted dependency resolution. When you are done, unmount with sudo umount packages/frontend-base.

Composing Learning into a Site

A site adds Learning by importing learningApp and listing it in its site config's apps, next to the shell, header and footer apps. site.config.dev.tsx in this repository is a complete example:

import { learningApp } from '@openedx/frontend-app-learning';

const siteConfig: SiteConfig = {
  // ...
  apps: [
    shellApp,
    headerApp,
    footerApp,
    learningApp,
  ],
};

Sites that build their own route tree can use the exported learningRoutes instead.

Configuration

This app is not configured by build-time environment variables any more. It reads its settings from app config. A site sets them in commonAppConfig, which applies to every app on the site, or in the app's own config, which wins:

apps: [
  // ...
  { ...learningApp, config: { SUPPORT_URL: 'https://support.example.com' } },
],

These are the keys Learning reads. All are unset by default, except SHOW_UNGRADED_ASSIGNMENT_PROGRESS, which is false. Where a URL is unset, the link it feeds is left out.

  • CONTACT_URL
  • CREDENTIALS_BASE_URL
  • CREDIT_HELP_LINK_URL
  • DISCOUNT_CODE_INFO_URL
  • DISCOVERY_API_BASE_URL
  • ECOMMERCE_BASE_URL
  • ENABLE_NOTICES
  • ENTERPRISE_LEARNER_PORTAL_URL
  • EXAMS_BASE_URL
  • LEGACY_THEME_NAME
  • MARKETING_SITE_BASE_URL
  • PROCTORED_EXAM_FAQ_URL
  • PROCTORED_EXAM_RULES_URL
  • SESSION_COOKIE_DOMAIN
  • SHOW_UNGRADED_ASSIGNMENT_PROGRESS
  • SOCIAL_UTM_MILESTONE_CAMPAIGN
  • SUPPORT_URL
  • SUPPORT_URL_CALCULATOR_MATH
  • SUPPORT_URL_ID_VERIFICATION
  • SUPPORT_URL_VERIFIED_CERTIFICATE
  • TERMS_OF_SERVICE_URL
  • TWITTER_HASHTAG
  • TWITTER_URL

Learning does not take other apps' URLs as config keys. It links to them by route role, such as org.openedx.frontend.role.dashboard or org.openedx.frontend.role.profile (the full list is in src/constants.ts). A role resolves to an installed app's route, or to an entry in the site config's externalRoutes. site.config.dev.tsx declares them as external routes, at the addresses Tutor's development mode uses.

Slots and Widgets

Learning offers slots that sites use to change its pages, and ships widgets that sites can add to its slots or render elsewhere. See:

Developing

Project Structure

The layout follows the standard frontend-base app layout:

  • src/app.ts: the app definition imported by site.config.*.tsx.
  • src/constants.ts: the app's appId and route roles.
  • src/index.ts: the package's public exports.
  • src/routes.tsx: the app's routes.
  • src/Main.tsx: the root component for the app's routes.
  • src/slots.tsx: the slot operations this app registers: its widgets in the shell's header and course bar, and its tabs in its own tab slots.
  • src/slots/: the slots this app offers.
  • src/widgets/: the widgets this app ships.
  • src/style.scss: the app's styles.

Build Process Notes

npm run build compiles the library into dist/ with tsc and tsc-alias, and copies the SCSS and asset files across. This is what gets published and what sites consume.

npm run build:ci runs openedx build against site.config.ci.tsx, so webpack goes through the whole app. It catches problems, such as broken lazy-loaded imports or stylesheets, that tsc and Jest do not.

Internationalization

See the frontend-base i18n how-to.

Getting Help

If you're having trouble, we have discussion forums where you can connect with others in the community.

Our real-time conversations are on Slack. You can request a Slack invitation, then join our community Slack workspace. Because this is a frontend repository, the best place to discuss it would be in the #wg-frontend channel.

For anything non-trivial, the best path is to open an issue in this repository with as many details about the issue you are facing as you can provide.

https://github.com/openedx/frontend-app-learning/issues

For more information about these options, see the Getting Help page.

Contributing

Contributions are very welcome. Please read How To Contribute for details.

This project is currently accepting all types of contributions, bug fixes, security fixes, maintenance work, or new features. However, please make sure to discuss your new feature idea with the maintainers before beginning development to maximize the chances of your change being accepted. You can start a conversation by creating a new issue on this repo summarizing your idea.

AI Contribution Policy

Note that contributions are expected to follow the Open edX AI Contribution Policy.

The Open edX Code of Conduct

All community members are expected to follow the Open edX Code of Conduct.

License

The code in this repository is licensed under the AGPLv3 unless otherwise noted.

Please see LICENSE for details.

Reporting Security Issues

Please do not report security issues in public. Please email security@openedx.org.

About

Front-end for the Open edX course experience, implemented using React and Paragon.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

72 stars

Watchers

50 watching

Forks

Releases

Used by

Contributors

Languages