From e77f5b8f2ae094c071a8457f647dcad2f1ec91a4 Mon Sep 17 00:00:00 2001 From: Navin Karkera Date: Tue, 9 Apr 2024 15:56:00 +0530 Subject: [PATCH] feat: display profile name in navbar if available Display profile name if it is set, else fallback to username --- src/learning-header/AuthenticatedUserDropdown.jsx | 5 +++-- src/learning-header/LearningHeader.jsx | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/learning-header/AuthenticatedUserDropdown.jsx b/src/learning-header/AuthenticatedUserDropdown.jsx index 9caadb412f..978676c5c0 100644 --- a/src/learning-header/AuthenticatedUserDropdown.jsx +++ b/src/learning-header/AuthenticatedUserDropdown.jsx @@ -9,7 +9,7 @@ import { Dropdown } from '@openedx/paragon'; import messages from './messages'; -const AuthenticatedUserDropdown = ({ intl, username }) => { +const AuthenticatedUserDropdown = ({ intl, username, name }) => { const dashboardMenuItem = ( {intl.formatMessage(messages.dashboard)} @@ -23,7 +23,7 @@ const AuthenticatedUserDropdown = ({ intl, username }) => { - {username} + {name || username} @@ -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); diff --git a/src/learning-header/LearningHeader.jsx b/src/learning-header/LearningHeader.jsx index 373001d190..88dce7d7ce 100644 --- a/src/learning-header/LearningHeader.jsx +++ b/src/learning-header/LearningHeader.jsx @@ -51,6 +51,7 @@ const LearningHeader = ({ {showUserDropdown && authenticatedUser && ( )} {showUserDropdown && !authenticatedUser && (