Skip to content

Commit

Permalink
feat: display profile name in navbar if available
Browse files Browse the repository at this point in the history
Display profile name if it is set, else fallback to username
  • Loading branch information
navinkarkera committed Apr 9, 2024
1 parent 370b193 commit e77f5b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/learning-header/AuthenticatedUserDropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Dropdown } from '@openedx/paragon';

import messages from './messages';

const AuthenticatedUserDropdown = ({ intl, username }) => {
const AuthenticatedUserDropdown = ({ intl, username, name }) => {
const dashboardMenuItem = (
<Dropdown.Item href={`${getConfig().LMS_BASE_URL}/dashboard`}>
{intl.formatMessage(messages.dashboard)}
Expand All @@ -23,7 +23,7 @@ const AuthenticatedUserDropdown = ({ intl, username }) => {
<Dropdown.Toggle variant="outline-primary">
<FontAwesomeIcon icon={faUserCircle} className="d-md-none" size="lg" />
<span data-hj-suppress className="d-none d-md-inline">
{username}
{name || username}
</span>
</Dropdown.Toggle>
<Dropdown.Menu className="dropdown-menu-right">
Expand Down Expand Up @@ -51,6 +51,7 @@ const AuthenticatedUserDropdown = ({ intl, username }) => {
AuthenticatedUserDropdown.propTypes = {
intl: intlShape.isRequired,
username: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
};

export default injectIntl(AuthenticatedUserDropdown);
1 change: 1 addition & 0 deletions src/learning-header/LearningHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const LearningHeader = ({
{showUserDropdown && authenticatedUser && (
<AuthenticatedUserDropdown
username={authenticatedUser.username}
name={authenticatedUser.name}
/>
)}
{showUserDropdown && !authenticatedUser && (
Expand Down

0 comments on commit e77f5b8

Please sign in to comment.