From 1865eb08e59d388c796514ac931c898b14d98f87 Mon Sep 17 00:00:00 2001 From: hinakhadim Date: Thu, 20 Jun 2024 20:27:16 +0500 Subject: [PATCH] feat!: Indigo header changes BREAKING CHANGES: Upgrade to Redwood --- package-lock.json | 8 +- package.json | 4 +- src/Header.jsx | 4 +- src/MobileHeader.jsx | 17 +-- src/__snapshots__/Header.test.jsx.snap | 104 +++++++----------- .../AuthenticatedUserDropdown.jsx | 62 ++++++----- src/learning-header/LearningHeader.jsx | 18 ++- 7 files changed, 102 insertions(+), 115 deletions(-) diff --git a/package-lock.json b/package-lock.json index 780dede0d7..36bb563565 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "@edx/frontend-component-header", - "version": "1.0.0-semantically-released", + "name": "@edly-io/indigo-frontend-component-header", + "version": "2.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@edx/frontend-component-header", - "version": "1.0.0-semantically-released", + "name": "@edly-io/indigo-frontend-component-header", + "version": "2.0.0", "license": "AGPL-3.0", "dependencies": { "@fortawesome/fontawesome-svg-core": "6.5.1", diff --git a/package.json b/package.json index d96c04108b..66d25b8f2a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "@edx/frontend-component-header", - "version": "1.0.0-semantically-released", + "name": "@edly-io/indigo-frontend-component-header", + "version": "2.0.0", "description": "The standard header for Open edX", "main": "dist/index.js", "publishConfig": { diff --git a/src/Header.jsx b/src/Header.jsx index c0db257c72..554babd948 100644 --- a/src/Header.jsx +++ b/src/Header.jsx @@ -102,10 +102,10 @@ const Header = ({ intl }) => { return ( <> - + - + diff --git a/src/MobileHeader.jsx b/src/MobileHeader.jsx index 506deb33d0..36de82b40d 100644 --- a/src/MobileHeader.jsx +++ b/src/MobileHeader.jsx @@ -5,7 +5,6 @@ import { getConfig } from '@edx/frontend-platform'; // Local Components import { Menu, MenuTrigger, MenuContent } from './Menu'; -import Avatar from './Avatar'; import { LinkedLogo, Logo } from './Logo'; // i18n @@ -87,8 +86,6 @@ class MobileHeader extends React.Component { logoAltText, logoDestination, loggedIn, - avatar, - username, stickyOnMobile, intl, mainMenu, @@ -106,7 +103,7 @@ class MobileHeader extends React.Component { > {intl.formatMessage(messages['header.label.skip.nav'])} {mainMenu.length > 0 ? ( -
+
) : null} -
+
{ logoDestination === null ? : }
{userMenu.length > 0 || loggedOutItems.length > 0 ? ( -
+
- +
+ + + + +
{loggedIn ? this.renderUserMenuItems() : this.renderLoggedOutItems()} diff --git a/src/__snapshots__/Header.test.jsx.snap b/src/__snapshots__/Header.test.jsx.snap index f83161b154..84c799c3e4 100644 --- a/src/__snapshots__/Header.test.jsx.snap +++ b/src/__snapshots__/Header.test.jsx.snap @@ -71,7 +71,7 @@ exports[`
renders correctly for anonymous mobile 1`] = ` Skip to main content
renders correctly for anonymous mobile 1`] = `
@@ -317,7 +303,7 @@ exports[`
renders correctly for authenticated mobile 1`] = ` Skip to main content
renders correctly for authenticated mobile 1`] = `
diff --git a/src/learning-header/AuthenticatedUserDropdown.jsx b/src/learning-header/AuthenticatedUserDropdown.jsx index 9caadb412f..501563bcd2 100644 --- a/src/learning-header/AuthenticatedUserDropdown.jsx +++ b/src/learning-header/AuthenticatedUserDropdown.jsx @@ -1,8 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { faUserCircle } from '@fortawesome/free-solid-svg-icons'; import { getConfig } from '@edx/frontend-platform'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { Dropdown } from '@openedx/paragon'; @@ -17,34 +15,38 @@ const AuthenticatedUserDropdown = ({ intl, username }) => { ); return ( - <> - {intl.formatMessage(messages.help)} - - - - - {username} - - - - {dashboardMenuItem} - - {intl.formatMessage(messages.profile)} - - - {intl.formatMessage(messages.account)} - - { getConfig().ORDER_HISTORY_URL && ( - - {intl.formatMessage(messages.orderHistory)} - - )} - - {intl.formatMessage(messages.signOut)} - - - - + + +
+ + + + +
+ + {username} + +
+ + My Courses + Discover + {dashboardMenuItem} + + {intl.formatMessage(messages.profile)} + + + {intl.formatMessage(messages.account)} + + { getConfig().ORDER_HISTORY_URL && ( + + {intl.formatMessage(messages.orderHistory)} + + )} + + {intl.formatMessage(messages.signOut)} + + +
); }; diff --git a/src/learning-header/LearningHeader.jsx b/src/learning-header/LearningHeader.jsx index 373001d190..b43ed38cb9 100644 --- a/src/learning-header/LearningHeader.jsx +++ b/src/learning-header/LearningHeader.jsx @@ -40,13 +40,25 @@ const LearningHeader = ({ ); return ( -
+
{intl.formatMessage(messages.skipNavLink)}
{headerLogo}
- {courseOrg} {courseNumber} - {courseTitle} +
+ {courseTitle} + {courseOrg} {courseNumber} +
+ +
{showUserDropdown && authenticatedUser && (