feat: add open edx header (#254)
* feat: add open edx header ARCH-1151: Add the open edx header. edX pipelines should be configured to override it with the edx header in the deployment pipeline * fix: upgrade frontend-base for merge messages update * Update package.json * Update package.json * Update package-lock.json
This commit is contained in:
@@ -1,120 +0,0 @@
|
||||
import { sendTrackEvent } from '@edx/frontend-analytics';
|
||||
import { App, AuthenticationContext } from '@edx/frontend-base';
|
||||
import SiteHeader from '@edx/frontend-component-site-header';
|
||||
import { injectIntl, intlShape } from '@edx/frontend-i18n';
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { useContext } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import messages from './Header.messages';
|
||||
import HeaderLogo from './logo.svg';
|
||||
|
||||
App.requireConfig([
|
||||
'LMS_BASE_URL',
|
||||
'LOGOUT_URL',
|
||||
'MARKETING_SITE_BASE_URL',
|
||||
'ORDER_HISTORY_URL',
|
||||
'SITE_NAME',
|
||||
], 'ProfilePage');
|
||||
|
||||
function ProfileHeader({ avatar, intl }) {
|
||||
const authentication = useContext(AuthenticationContext);
|
||||
|
||||
const mainMenu = [
|
||||
{
|
||||
type: 'item',
|
||||
href: `${App.config.LMS_BASE_URL}/dashboard`,
|
||||
content: intl.formatMessage(messages['siteheader.links.courses']),
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
href: `${App.config.LMS_BASE_URL}/dashboard/programs`,
|
||||
content: intl.formatMessage(messages['siteheader.links.programs']),
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
href: `${App.config.MARKETING_SITE_BASE_URL}/course`,
|
||||
content: intl.formatMessage(messages['siteheader.links.content.search']),
|
||||
onClick: () => {
|
||||
sendTrackEvent('edx.bi.dashboard.find_courses_button.clicked', {
|
||||
category: 'profile',
|
||||
label: 'header',
|
||||
});
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const userMenu = [
|
||||
{
|
||||
type: 'item',
|
||||
href: `${App.config.LMS_BASE_URL}`,
|
||||
content: intl.formatMessage(messages['siteheader.user.menu.dashboard']),
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
href: `${App.config.LMS_BASE_URL}/u/${authentication.username}`,
|
||||
content: intl.formatMessage(messages['siteheader.user.menu.profile']),
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
href: `${App.config.LMS_BASE_URL}/account/settings`,
|
||||
content: intl.formatMessage(messages['siteheader.user.menu.account.settings']),
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
href: App.config.ORDER_HISTORY_URL,
|
||||
content: intl.formatMessage(messages['siteheader.user.menu.order.history']),
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
href: App.config.LOGOUT_URL,
|
||||
content: intl.formatMessage(messages['siteheader.user.menu.logout']),
|
||||
},
|
||||
];
|
||||
const loggedOutItems = [
|
||||
{
|
||||
type: 'item',
|
||||
href: `${App.config.LMS_BASE_URL}/login`,
|
||||
content: intl.formatMessage(messages['siteheader.user.menu.login']),
|
||||
},
|
||||
{
|
||||
type: 'item',
|
||||
href: `${App.config.LMS_BASE_URL}/register`,
|
||||
content: intl.formatMessage(messages['siteheader.user.menu.register']),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<SiteHeader
|
||||
logo={HeaderLogo}
|
||||
loggedIn
|
||||
username={authentication.username}
|
||||
avatar={avatar}
|
||||
logoAltText={App.config.SITE_NAME}
|
||||
logoDestination={`${App.config.LMS_BASE_URL}/dashboard`}
|
||||
mainMenu={mainMenu}
|
||||
userMenu={userMenu}
|
||||
loggedOutItems={loggedOutItems}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
ProfileHeader.propTypes = {
|
||||
avatar: PropTypes.string,
|
||||
intl: intlShape.isRequired,
|
||||
};
|
||||
|
||||
ProfileHeader.defaultProps = {
|
||||
avatar: null,
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
avatar: state.userAccount.profileImage.hasImage
|
||||
? state.userAccount.profileImage.imageUrlMedium
|
||||
: null,
|
||||
});
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
{},
|
||||
)(injectIntl(ProfileHeader));
|
||||
@@ -1,61 +0,0 @@
|
||||
import { defineMessages } from '@edx/frontend-i18n';
|
||||
|
||||
const messages = defineMessages({
|
||||
'siteheader.links.courses': {
|
||||
id: 'siteheader.links.courses',
|
||||
defaultMessage: 'Courses',
|
||||
description: 'Link to the learner course dashboard',
|
||||
},
|
||||
'siteheader.links.programs': {
|
||||
id: 'siteheader.links.programs',
|
||||
defaultMessage: 'Programs',
|
||||
description: 'Link to the learner program dashboard',
|
||||
},
|
||||
'siteheader.links.content.search': {
|
||||
id: 'siteheader.links.content.search',
|
||||
defaultMessage: 'Discover New',
|
||||
description: 'Link to the content search page',
|
||||
},
|
||||
'siteheader.links.schools': {
|
||||
id: 'siteheader.links.schools',
|
||||
defaultMessage: 'Schools & Partners',
|
||||
description: 'Link to the schools and partners landing page',
|
||||
},
|
||||
'siteheader.user.menu.dashboard': {
|
||||
id: 'siteheader.user.menu.dashboard',
|
||||
defaultMessage: 'Dashboard',
|
||||
description: 'Link to the user dashboard',
|
||||
},
|
||||
'siteheader.user.menu.profile': {
|
||||
id: 'siteheader.user.menu.profile',
|
||||
defaultMessage: 'Profile',
|
||||
description: 'Link to the user profile',
|
||||
},
|
||||
'siteheader.user.menu.account.settings': {
|
||||
id: 'siteheader.user.menu.account.settings',
|
||||
defaultMessage: 'Account',
|
||||
description: 'Link to account settings',
|
||||
},
|
||||
'siteheader.user.menu.order.history': {
|
||||
id: 'siteheader.user.menu.order.history',
|
||||
defaultMessage: 'Order History',
|
||||
description: 'Link to order history',
|
||||
},
|
||||
'siteheader.user.menu.logout': {
|
||||
id: 'siteheader.user.menu.logout',
|
||||
defaultMessage: 'Logout',
|
||||
description: 'Logout link',
|
||||
},
|
||||
'siteheader.user.menu.login': {
|
||||
id: 'siteheader.user.menu.login',
|
||||
defaultMessage: 'Login',
|
||||
description: 'Login link',
|
||||
},
|
||||
'siteheader.user.menu.register': {
|
||||
id: 'siteheader.user.menu.register',
|
||||
defaultMessage: 'Sign Up',
|
||||
description: 'Link to registration',
|
||||
},
|
||||
});
|
||||
|
||||
export default messages;
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="1168px" height="540px" viewBox="0 0 1168 540" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 53.2 (72643) - https://sketchapp.com -->
|
||||
<title>logo</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g id="logo" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<polygon id="Path" fill="#209FDA" fill-rule="nonzero" points="1166.81993 85.5 1166.81993 2.84217094e-14 953.759925 2.84217094e-14 953.759925 85.5 1002.17993 85.5 915.859925 191.98 829.459925 85.5 878.099925 85.5 878.099925 2.84217094e-14 718.919925 2.84217094e-14 718.919925 95.72 856.479925 265.26 718.919925 434.96 718.919925 452.02 784.499925 452.02 784.499925 539.64 878.099925 539.64 878.099925 452.02 823.919925 452.02 915.919925 338.52 915.939925 338.52 1008.03993 452.02 953.759925 452.02 953.759925 539.64 1166.81993 539.64 1166.81993 452.02 1126.85993 452.02 975.319925 265.26 1121.01993 85.5"></polygon>
|
||||
<polygon id="Path" fill="#026BA4" fill-rule="nonzero" points="664.019925 7.10542736e-15 664.019925 85.5 710.619925 85.5 718.919925 95.72 718.919925 7.10542736e-15"></polygon>
|
||||
<polygon id="Path" fill="#026BA4" fill-rule="nonzero" points="718.919925 452.02 718.919925 434.96 705.079925 452.02 664.019925 452.02 664.019925 539.64 784.499925 539.64 784.499925 452.02"></polygon>
|
||||
<path d="M321.999925,411.86 L397.659925,411.86 C388.805702,433.829527 376.258024,454.122269 360.559925,471.86 C344.364089,454.216816 331.320914,433.921419 321.999925,411.86" id="Path" fill="#78212E" fill-rule="nonzero"></path>
|
||||
<path d="M360.559925,189.28 C338.58337,213.190393 322.501981,241.908137 313.599925,273.14 C317.134915,280.039338 320.007771,287.25831 322.179925,294.7 L397.059925,294.7 C399.306706,287.354671 402.25356,280.242036 405.859925,273.46 C397.464721,242.277678 381.959326,213.464341 360.559925,189.28 Z M322.179925,294.7 C328.784599,317.438017 328.978396,341.558795 322.739925,364.4 L396.399925,364.4 C389.855554,341.597488 390.06397,317.386469 396.999925,294.7 L322.179925,294.7 Z M322.179925,294.7 L308.679925,294.7 C304.690779,317.752715 304.575868,341.309464 308.339925,364.4 L322.739925,364.4 C328.978396,341.558795 328.784599,317.438017 322.179925,294.7 L322.179925,294.7 Z" id="Shape" fill="#78212E" fill-rule="nonzero"></path>
|
||||
<path d="M710.619925,85.5 L664.019925,85.5 L664.019925,0.02 L576.019925,0.02 L576.019925,85.5 L632.859925,85.5 L632.859925,159.2 C598.417874,134.487772 557.04992,121.286425 514.659925,121.48 C456.044663,121.405246 400.107354,146.01621 360.559925,189.28 C381.937732,213.470272 397.422343,242.283149 405.799925,273.46 C426.944121,233.500977 468.451514,208.51034 513.659925,208.52 C581.059925,208.52 632.879925,263.16 632.879925,330.52 L632.879925,331.2 C632.539925,398.28 580.879925,452.56 513.659925,452.56 C468.477451,452.593197 426.976426,427.652566 405.799925,387.74 L405.799925,387.74 C401.869213,380.340239 398.718926,372.551658 396.399925,364.5 L308.399925,364.5 C309.686934,372.450225 311.443338,380.317312 313.659925,388.06 C315.970162,396.190434 318.775397,404.171995 322.059925,411.96 L397.659925,411.96 C388.805702,433.929527 376.258024,454.222269 360.559925,471.96 C400.107354,515.22379 456.044663,539.834754 514.659925,539.76 C571.465111,540.091874 625.745998,516.316729 664.019925,474.34 L664.019925,452.04 L705.059925,452.04 L718.899925,434.96 L718.899925,95.74 L710.619925,85.5 Z M632.879925,501.9 L632.879925,539.74 L664.019925,539.74 L664.019925,474.18 C654.623775,484.469293 644.18821,493.758755 632.879925,501.9 L632.879925,501.9 Z M313.599925,273.14 C311.569597,280.231983 309.927163,287.429316 308.679925,294.7 L322.179925,294.7 C320.007771,287.25831 317.134915,280.039338 313.599925,273.14 L313.599925,273.14 Z" id="Shape" fill="#8A8C8F" fill-rule="nonzero"></path>
|
||||
<path d="M410.399925,294.7 C409.199925,287.5 407.659925,280.4 405.799925,273.46 C402.19356,280.242036 399.246706,287.354671 396.999925,294.7 C390.06397,317.386469 389.855554,341.597488 396.399925,364.4 L410.719925,364.4 C414.264276,341.293291 414.156293,317.77319 410.399925,294.7 L410.399925,294.7 Z M209.059925,121.48 C107.422724,121.487508 20.5081632,194.571683 3.05992537,294.7 L91.3999254,294.7 C107.135726,243.467257 154.465065,208.503753 208.059925,208.52 C252.638644,208.335148 293.496156,233.351373 313.599925,273.14 C322.501981,241.908137 338.58337,213.190393 360.559925,189.28 C322.206855,145.880863 266.976617,121.163964 209.059925,121.48 L209.059925,121.48 Z M297.479925,411.86 C275.077969,437.877726 242.392659,452.761934 208.059925,452.58 C153.691226,452.598435 105.87164,416.63791 90.7999254,364.4 L308.339925,364.4 C304.575868,341.309464 304.690779,317.752715 308.679925,294.7 L3.05992537,294.7 C-0.902504563,317.755068 -1.01739385,341.307372 2.71992537,364.4 L2.71992537,364.4 C19.3292424,465.441984 106.661918,539.594765 209.059925,539.6 C266.986094,539.900862 322.217868,515.161403 360.559925,471.74 C344.364089,454.096816 331.320914,433.801419 321.999925,411.74 L297.479925,411.86 Z" id="Shape" fill="#B72768" fill-rule="nonzero"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 5.0 KiB |
56
package-lock.json
generated
56
package-lock.json
generated
@@ -2024,12 +2024,13 @@
|
||||
}
|
||||
},
|
||||
"@edx/frontend-base": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@edx/frontend-base/-/frontend-base-1.1.0.tgz",
|
||||
"integrity": "sha512-V46BKNltEKe20bbFBU79uwVSwk914LZXvoOHQx/vJORok/+37ysq3etIP52dxku/3c942sA6ZXmMskE0POP8pQ==",
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@edx/frontend-base/-/frontend-base-1.1.2.tgz",
|
||||
"integrity": "sha512-O6PzFi+5zWwDJHyAcAYqptS5c+A49pBnEFaKH+wfau2L+ywXRExD+j7x1KDF1mrgVPMNNp7S1UDySzCnZUGLPw==",
|
||||
"requires": {
|
||||
"history": "4.9.0",
|
||||
"lodash.memoize": "^4.1.2",
|
||||
"lodash.merge": "^4.6.2",
|
||||
"lodash.pick": "^4.4.0",
|
||||
"pubsub-js": "1.7.0",
|
||||
"redux-devtools-extension": "2.13.8",
|
||||
@@ -2060,32 +2061,24 @@
|
||||
"query-string": "^5.1.1"
|
||||
}
|
||||
},
|
||||
"@edx/frontend-component-site-header": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@edx/frontend-component-site-header/-/frontend-component-site-header-2.4.0.tgz",
|
||||
"integrity": "sha512-Z1JICIJxG6kcpBck7YxEubPZyiBGS2z0SrRJXX7JcRRpKjDNDcooOQYG/SiZt5OMVVwOOeJdQDxhMtu3zT+fSQ==",
|
||||
"@edx/frontend-component-header": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@edx/frontend-component-header/-/frontend-component-header-1.1.1.tgz",
|
||||
"integrity": "sha512-JFqscNH2eZA5CDrqbEZyFTCWqG/yPiTsGkctf9djqEqndakHsoZ8FuC0tnzN1HMC07uowy9jE8MgI2BWjD4lOA==",
|
||||
"requires": {
|
||||
"react-responsive": "^6.1.1",
|
||||
"react-transition-group": "^2.5.2"
|
||||
"react-responsive": "^8.0.1",
|
||||
"react-transition-group": "^4.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"dom-helpers": {
|
||||
"version": "3.4.0",
|
||||
"resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-3.4.0.tgz",
|
||||
"integrity": "sha512-LnuPJ+dwqKDIyotW1VzmOZ5TONUN7CwkCR5hrgawTUbkBGYdeoNLZo6nNfGkCrjtE1nXXaj7iMMpDa8/d9WoIA==",
|
||||
"react-responsive": {
|
||||
"version": "8.0.1",
|
||||
"resolved": "https://registry.npmjs.org/react-responsive/-/react-responsive-8.0.1.tgz",
|
||||
"integrity": "sha512-caseFCvFFV4QW+JOl7inzDme+avoX4r7GPpQJ+04NCzIgbroV3BU0noPgHGxVCEFKm9IsgcKOBAf+6MqIUeQIg==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.1.2"
|
||||
}
|
||||
},
|
||||
"react-transition-group": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-2.9.0.tgz",
|
||||
"integrity": "sha512-+HzNTCHpeQyl4MJ/bdE0u6XRMe9+XG/+aL4mCxVN4DnPBQ0/5bfHWPDuOZUzYdMj94daZaZdCCc1Dzt9R/xSSg==",
|
||||
"requires": {
|
||||
"dom-helpers": "^3.4.0",
|
||||
"loose-envify": "^1.4.0",
|
||||
"prop-types": "^15.6.2",
|
||||
"react-lifecycles-compat": "^3.0.4"
|
||||
"hyphenate-style-name": "^1.0.0",
|
||||
"matchmediaquery": "^0.3.0",
|
||||
"prop-types": "^15.6.1",
|
||||
"shallow-equal": "^1.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14103,8 +14096,7 @@
|
||||
"lodash.merge": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
|
||||
"integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
|
||||
"dev": true
|
||||
"integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ=="
|
||||
},
|
||||
"lodash.mergewith": {
|
||||
"version": "4.6.2",
|
||||
@@ -17798,11 +17790,6 @@
|
||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.8.0.tgz",
|
||||
"integrity": "sha512-LOy+3La39aduxaPfuj+lCXC5RQ8ukjVPAAsFJ3yQ+DIOLf4eR9OMKeWKF0IzjRyE95xMj5QELwiXGgfQsIJguA=="
|
||||
},
|
||||
"react-lifecycles-compat": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz",
|
||||
"integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA=="
|
||||
},
|
||||
"react-proptype-conditional-require": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/react-proptype-conditional-require/-/react-proptype-conditional-require-1.0.4.tgz",
|
||||
@@ -19362,6 +19349,11 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"shallow-equal": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/shallow-equal/-/shallow-equal-1.2.0.tgz",
|
||||
"integrity": "sha512-Z21pVxR4cXsfwpMKMhCEIO1PCi5sp7KEp+CmOpBQ+E8GpHwKOw2sEzk7sgblM3d/j4z4gakoWEoPcjK0VJQogA=="
|
||||
},
|
||||
"shebang-command": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
"@cospired/i18n-iso-languages": "2.0.2",
|
||||
"@edx/frontend-analytics": "2.0.0",
|
||||
"@edx/frontend-auth": "6.0.1",
|
||||
"@edx/frontend-base": "1.1.0",
|
||||
"@edx/frontend-base": "1.1.2",
|
||||
"@edx/frontend-component-footer": "6.0.2",
|
||||
"@edx/frontend-component-site-header": "2.4.0",
|
||||
"@edx/frontend-component-header": "1.1.1",
|
||||
"@edx/frontend-i18n": "3.0.2",
|
||||
"@edx/frontend-logging": "3.0.1",
|
||||
"@edx/paragon": "7.1.2",
|
||||
|
||||
@@ -5,10 +5,10 @@ import { NewRelicLoggingService } from '@edx/frontend-logging';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
|
||||
import Header, { messages as headerMessages } from '@edx/frontend-component-header';
|
||||
import Footer from '../footer/Footer';
|
||||
import Header from '../header/Header';
|
||||
|
||||
import messages from './i18n';
|
||||
import appMessages from './i18n';
|
||||
import './index.scss';
|
||||
import ProfileMain from './profile/components/ProfileMain';
|
||||
import configureStore from './store';
|
||||
@@ -28,4 +28,7 @@ App.subscribe(APP_ERROR, (error) => {
|
||||
ReactDOM.render(<ErrorPage message={error.message} />, document.getElementById('root'));
|
||||
});
|
||||
|
||||
initialize({ messages, loggingService: NewRelicLoggingService });
|
||||
initialize({
|
||||
messages: [appMessages, headerMessages],
|
||||
loggingService: NewRelicLoggingService,
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
$fa-font-path: "~font-awesome/fonts";
|
||||
@import "~font-awesome/scss/font-awesome";
|
||||
|
||||
@import "~@edx/frontend-component-site-header/src/index";
|
||||
@import "~@edx/frontend-component-header/src/index";
|
||||
@import "~@edx/frontend-component-footer/src/lib/scss/site-footer";
|
||||
|
||||
.word-break-all {
|
||||
|
||||
Reference in New Issue
Block a user