openedx / wg-frontend

Open edX Frontend Working Group
4 stars 1 forks source link

Proposal: Application headers and footers v2.0 #41

Open davidjoy opened 2 years ago

davidjoy commented 2 years ago

In 2019 we devised a system for headers and footers as part of the Arch FED team.

This involved the creation of four repositories:

https://github.com/edx/frontend-component-header https://github.com/edx/frontend-component-footer https://github.com/edx/frontend-component-header-edx https://github.com/edx/frontend-component-footer-edx

The first two are generic headers and footers intended to be the defaults for any microfrontend included in Open edX. They are relatively simple and don't have a ton of content in them (especially the footer)

The second two (with the -edx suffix) are edx.org-specific versions of the header and footer. The header has an alternate set of menus and links, and includes user menu links to enterprises, for instance. The footer has a whole host of links and copyright notifications in it which make it quite different from the generic Open edX footer.

The MFEs that use these headers all have the generic versions in their package.json files, and edx.org's deployment process uses npm to install the -edx versions as aliases as shown here:

https://github.com/edx/tubular/blob/master/tubular/scripts/frontend_utils.py#L66

Problems with this approach:

  1. These headers and footers are only useful for particular MFEs. As a result, we've been telling folks for a while to create their own headers in their apps in anticipation of a better solution coming down the pipe. This was to avoid a situation where we try to make these headers be All Things To All Apps, which would become unmaintainable. The system is inflexible.
  2. Engineers don't really understand the existence of or approach used to substitute the -edx headers for edx.org
  3. The approach we use with edx.org is not complex, but also not well documented and otherwise unsupported for Open edX installations - folks are somewhat on their own if they want to use a custom header.
  4. If we keep the approach of having separate Open edX and edx.org versions of the headers and footers, and want to add more headers/footers, we're going to quickly have an unwieldy proliferation of repositories to handle.
  5. We've had massive code duplication at this point, where the base code from the two -edx repositories has been copied all over the place to make custom headers.

A proposed approach:

I think in order to support both edx.org and Open edX, we need a new multi-pronged approach here.

Benefits:

arbrandes commented 1 year ago

This should also be discussed at the upcoming Frontend Pluggability summit.