@openedx/frontend-app-learner-dashboard 1.0.0 → 2.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.rst +295 -49
  2. package/package.json +1 -1
package/README.rst CHANGED
@@ -1,61 +1,263 @@
1
- |license-badge| |status-badge| |ci-badge| |codecov-badge|
1
+ ##############################
2
+ frontend-app-learner-dashboard
3
+ ##############################
2
4
 
3
- .. |license-badge| image:: https://img.shields.io/github/license/openedx/frontend-app-learner-dashboard.svg
4
- :target: https://github.com/openedx/frontend-app-learner-dashboard/blob/master/LICENSE
5
- :alt: License
6
- .. |status-badge| image:: https://img.shields.io/badge/Status-Maintained-brightgreen
7
- :alt: Maintained
8
- .. |ci-badge| image:: https://github.com/openedx/frontend-app-learner-dashboard/actions/workflows/ci.yml/badge.svg
9
- :target: https://github.com/openedx/frontend-app-learner-dashboard/actions/workflows/ci.yml
10
- :alt: Continuous Integration
11
- .. |codecov-badge| image:: https://codecov.io/github/openedx/frontend-app-learner-dashboard/coverage.svg?branch=master
12
- :target: https://app.codecov.io/github/openedx/frontend-app-learner-dashboard?branch=master
13
- :alt: Codecov
5
+ |license-badge| |status-badge| |ci-badge| |codecov-badge| |semantic-release|
14
6
 
15
- frontend-app-learner-dashboard
16
- ==============================
7
+ The Learner Dashboard is a `frontend-base`_ application: a library that plugs
8
+ into the Open edX frontend shell, rather than a standalone micro-frontend
9
+ bundled with its own webpack build.
17
10
 
18
- The Learner Home app is a microfrontend (MFE) course listing experience for the Open edX Learning Management System
19
- (LMS). This experience was designed to provide a clean and functional interface to allow learners to view all of their
20
- open enrollments, as well as take relevant actions on those enrollments. It also serves as host to a number of exposed
21
- "widget" containers to provide upsell and discovery widgets as sidebar components.
11
+ .. _frontend-base: https://github.com/openedx/frontend-base
22
12
 
23
- Quickstart
24
- ----------
13
+ ********
14
+ Purpose
15
+ ********
25
16
 
26
- To start the MFE and enable the feature in LMS:
17
+ This app is the course listing experience for the Open edX Learning Management
18
+ System. It gives learners a single place to see all of their open enrollments
19
+ and act on them: resume a course, change a session, manage email settings,
20
+ unenroll, view related programs, and pursue credit or certificates.
27
21
 
