diff --git a/example/index.js b/example/index.js index cfec3546a..4698ffc33 100644 --- a/example/index.js +++ b/example/index.js @@ -25,7 +25,7 @@ subscribe(APP_READY, () => { { - {username} - + /> {userMenu.map(({ type, href, content }) => ( @@ -155,7 +153,7 @@ DesktopHeader.propTypes = { logoAltText: PropTypes.string, logoDestination: PropTypes.string, avatar: PropTypes.string, - username: PropTypes.string, + name: PropTypes.string, loggedIn: PropTypes.bool, // i18n @@ -170,7 +168,7 @@ DesktopHeader.defaultProps = { logoAltText: null, logoDestination: null, avatar: null, - username: null, + name: null, loggedIn: false, }; diff --git a/src/Header.jsx b/src/Header.jsx index d8a05d439..28ff67416 100644 --- a/src/Header.jsx +++ b/src/Header.jsx @@ -154,7 +154,7 @@ const Header = ({ intl }) => { siteName: 'edX', logoDestination: getConfig().MINIMAL_HEADER ? null : `${config.LMS_BASE_URL}/dashboard`, loggedIn: authenticatedUser !== null, - username: authenticatedUser !== null ? authenticatedUser.username : null, + name: authenticatedUser !== null ? authenticatedUser.name : null, avatar: authenticatedUser !== null ? authenticatedUser.avatar : null, mainMenu: getConfig().MINIMAL_HEADER || getConfig().AUTHN_MINIMAL_HEADER ? [] : mainMenu, userMenu: getConfig().AUTHN_MINIMAL_HEADER ? [] : userMenu, diff --git a/src/Header.messages.jsx b/src/Header.messages.jsx index 0a21908fb..e2de86137 100644 --- a/src/Header.messages.jsx +++ b/src/Header.messages.jsx @@ -78,8 +78,8 @@ const messages = defineMessages({ }, 'header.label.account.menu.for': { id: 'header.label.account.menu.for', - defaultMessage: 'Account menu for {username}', - description: 'The aria label for the account menu trigger when the username is displayed in it', + defaultMessage: 'Account menu for {name}', + description: 'The aria label for the account menu trigger when the name is displayed in it', }, 'header.label.main.nav': { id: 'header.label.main.nav', diff --git a/src/Header.test.jsx b/src/Header.test.jsx index ba6ea1b54..5940897cc 100644 --- a/src/Header.test.jsx +++ b/src/Header.test.jsx @@ -73,7 +73,7 @@ describe('
', () => { const contextValue = { authenticatedUser: { userId: 'abc123', - username: 'edX', + name: 'edX', roles: [], administrator: false, }, diff --git a/src/__snapshots__/Header.test.jsx.snap b/src/__snapshots__/Header.test.jsx.snap index 87bdaa0a7..f8b8c87cd 100644 --- a/src/__snapshots__/Header.test.jsx.snap +++ b/src/__snapshots__/Header.test.jsx.snap @@ -37,7 +37,7 @@ exports[`
minimal renders correctly for authenticated users when minim alt="" aria-expanded={false} aria-haspopup={true} - aria-label="Account menu for edX" + aria-label="Account menu for " className="btn-avatar pgn__avatar-button-avatar pgn__avatar-button-avatar-md dropdown-toggle btn btn-tertiary btn-md" data-hj-suppress={true} disabled={false} @@ -50,7 +50,6 @@ exports[`
minimal renders correctly for authenticated users when minim className="pgn__avatar pgn__avatar-sm" src="icon/mock/path" /> - edX @@ -180,7 +179,6 @@ exports[`
renders correctly for authenticated users on desktop 1`] = ` className="pgn__avatar pgn__avatar-sm" src="icon/mock/path" /> - edX @@ -293,7 +291,7 @@ exports[`
renders correctly for authenticated users on mobile 1`] = ` type="button" > edX diff --git a/src/learning-header/AuthenticatedUserDropdown.jsx b/src/learning-header/AuthenticatedUserDropdown.jsx index 73499e8c6..795729244 100644 --- a/src/learning-header/AuthenticatedUserDropdown.jsx +++ b/src/learning-header/AuthenticatedUserDropdown.jsx @@ -7,14 +7,20 @@ import { faUserCircle } from '@fortawesome/free-solid-svg-icons'; import { getConfig } from '@edx/frontend-platform'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; -import { Dropdown, Badge } from '@openedx/paragon'; +import { Avatar, Dropdown, Badge } from '@openedx/paragon'; import messages from './messages'; import Notifications from '../Notifications'; import { selectShowNotificationTray } from '../Notifications/data/selectors'; import { fetchAppsNotificationCount } from '../Notifications/data/thunks'; -const AuthenticatedUserDropdown = ({ enterpriseLearnerPortalLink, intl, username }) => { +const AuthenticatedUserDropdown = (props) => { + const { + intl, + enterpriseLearnerPortalLink, + username, + name, + } = props; const dispatch = useDispatch(); const showNotificationsTray = useSelector(selectShowNotificationTray); @@ -54,9 +60,7 @@ const AuthenticatedUserDropdown = ({ enterpriseLearnerPortalLink, intl, username - - {username} - + {dashboardMenuItem} @@ -89,10 +93,12 @@ AuthenticatedUserDropdown.propTypes = { enterpriseLearnerPortalLink: PropTypes.string, intl: intlShape.isRequired, username: PropTypes.string.isRequired, + name: PropTypes.string, }; AuthenticatedUserDropdown.defaultProps = { enterpriseLearnerPortalLink: '', + name: null, }; export default injectIntl(AuthenticatedUserDropdown); diff --git a/src/learning-header/LearningHeader.jsx b/src/learning-header/LearningHeader.jsx index 2eeb6c04e..322eeda88 100644 --- a/src/learning-header/LearningHeader.jsx +++ b/src/learning-header/LearningHeader.jsx @@ -92,6 +92,7 @@ const LearningHeader = ({ )} {showUserDropdown && !authenticatedUser && ( diff --git a/src/learning-header/LearningHeader.test.jsx b/src/learning-header/LearningHeader.test.jsx index 3d80888ef..413ca78cd 100644 --- a/src/learning-header/LearningHeader.test.jsx +++ b/src/learning-header/LearningHeader.test.jsx @@ -1,6 +1,6 @@ import React from 'react'; import { - authenticatedUser, initializeMockApp, render, screen, + initializeMockApp, render, screen, } from '../setupTest'; import { LearningHeader as Header } from '../index'; @@ -12,7 +12,7 @@ describe('Header', () => { it('displays user button', () => { render(
); - expect(screen.getByText(authenticatedUser.username)).toBeInTheDocument(); + expect(screen.getByRole('button', { className: 'd-md-none' })).toBeInTheDocument(); }); it('displays course data', () => { diff --git a/src/studio-header/HeaderBody.jsx b/src/studio-header/HeaderBody.jsx index af3690610..d1cc0c6e8 100644 --- a/src/studio-header/HeaderBody.jsx +++ b/src/studio-header/HeaderBody.jsx @@ -20,7 +20,7 @@ const HeaderBody = ({ number, org, title, - username, + name, isAdmin, studioBaseUrl, logoutUrl, @@ -99,7 +99,7 @@ const HeaderBody = ({