-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow runtieme configuration (#586)
Allows frontend-app-profile to be configured at runtime using the LMS's new MFE Configuration API. Part of openedx/wg-frontend#103
- Loading branch information
Showing
11 changed files
with
614 additions
and
293 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,9 +30,9 @@ | |
], | ||
"dependencies": { | ||
"@edx/brand": "npm:@edx/[email protected]", | ||
"@edx/frontend-component-footer": "10.3.0", | ||
"@edx/frontend-component-header": "2.6.1", | ||
"@edx/frontend-platform": "1.15.6", | ||
"@edx/frontend-component-footer": "11.2.1", | ||
"@edx/frontend-component-header": "3.2.1", | ||
"@edx/frontend-platform": "2.6.2", | ||
"@edx/paragon": "19.25.3", | ||
"@fortawesome/fontawesome-svg-core": "1.2.36", | ||
"@fortawesome/free-brands-svg-icons": "5.15.4", | ||
|
@@ -51,6 +51,7 @@ | |
"react-redux": "7.2.9", | ||
"react-router": "5.3.4", | ||
"react-router-dom": "5.3.4", | ||
"react-helmet": "^6.1.0", | ||
"redux": "4.2.0", | ||
"redux-devtools-extension": "2.13.9", | ||
"redux-logger": "3.0.6", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react'; | ||
import { Helmet } from 'react-helmet'; | ||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; | ||
import { getConfig } from '@edx/frontend-platform'; | ||
|
||
import messages from './messages'; | ||
|
||
function Head({ intl }) { | ||
return ( | ||
<Helmet> | ||
<title> | ||
{intl.formatMessage(messages['profile.page.title'], { siteName: getConfig().SITE_NAME })} | ||
</title> | ||
<link rel="shortcut icon" href={getConfig().FAVICON_URL} type="image/x-icon" /> | ||
</Helmet> | ||
); | ||
} | ||
|
||
Head.propTypes = { | ||
intl: intlShape.isRequired, | ||
}; | ||
|
||
export default injectIntl(Head); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import { IntlProvider } from '@edx/frontend-platform/i18n'; | ||
import { Helmet } from 'react-helmet'; | ||
import { mount } from 'enzyme'; | ||
import { getConfig } from '@edx/frontend-platform'; | ||
import Head from './Head'; | ||
|
||
describe('Head', () => { | ||
const props = {}; | ||
it('should match render title tag and favicon with the site configuration values', () => { | ||
mount(<IntlProvider locale="en"><Head {...props} /></IntlProvider>); | ||
const helmet = Helmet.peek(); | ||
expect(helmet.title).toEqual(`Profile | ${getConfig().SITE_NAME}`); | ||
expect(helmet.linkTags[0].rel).toEqual('shortcut icon'); | ||
expect(helmet.linkTags[0].href).toEqual(getConfig().FAVICON_URL); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { defineMessages } from '@edx/frontend-platform/i18n'; | ||
|
||
const messages = defineMessages({ | ||
'profile.page.title': { | ||
id: 'profile.page.title', | ||
defaultMessage: 'Profile | {siteName}', | ||
description: 'Title tag', | ||
}, | ||
}); | ||
|
||
export default messages; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.