28
- 1. Start the MFE with ``npm run start``. Take a note of the path/port (defaults to ``http://localhost:1996``).
22
+ It also hosts a sidebar of widget slots, which operators use for upsell and
23
+ discovery components.
29
24
 
30
- From there, simply load the configured address/port. You should be prompted to log into your LMS if you are not
31
- already, and then redirected to your home page.
25
+ *********************
26
+ Branches and Releases
27
+ *********************
32
28
 
33
- Widgets
34
- -------
35
- This MFE can be customized with widgets. The parts of this MFE that can be customized in that manner are documented
36
- `here </src/slots>`_.
29
+ This app is published to NPM by ``semantic-release``, and its branches follow
30
+ `OEP-10 ADR 0002`_:
37
31
 
38
- License
39
- -------
32
+ ``master``
33
+ Unstable. Every merge publishes a prerelease on the ``alpha`` dist-tag.
34
+ Breaking changes land here with no DEPR process and no warning, so it is not
35
+ supported in production. All changes, including bug fixes, should target this
36
+ branch first.
40
37
 
41
- The code in this repository is licensed under the AGPLv3 unless otherwise noted.
38
+ ``stable``
39
+ Carries the newest stable major and owns the ``latest`` dist-tag. Changes
40
+ arrive here as backports from ``master``, and no breaking change lands after
41
+ publication.
42
+
43
+ ``n.x`` and ``n.m.x``
44
+ Maintenance branches for majors and minors that ``stable`` has moved past.
45
+ Each owns the dist-tag matching its own name, so consumers select a maintained
46
+ line by semver range, e.g. ``"1.x"``.
47
+
48
+ ``stable`` is cut, and ``1.0.0`` is the current stable release. Both
49
+ ``.releaserc`` and the ``Release CI`` workflow know the whole layout, including
50
+ the maintenance branch patterns, so a new line starts publishing as soon as it
51
+ is pushed.
52
+
53
+ This repository is no longer branched or tagged for Open edX releases in its own
54
+ right. It participates by published version instead, per `OEP-10 ADR 0003`_.
55
+
56
+ The micro-frontend this app replaces goes on living on `legacy-mfe`_, which is
57
+ where any further ``release/RELEASENAME`` branches for it are cut, for as long as
58
+ a supported release still ships it. Teak, Ulmo and Verawood all do.
59
+
60
+ .. _OEP-10 ADR 0002: https://docs.openedx.org/projects/openedx-proposals/en/latest/processes/oep-0010/decisions/0002-frontend-stable-branches.html
61
+ .. _OEP-10 ADR 0003: https://docs.openedx.org/projects/openedx-proposals/en/latest/processes/oep-0010/decisions/0003-frontend-release-strategy.html
62
+ .. _legacy-mfe: https://github.com/openedx/frontend-app-learner-dashboard/tree/legacy-mfe
63
+
64
+ ***************
65
+ Getting Started
66
+ ***************
67
+
68
+ Prerequisites
69
+ =============
70
+
71
+ A running Open edX instance is needed to serve this app's backend APIs.
72
+ `Tutor`_ in development mode is the usual choice, and ``site.config.dev.tsx``
73
+ already points at its default hostnames.
74
+
75
+ Unlike a micro-frontend, this app is neither built nor served by ``tutor-mfe``.
76
+ The dev server below runs on the host. Note that ``tutor-mfe`` v22 and later do
77
+ ship this app as a frontend-base application for *deployment*, disabled by
78
+ default; see `Frontend apps`_ in its README to enable it.
79
+
80
+ .. _Tutor: https://github.com/overhangio/tutor
81
+ .. _Frontend apps: https://github.com/overhangio/tutor-mfe#frontend-apps
82
+
83
+ Cloning and Startup
84
+ ===================
85
+
86
+ 1. Clone the repo:
87
+
88
+ ``git clone https://github.com/openedx/frontend-app-learner-dashboard.git``
89
+
90
+ 2. Use the version of Node specified in the ``.nvmrc`` file.
91
+
92
+ Using other major versions of Node *may* work, but is unsupported. This
93
+ repository includes an ``.nvmrc`` file to help set the correct Node version
94
+ via `nvm <https://github.com/nvm-sh/nvm>`_.
95
+
96
+ 3. Install npm dependencies:
97
+
98
+ ``cd frontend-app-learner-dashboard && npm install``
99
+
100
+ 4. Start the dev server:
101
+
102
+ ``npm run dev``
103
+
104
+ The dev server defaults to ``PORT=1996 PUBLIC_PATH=/learner-dashboard`` (set in
105
+ the ``dev`` script in ``package.json``) and is available at
106
+ `http://apps.local.openedx.io:1996/learner-dashboard <http://apps.local.openedx.io:1996/learner-dashboard>`_.
107
+
108
+ Configuration used by the dev server is defined in ``site.config.dev.tsx`` at
109
+ the repo root.
110
+
111
+ Local Development Against ``frontend-base``
112
+ ===========================================
113
+
114
+ To develop this app and a local checkout of ``frontend-base`` in tandem, use the
115
+ built-in npm workspace support:
116
+
117
+ .. code-block:: sh
118
+
119
+ mkdir -p packages/frontend-base
120
+ sudo mount --bind /path/to/frontend-base packages/frontend-base
121
+ npm install
122
+ npm run dev:packages
123
+
124
+ Bind mounts are used instead of symlinks because Node resolves symlinks to their
125
+ real paths, which breaks hoisted dependency resolution. When you are done,
126
+ unmount with ``sudo umount packages/frontend-base``.
127
+
128
+ Configuration
129
+ =============
130
+
131
+ This app is no longer configured by build-time environment variables.
132
+ ``getAppConfig`` resolves three sources, in order of increasing precedence: the
133
+ app's bundled defaults, the site's ``commonAppConfig``, and the app's ``config``.
134
+ The first is the app author's, at build time; the other two are the operator's,
135
+ the second applying to every app on the site and the third to this app alone. In
136
+ edx-platform they arrive as ``MFE_CONFIG`` and
137
+ ``MFE_CONFIG_OVERRIDES['learner-dashboard']`` respectively.
138
+
139
+ The full list of keys and their defaults is the ``config`` block in
140
+ ``src/app.ts``:
141
+
142
+ .. list-table::
143
+ :widths: 30 50 20
144
+ :header-rows: 1
145
+
146
+ * - Name
147
+ - Description / Usage
148
+ - Example
149
+
150
+ * - ``LEARNING_BASE_URL``
151
+ - Base URL of the Learning MFE, used to build course home and courseware
152
+ links from the dashboard's cards.
153
+ - ``http://apps.local.openedx.io:2000``
42
154
 
43
- Please see the `license`_ for more info.
155
+ * - ``ENABLE_PROGRAMS``
156
+ - Shows the Programs link in the header's primary navigation, pointing at
157
+ the LMS's ``/dashboard/programs``. The related-programs badges and
158
+ banners on course cards are driven by course data and are not affected by
159
+ this.
160
+ - ``false``
44
161
 
45
- .. _license: https://github.com/openedx/frontend-app-learner-dashboard/blob/master/LICENSE
162
+ * - ``ECOMMERCE_BASE_URL``
163
+ - Base URL of the ecommerce service. Used to build the credit checkout
164
+ link, as ``ECOMMERCE_BASE_URL/credit/checkout/COURSE_ID/``.
165
+ - ``''``
46
166
 
167
+ * - ``CREDIT_PURCHASE_URL``
168
+ - Overrides the credit checkout link with ``CREDIT_PURCHASE_URL/COURSE_ID/``,
169
+ for deployments whose credit purchase flow does not live behind
170
+ ``ECOMMERCE_BASE_URL``. It has no bundled default; set it to take
171
+ precedence.
172
+ - ``''``
173
+
174
+ * - ``ORDER_HISTORY_URL``
175
+ - Destination of the order history link in the header menu. The link is
176
+ hidden when this is empty.
177
+ - ``''``
178
+
179
+ * - ``SHOW_UNENROLL_SURVEY``
180
+ - Shows the survey that asks learners why they unenrolled, as the last step
181
+ of the unenrollment flow.
182
+ - ``false``
183
+
184
+ *****
185
+ Slots
186
+ *****
187
+
188
+ This app offers slots for operators to customize its pages. See `src/slots/`_
189
+ for the current list and per-slot READMEs with usage examples.
190
+
191
+ .. _src/slots/: ./src/slots/
192
+
193
+ **********
194
+ Developing
195
+ **********
196
+
197
+ Project Structure
198
+ =================
199
+
200
+ The layout follows the standard `frontend-base app layout`_:
201
+
202
+ - ``src/app.ts`` - the app definition imported by ``site.config.*.tsx``.
203
+ - ``src/constants.ts`` - the app's ``appId`` and route role identifiers.
204
+ - ``src/index.ts`` - the package's public exports (this is a library).
205
+ - ``src/routes.jsx`` - the app's react-router routes.
206
+ - ``src/Main.jsx`` - the root component for the app's routes.
207
+ - ``src/providers.ts`` - the context providers the app wraps the site in.
208
+ - ``src/slots.tsx`` - slot operations this app performs on *other* apps' slots,
209
+ such as the header.
210
+ - ``src/slots/`` - the slots this app offers to consumers.
211
+ - ``src/widgets/`` - components this app contributes to slots, including its
212
+ header.
213
+ - ``src/style.scss`` - app-scoped runtime styles.
214
+
215
+ Everything else under ``src/`` is a feature or shared-concern directory:
216
+ ``containers/`` for the page's composed pieces, ``components/`` for the reusable
217
+ ones, ``data/`` for API access and React Query hooks, and ``hooks/``,
218
+ ``tracking/`` and ``utils/`` for the shared remainder.
219
+
220
+ For more, see the `frontend-base migration how-to`_.
221
+
222
+ .. _frontend-base app layout: https://github.com/openedx/frontend-base/blob/main/docs/how_tos/migrate-frontend-app.md#src-file-structure
223
+ .. _frontend-base migration how-to: https://github.com/openedx/frontend-base/blob/main/docs/how_tos/migrate-frontend-app.md
224
+
225
+ Build Process Notes
226
+ ===================
227
+
228
+ **Library build**
229
+
230
+ ``npm run build`` compiles the library into ``dist/`` via ``tsc`` and
231
+ ``tsc-alias``, and copies the SCSS and asset files across. This is what gets
232
+ published and consumed by sites.
233
+
234
+ **CI build**
235
+
236
+ ``npm run build:ci`` runs ``openedx build`` against ``site.config.ci.tsx`` so
237
+ webpack traverses the full app graph. This catches issues, such as broken
238
+ lazy-loaded imports, that ``tsc`` and Jest would not surface.
239
+
240
+ Internationalization
241
+ ====================
242
+
243
+ Please refer to the `frontend-base i18n howto`_ for documentation on
244
+ internationalization.
245
+
246
+ .. _frontend-base i18n howto: https://github.com/openedx/frontend-base/blob/main/docs/how_tos/i18n.rst
247
+
248
+ ************
47
249
  Getting Help
48
- ------------
250
+ ************
49
251
 
50
- If you're having trouble, we have discussion forums at https://discuss.openedx.org where you can connect with others in
51
- the community.
252
+ If you're having trouble, we have discussion forums at
253
+ https://discuss.openedx.org where you can connect with others in the community.
52
254
 
53
- Our real-time conversations are on Slack. You can request a `Slack invitation`_, then join our
54
- `community Slack workspace`_. Because this is a frontend repository, the best place to discuss it would be in the
55
- `#wg-frontend channel`_.
255
+ Our real-time conversations are on Slack. You can request a `Slack invitation`_,
256
+ then join our `community Slack workspace`_. Because this is a frontend
257
+ repository, the best place to discuss it would be in the `#wg-frontend channel`_.
56
258
 
57
- For anything non-trivial, the best path is to open an issue in this repository with as many details about the issue you
58
- are facing as you can provide.
259
+ For anything non-trivial, the best path is to open an issue in this repository
260
+ with as many details about the issue you are facing as you can provide.
59
261
 
60
262
  https://github.com/openedx/frontend-app-learner-dashboard/issues
61
263
 
@@ -64,23 +266,67 @@ For more information about these options, see the `Getting Help`_ page.
64
266
  .. _Slack invitation: https://openedx.org/slack
65
267
  .. _community Slack workspace: https://openedx.slack.com/
66
268
  .. _#wg-frontend channel: https://openedx.slack.com/archives/C04BM6YC7A6
67
- .. _Getting Help: https://openedx.org/community/connect
269
+ .. _Getting Help: https://openedx.org/getting-help
68
270
 
69
- Resources
70
- ---------
271
+ *******
272
+ License
273
+ *******
71
274
 
72
- Additional info about the Learner Home MFE project can be found on the `Open edX Wiki`_.
275
+ The code in this repository is licensed under the AGPLv3 unless otherwise noted.
73
276
 
74
- .. _Open edX Wiki: https://openedx.atlassian.net/wiki/spaces/OEPM/pages/3575906333/Learner+Home
277
+ Please see `LICENSE <LICENSE>`_ for details.
75
278
 
279
+ ************
280
+ Contributing
281
+ ************
282
+
283
+ Contributions are very welcome. Please read `How To Contribute`_ for details.
284
+
285
+ .. _How To Contribute: https://openedx.org/r/how-to-contribute
286
+
287
+ This project is currently accepting all types of contributions, bug fixes and
288
+ security fixes.
289
+
290
+ ****************************
76
291
  The Open edX Code of Conduct
77
- ----------------------------
292
+ ****************************
78
293
 
79
294
  All community members are expected to follow the `Open edX Code of Conduct`_.
80
295
 
81
296
  .. _Open edX Code of Conduct: https://openedx.org/code-of-conduct/
82
297
 
298
+ ******
299
+ People
300
+ ******
301
+
302
+ The assigned maintainers for this component and other project details may be
303
+ found in `Backstage`_. Backstage pulls this data from the ``catalog-info.yaml``
304
+ file in this repo.
305
+
306
+ .. _Backstage: https://backstage.openedx.org/catalog/default/component/frontend-app-learner-dashboard
307
+
308
+ *************************
83
309
  Reporting Security Issues
84
- -------------------------
310
+ *************************
311
+
312
+ Please do not report security issues in public, and email security@openedx.org
313
+ instead.
314
+
315
+ .. |license-badge| image:: https://img.shields.io/github/license/openedx/frontend-app-learner-dashboard.svg
316
+ :target: https://github.com/openedx/frontend-app-learner-dashboard/blob/master/LICENSE
317
+ :alt: License
318
+
319
+ .. |status-badge| image:: https://img.shields.io/badge/Status-Maintained-brightgreen
320
+ :alt: Maintained
321
+
322
+ .. |ci-badge| image:: https://github.com/openedx/frontend-app-learner-dashboard/actions/workflows/ci.yml/badge.svg
323
+ :target: https://github.com/openedx/frontend-app-learner-dashboard/actions/workflows/ci.yml
324
+ :alt: Continuous Integration
325
+
326
+ .. |codecov-badge| image:: https://codecov.io/github/openedx/frontend-app-learner-dashboard/coverage.svg?branch=master
327
+ :target: https://codecov.io/github/openedx/frontend-app-learner-dashboard?branch=master
328
+ :alt: Codecov
85
329
 
86
- Please do not report security issues in public. Please email security@openedx.org.
330
+ .. |semantic-release| image:: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
331
+ :target: https://github.com/semantic-release/semantic-release
332
+ :alt: semantic-release
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openedx/frontend-app-learner-dashboard",
3
- "version": "1.0.0",
3
+ "version": "2.0.0-alpha.1",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",