Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
071d8d095c | ||
|
|
a867d0e5b3 | ||
|
|
30619822a7 | ||
|
|
357b1c844d | ||
|
|
0ee56a0eeb | ||
|
|
0ec21e4c1f | ||
|
|
9c2dd032d1 | ||
|
|
ab26fd84fe | ||
|
|
8aebaf7583 | ||
|
|
77d28e2aba | ||
|
|
40b9526f92 | ||
|
|
462b64f720 | ||
|
|
931710d489 | ||
|
|
b871bb6835 | ||
|
|
4dbd66a615 | ||
|
|
c797320d71 | ||
|
|
b1ca0dd34e | ||
|
|
6b256eb09e | ||
|
|
78267b5326 | ||
|
|
f06bea9612 | ||
|
|
242a03ee72 | ||
|
|
4b35d64d13 | ||
|
|
16d179d9b0 | ||
|
|
42d6535969 | ||
|
|
ba1036c7ed | ||
|
|
c6fb8acb63 | ||
|
|
78c816dd68 | ||
|
|
6f2253e904 | ||
|
|
1b618bcbab | ||
|
|
6511559261 | ||
|
|
e96c3c9c31 | ||
|
|
0052682b6e | ||
|
|
6b36f988fe | ||
|
|
ebca3d7620 | ||
|
|
d964848714 | ||
|
|
8bfecc1309 | ||
|
|
0294b5d5b6 | ||
|
|
8f7e4f3059 | ||
|
|
3e2881fa27 | ||
|
|
aa49509606 | ||
|
|
b60c97667e | ||
|
|
e9a2cb3df1 | ||
|
|
de024e175d | ||
|
|
6dd5db108e |
2
.env
2
.env
@@ -35,3 +35,5 @@ LOGO_URL=''
|
||||
LOGO_TRADEMARK_URL=''
|
||||
LOGO_WHITE_URL=''
|
||||
FAVICON_URL=''
|
||||
ENABLE_LEARNER_RECORD_MFE=''
|
||||
LEARNER_RECORD_MFE_BASE_URL=''
|
||||
|
||||
@@ -36,3 +36,5 @@ LOGO_URL=https://edx-cdn.org/v3/default/logo.svg
|
||||
LOGO_TRADEMARK_URL=https://edx-cdn.org/v3/default/logo-trademark.svg
|
||||
LOGO_WHITE_URL=https://edx-cdn.org/v3/default/logo-white.svg
|
||||
FAVICON_URL=https://edx-cdn.org/v3/default/favicon.ico
|
||||
ENABLE_LEARNER_RECORD_MFE=''
|
||||
LEARNER_RECORD_MFE_BASE_URL='http://localhost:1990'
|
||||
|
||||
@@ -17,3 +17,5 @@ LOGO_URL=https://edx-cdn.org/v3/default/logo.svg
|
||||
LOGO_TRADEMARK_URL=https://edx-cdn.org/v3/default/logo-trademark.svg
|
||||
LOGO_WHITE_URL=https://edx-cdn.org/v3/default/logo-white.svg
|
||||
FAVICON_URL=https://edx-cdn.org/v3/default/favicon.ico
|
||||
ENABLE_LEARNER_RECORD_MFE=''
|
||||
LEARNER_RECORD_MFE_BASE_URL='http://localhost:1990'
|
||||
|
||||
@@ -49,13 +49,6 @@ This MFE is configured via node environment variables supplied at build time. Se
|
||||
For more information see the document: `Micro-frontend applications in Open
|
||||
edX <https://edx.readthedocs.io/projects/edx-developer-docs/en/latest/micro-frontends-in-open-edx.html>`__.
|
||||
|
||||
----------
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
||||
The production Webpack configuration for this repo uses `Purgecss <https://www.purgecss.com/>`__ to remove unused CSS from the production css file. In ``webpack.prod.config.js`` the Purgecss plugin is configured to scan directories to determine what css selectors should remain. Currently the src/ directory is scanned along with all ``@edx/frontend-component*`` node modules and ``@edx/paragon``. **If you add and use a component in this repo that relies on HTML classes or ids for styling you must add it to the Purgecss configuration or it will be unstyled in the production build.**
|
||||
|
||||
.. |Build Status| image:: https://api.travis-ci.org/edx/frontend-app-profile.svg?branch=master
|
||||
:target: https://travis-ci.org/edx/frontend-app-profile
|
||||
.. |Codecov| image:: https://img.shields.io/codecov/c/github/edx/frontend-app-profile
|
||||
|
||||
11727
package-lock.json
generated
11727
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
39
package.json
39
package.json
@@ -41,21 +41,21 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@edx/brand": "npm:@edx/brand-openedx@1.1.0",
|
||||
"@edx/frontend-component-footer": "10.1.5",
|
||||
"@edx/frontend-component-header": "2.2.4",
|
||||
"@edx/frontend-platform": "1.8.4",
|
||||
"@edx/paragon": "13.1.2",
|
||||
"@edx/frontend-component-footer": "10.1.6",
|
||||
"@edx/frontend-component-header": "2.3.0",
|
||||
"@edx/frontend-platform": "1.12.3",
|
||||
"@edx/paragon": "16.6.1",
|
||||
"@fortawesome/fontawesome-svg-core": "1.2.25",
|
||||
"@fortawesome/free-brands-svg-icons": "5.7.2",
|
||||
"@fortawesome/free-regular-svg-icons": "5.7.2",
|
||||
"@fortawesome/free-solid-svg-icons": "5.7.2",
|
||||
"@fortawesome/react-fontawesome": "0.1.8",
|
||||
"classnames": "2.2.6",
|
||||
"core-js": "3.8.3",
|
||||
"classnames": "2.3.1",
|
||||
"core-js": "3.16.1",
|
||||
"email-prop-type": "1.1.7",
|
||||
"font-awesome": "4.7.0",
|
||||
"form-urlencoded": "3.0.2",
|
||||
"history": "4.7.2",
|
||||
"history": "4.10.1",
|
||||
"lodash.camelcase": "4.3.0",
|
||||
"lodash.get": "4.4.2",
|
||||
"lodash.memoize": "4.1.2",
|
||||
@@ -65,30 +65,29 @@
|
||||
"prop-types": "15.7.2",
|
||||
"react": "16.14.0",
|
||||
"react-dom": "16.14.0",
|
||||
"react-redux": "7.2.2",
|
||||
"react-router": "5.1.2",
|
||||
"react-router-dom": "5.1.2",
|
||||
"react-transition-group": "4.3.0",
|
||||
"redux": "4.0.5",
|
||||
"react-redux": "7.2.4",
|
||||
"react-router": "5.2.0",
|
||||
"react-router-dom": "5.2.0",
|
||||
"react-transition-group": "4.4.2",
|
||||
"redux": "4.1.1",
|
||||
"redux-devtools-extension": "2.13.9",
|
||||
"redux-logger": "3.0.6",
|
||||
"redux-saga": "1.1.3",
|
||||
"redux-thunk": "2.3.0",
|
||||
"regenerator-runtime": "0.13.7",
|
||||
"regenerator-runtime": "0.13.9",
|
||||
"reselect": "4.0.0",
|
||||
"universal-cookie": "3.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "8.3.5",
|
||||
"@commitlint/config-angular": "8.3.4",
|
||||
"@edx/frontend-build": "5.6.8",
|
||||
"codecov": "3.8.2",
|
||||
"@commitlint/cli": "13.1.0",
|
||||
"@commitlint/config-angular": "13.1.0",
|
||||
"@edx/frontend-build": "7.1.0",
|
||||
"codecov": "3.8.3",
|
||||
"enzyme": "3.11.0",
|
||||
"enzyme-adapter-react-16": "1.15.6",
|
||||
"es-check": "5.2.3",
|
||||
"es-check": "5.2.4",
|
||||
"glob": "7.1.7",
|
||||
"husky": "3.1.0",
|
||||
"purgecss-webpack-plugin": "1.6.0",
|
||||
"husky": "7.0.1",
|
||||
"react-test-renderer": "16.14.0",
|
||||
"reactifex": "1.1.1",
|
||||
"redux-mock-store": "1.5.4"
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
APP_INIT_ERROR,
|
||||
APP_READY,
|
||||
initialize,
|
||||
mergeConfig,
|
||||
subscribe,
|
||||
} from '@edx/frontend-platform';
|
||||
import {
|
||||
@@ -55,4 +56,12 @@ initialize({
|
||||
],
|
||||
requireAuthenticatedUser: true,
|
||||
hydrateAuthenticatedUser: true,
|
||||
handlers: {
|
||||
config: () => {
|
||||
mergeConfig({
|
||||
ENABLE_LEARNER_RECORD_MFE: (process.env.ENABLE_LEARNER_RECORD_MFE || false),
|
||||
LEARNER_RECORD_MFE_BASE_URL: process.env.LEARNER_RECORD_MFE_BASE_URL,
|
||||
}, 'App loadConfig override handler');
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { sendTrackingLogEvent } from '@edx/frontend-platform/analytics';
|
||||
import { ensureConfig } from '@edx/frontend-platform';
|
||||
import { ensureConfig, getConfig } from '@edx/frontend-platform';
|
||||
import { AppContext } from '@edx/frontend-platform/react';
|
||||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||
import { StatusAlert, Hyperlink } from '@edx/paragon';
|
||||
@@ -44,10 +44,11 @@ ensureConfig(['CREDENTIALS_BASE_URL', 'LMS_BASE_URL'], 'ProfilePage');
|
||||
class ProfilePage extends React.Component {
|
||||
constructor(props, context) {
|
||||
super(props, context);
|
||||
const credentialsBaseUrl = context.config.CREDENTIALS_BASE_URL;
|
||||
|
||||
const recordsUrl = this.getRecordsUrl(context);
|
||||
|
||||
this.state = {
|
||||
viewMyRecordsUrl: credentialsBaseUrl ? `${credentialsBaseUrl}/records` : null,
|
||||
viewMyRecordsUrl: recordsUrl,
|
||||
accountSettingsUrl: `${context.config.LMS_BASE_URL}/account/settings`,
|
||||
};
|
||||
|
||||
@@ -66,6 +67,19 @@ class ProfilePage extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
getRecordsUrl(context) {
|
||||
let recordsUrl = null;
|
||||
|
||||
if (getConfig().ENABLE_LEARNER_RECORD_MFE) {
|
||||
recordsUrl = getConfig().LEARNER_RECORD_MFE_BASE_URL;
|
||||
} else {
|
||||
const credentialsBaseUrl = context.config.CREDENTIALS_BASE_URL;
|
||||
recordsUrl = credentialsBaseUrl ? `${credentialsBaseUrl}/records` : null;
|
||||
}
|
||||
|
||||
return recordsUrl;
|
||||
}
|
||||
|
||||
isAuthenticatedUserProfile() {
|
||||
return this.props.match.params.username === this.context.authenticatedUser.username;
|
||||
}
|
||||
|
||||
@@ -245,7 +245,6 @@ exports[`<ProfilePage /> Renders correctly in various states viewing own profile
|
||||
>
|
||||
<div
|
||||
className="dropdown"
|
||||
onKeyDown={[Function]}
|
||||
>
|
||||
<button
|
||||
aria-expanded={false}
|
||||
@@ -327,14 +326,36 @@ exports[`<ProfilePage /> Renders correctly in various states viewing own profile
|
||||
target="_blank"
|
||||
>
|
||||
View My Records
|
||||
<span>
|
||||
<span
|
||||
className="d-inline-block align-text-top"
|
||||
>
|
||||
|
||||
<span
|
||||
aria-hidden={false}
|
||||
aria-label="Opens in a new window"
|
||||
className="fa fa-external-link"
|
||||
title="Opens in a new window"
|
||||
/>
|
||||
className="pgn__icon"
|
||||
style={
|
||||
Object {
|
||||
"height": "1em",
|
||||
"width": "1em",
|
||||
}
|
||||
}
|
||||
>
|
||||
<svg
|
||||
aria-hidden={true}
|
||||
aria-label=""
|
||||
fill="none"
|
||||
focusable={false}
|
||||
height={24}
|
||||
role="img"
|
||||
viewBox="0 0 24 24"
|
||||
width={24}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M19 19H5V5h7V3H3v18h18v-9h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
@@ -383,14 +404,36 @@ exports[`<ProfilePage /> Renders correctly in various states viewing own profile
|
||||
target="_blank"
|
||||
>
|
||||
View My Records
|
||||
<span>
|
||||
<span
|
||||
className="d-inline-block align-text-top"
|
||||
>
|
||||
|
||||
<span
|
||||
aria-hidden={false}
|
||||
aria-label="Opens in a new window"
|
||||
className="fa fa-external-link"
|
||||
title="Opens in a new window"
|
||||
/>
|
||||
className="pgn__icon"
|
||||
style={
|
||||
Object {
|
||||
"height": "1em",
|
||||
"width": "1em",
|
||||
}
|
||||
}
|
||||
>
|
||||
<svg
|
||||
aria-hidden={true}
|
||||
aria-label=""
|
||||
fill="none"
|
||||
focusable={false}
|
||||
height={24}
|
||||
role="img"
|
||||
viewBox="0 0 24 24"
|
||||
width={24}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M19 19H5V5h7V3H3v18h18v-9h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
@@ -1178,14 +1221,36 @@ exports[`<ProfilePage /> Renders correctly in various states viewing own profile
|
||||
target="_blank"
|
||||
>
|
||||
View Certificate
|
||||
<span>
|
||||
<span
|
||||
className="d-inline-block align-text-top"
|
||||
>
|
||||
|
||||
<span
|
||||
aria-hidden={false}
|
||||
aria-label="Opens in a new window"
|
||||
className="fa fa-external-link"
|
||||
title="Opens in a new window"
|
||||
/>
|
||||
className="pgn__icon"
|
||||
style={
|
||||
Object {
|
||||
"height": "1em",
|
||||
"width": "1em",
|
||||
}
|
||||
}
|
||||
>
|
||||
<svg
|
||||
aria-hidden={true}
|
||||
aria-label=""
|
||||
fill="none"
|
||||
focusable={false}
|
||||
height={24}
|
||||
role="img"
|
||||
viewBox="0 0 24 24"
|
||||
width={24}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M19 19H5V5h7V3H3v18h18v-9h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
@@ -1231,7 +1296,6 @@ exports[`<ProfilePage /> Renders correctly in various states while saving an edi
|
||||
>
|
||||
<div
|
||||
className="dropdown"
|
||||
onKeyDown={[Function]}
|
||||
>
|
||||
<button
|
||||
aria-expanded={false}
|
||||
@@ -1313,14 +1377,36 @@ exports[`<ProfilePage /> Renders correctly in various states while saving an edi
|
||||
target="_blank"
|
||||
>
|
||||
View My Records
|
||||
<span>
|
||||
<span
|
||||
className="d-inline-block align-text-top"
|
||||
>
|
||||
|
||||
<span
|
||||
aria-hidden={false}
|
||||
aria-label="Opens in a new window"
|
||||
className="fa fa-external-link"
|
||||
title="Opens in a new window"
|
||||
/>
|
||||
className="pgn__icon"
|
||||
style={
|
||||
Object {
|
||||
"height": "1em",
|
||||
"width": "1em",
|
||||
}
|
||||
}
|
||||
>
|
||||
<svg
|
||||
aria-hidden={true}
|
||||
aria-label=""
|
||||
fill="none"
|
||||
focusable={false}
|
||||
height={24}
|
||||
role="img"
|
||||
viewBox="0 0 24 24"
|
||||
width={24}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M19 19H5V5h7V3H3v18h18v-9h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
@@ -1369,14 +1455,36 @@ exports[`<ProfilePage /> Renders correctly in various states while saving an edi
|
||||
target="_blank"
|
||||
>
|
||||
View My Records
|
||||
<span>
|
||||
<span
|
||||
className="d-inline-block align-text-top"
|
||||
>
|
||||
|
||||
<span
|
||||
aria-hidden={false}
|
||||
aria-label="Opens in a new window"
|
||||
className="fa fa-external-link"
|
||||
title="Opens in a new window"
|
||||
/>
|
||||
className="pgn__icon"
|
||||
style={
|
||||
Object {
|
||||
"height": "1em",
|
||||
"width": "1em",
|
||||
}
|
||||
}
|
||||
>
|
||||
<svg
|
||||
aria-hidden={true}
|
||||
aria-label=""
|
||||
fill="none"
|
||||
focusable={false}
|
||||
height={24}
|
||||
role="img"
|
||||
viewBox="0 0 24 24"
|
||||
width={24}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M19 19H5V5h7V3H3v18h18v-9h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
@@ -2044,12 +2152,31 @@ exports[`<ProfilePage /> Renders correctly in various states while saving an edi
|
||||
className="pgn__stateful-btn-icon"
|
||||
>
|
||||
<span
|
||||
aria-hidden={true}
|
||||
className="icon fa fa-spinner fa-spin"
|
||||
id="Icon1"
|
||||
/>
|
||||
className="pgn__icon icon-spin"
|
||||
>
|
||||
<svg
|
||||
aria-hidden={true}
|
||||
aria-label=""
|
||||
fill="none"
|
||||
focusable={false}
|
||||
height={24}
|
||||
role="img"
|
||||
viewBox="0 0 24 24"
|
||||
width={24}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M22 12A10 10 0 116.122 3.91l1.176 1.618A8 8 0 1020 12h2z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</span>
|
||||
<span
|
||||
className=""
|
||||
>
|
||||
Saving
|
||||
</span>
|
||||
Saving
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
@@ -2216,14 +2343,36 @@ exports[`<ProfilePage /> Renders correctly in various states while saving an edi
|
||||
target="_blank"
|
||||
>
|
||||
View Certificate
|
||||
<span>
|
||||
<span
|
||||
className="d-inline-block align-text-top"
|
||||
>
|
||||
|
||||
<span
|
||||
aria-hidden={false}
|
||||
aria-label="Opens in a new window"
|
||||
className="fa fa-external-link"
|
||||
title="Opens in a new window"
|
||||
/>
|
||||
className="pgn__icon"
|
||||
style={
|
||||
Object {
|
||||
"height": "1em",
|
||||
"width": "1em",
|
||||
}
|
||||
}
|
||||
>
|
||||
<svg
|
||||
aria-hidden={true}
|
||||
aria-label=""
|
||||
fill="none"
|
||||
focusable={false}
|
||||
height={24}
|
||||
role="img"
|
||||
viewBox="0 0 24 24"
|
||||
width={24}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M19 19H5V5h7V3H3v18h18v-9h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
@@ -2269,7 +2418,6 @@ exports[`<ProfilePage /> Renders correctly in various states without credentials
|
||||
>
|
||||
<div
|
||||
className="dropdown"
|
||||
onKeyDown={[Function]}
|
||||
>
|
||||
<button
|
||||
aria-expanded={false}
|
||||
@@ -3164,14 +3312,36 @@ exports[`<ProfilePage /> Renders correctly in various states without credentials
|
||||
target="_blank"
|
||||
>
|
||||
View Certificate
|
||||
<span>
|
||||
<span
|
||||
className="d-inline-block align-text-top"
|
||||
>
|
||||
|
||||
<span
|
||||
aria-hidden={false}
|
||||
aria-label="Opens in a new window"
|
||||
className="fa fa-external-link"
|
||||
title="Opens in a new window"
|
||||
/>
|
||||
className="pgn__icon"
|
||||
style={
|
||||
Object {
|
||||
"height": "1em",
|
||||
"width": "1em",
|
||||
}
|
||||
}
|
||||
>
|
||||
<svg
|
||||
aria-hidden={true}
|
||||
aria-label=""
|
||||
fill="none"
|
||||
focusable={false}
|
||||
height={24}
|
||||
role="img"
|
||||
viewBox="0 0 24 24"
|
||||
width={24}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M19 19H5V5h7V3H3v18h18v-9h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
const glob = require('glob');
|
||||
const PurgecssPlugin = require('purgecss-webpack-plugin');
|
||||
const { createConfig } = require('@edx/frontend-build');
|
||||
|
||||
module.exports = createConfig('webpack-prod', {
|
||||
plugins: [
|
||||
// Scan files for class names and ids and remove unused css
|
||||
new PurgecssPlugin({
|
||||
paths: [].concat(
|
||||
// Scan files in this app
|
||||
glob.sync('src/**/*', { nodir: true }),
|
||||
// Scan files in any edx frontend-component
|
||||
glob.sync('node_modules/@edx/frontend-component*/**/*', { nodir: true }),
|
||||
// Scan files in paragon
|
||||
glob.sync('node_modules/@edx/paragon/**/*', { nodir: true }),
|
||||
),
|
||||
// Protect react-css-transition class names
|
||||
whitelistPatterns: [/-enter/, /-appear/, /-exit/],
|
||||
}),
|
||||
],
|
||||
});
|
||||
Reference in New Issue
Block a user