* Extensive refactor of application data management.
- “course-blocks” and “course-meta” are replaced with “courseware” module. This obscures the difference between the two from the application itself.
- a generic “model-store” module is used to store all course, section, sequence, and unit data in a normalized way, agnostic to the metadata vs. blocks APIs.
- SequenceContainer has been removed, and it’s work is just done in CourseContainer instead.
- UI components are - in general - more responsible for deciding their own behavior during data loading. If they want to show a spinner or nothing, it’s up to their discretion.
- The API layer is responsible for normalizing data into a form the app will want to use, prior to putting it into the model store.
* Organizing into some more sub-modules.
- Bookmarks becomes it’s own module.
- SequenceNavigation becomes another one.
* More modularization of data directories.
- Moving model-store up to the top.
- Moving fetchCourse and fetchSequence up to the top-level data directory, since they’re used by both courseware and outline.
- Moving getBlockCompletion and updateSequencePosition into the courseware/data directory, since they pertain to that page.
* Normalizing on using the word “title”
* Using history.replace instead of history.push
This fixes TNL-7125
* Allowing sub-components to use hooks and redux
This reduces the amount of data we need to pass around, and lets us move some complexity to more natural modules.
* Fixing bug where enrollment alert is shown for undefined isEnrolled
The enrollment alert would inadvertently be shown if a user navigated from the outline to the course. This was because it interpreted an undefined “isEnrolled” flag as false. Instead, we should wait for the isEnrolled flag to be explicitly true or false.
* Organizing modules.
- Renaming “outline” to “course-home”.
- Moving sequence and sequence-navigation modules under the course module.
* Some final application organization and ADR write-ups.
* Final refactoring
- Favoring passing data by ID and looking it up in the store with useModel.
- Moving headers into course-header directory.
* Updating ADRs. Splitting model-store information out into its own ADR.
TNL-7072.
- Refactors some of the css container/content class naming
- Moved UnitNavigation out of the Sequence and into its own component.
- Fixes an issue with course tabs where multi-word titles would wrap text.
TNL-7072 mobile layout updates. Breadcrumbs truncate section and subsection titles with ellipsis. Tabs that would overflow are tucked under a "more" dropdown.
At the end, the “next” button at the bottom of the page is replaced with a friendly message.
This PR also alphabetizes some props for SequenceNavigation and Sequence, as I was adding two new ones - isFirst and isLast.
* refactor: Moving PageLoading up to the top
This way it can be used on both the courseware and outline pages.
* Adding index.js files to data directories, and PropTypes data shapes
- The course-blocks and course-meta data directories now have index files so their exports can be imported from that, rather than reaching into specific files in the directories.
- Also added “shapes” for use in React Components that use PropTypes for the course blocks data structure, and the course metadata data structure.
* Simplifying/refactoring CourseContainer rendering a bit.
* Adding course outline page.
This page is not complete.
- It contains the ‘outline’ itself with links to the Sequences in the course.
- It contains a very basic stab at displaying dates - they’re not even formatted.
- It shows logistration and enrollment alerts for anonymous and unenrolled users.
It does not include any other content in the right-hand sidebar. It also doesn’t include a welcome message, or perhaps any number of other features on the page. This is effectively an initial implementation for discovering how much data we’re missing from our APIs. It should not be used as-is by any means.
The two functions removed here are duplicated (and actually used from) course-blocks/api.js. Think it was just a refactoring oversight from a few weeks ago.
* build: bumping version of frontend-platform
We’re going to need to use the new getLoginRedirectUrl helper.
* Adding custom alerts for anonymous and unenrolled users.
- Anonymous users are prompted to sign in or register.
- Unenrolled users are prompted to enroll.
The alerts themselves are lazy-loaded as necessary, like the ContentLock component.
This PR also adds `customAlerts` to the AlertList, allowing an application to specify custom components to be shown as Alerts for a given alert code.
* refactor: Renaming enrollmentIsActive to isEnrolled
As per review feedback that the former wasn’t clear.
* If the user does not have access to the course, then redirect to the course outline.
In a subsequent PR, if this API call is made on the course outline page in the MFE, we’ll need to be able to prevent the redirect. But that view of the MFE doesn’t exist yet.
* Moving course outline redirect logic into CourseContainer.
This way, depending on the page calling fetchCourseMetadata, we can make an intelligent choice about whether we want to redirect, show a message, etc. By redirecting in the API call handler, then we took that choice away from ourselves.