From 3b527d9e60b5cc0390633800f55e5ab35b197d08 Mon Sep 17 00:00:00 2001 From: sundasnoreen12 <72802712+sundasnoreen12@users.noreply.github.com> Date: Wed, 30 Jul 2025 15:37:58 +0500 Subject: [PATCH] feat: added tooltip for author role (#795) --- src/discussions/common/AuthorLabel.jsx | 44 ++++++++++++++++++++------ src/discussions/messages.js | 15 +++++++++ 2 files changed, 49 insertions(+), 10 deletions(-) diff --git a/src/discussions/common/AuthorLabel.jsx b/src/discussions/common/AuthorLabel.jsx index 8a3501bb..d97120d7 100644 --- a/src/discussions/common/AuthorLabel.jsx +++ b/src/discussions/common/AuthorLabel.jsx @@ -55,7 +55,11 @@ const AuthorLabel = ({ placement={authorToolTip ? 'top' : 'right'} overlay={( - {authorToolTip ? author : authorLabel} + <> + {authorToolTip ? author : authorLabel} +
+ {intl.formatMessage(messages.authorAdminDescription)} +
)} trigger={['hover', 'focus']} @@ -97,18 +101,38 @@ const AuthorLabel = ({ ), [author, authorLabelMessage, authorToolTip, icon, isRetiredUser, postCreatedAt, showTextPrimary, alert]); + const learnerPostsLink = ( + + {!alert && authorName} + + ); + return showUserNameAsLink ? (
- - {!alert && authorName} - + {!authorLabel ? ( + + <> + {intl.formatMessage(messages.authorLearnerTitle)} +
+ {intl.formatMessage(messages.authorLearnerDescription)} + + + )} + trigger={['hover', 'focus']} + > + {learnerPostsLink} +
+ ) : learnerPostsLink } {labelContents}
) diff --git a/src/discussions/messages.js b/src/discussions/messages.js index ac78169d..38122a48 100644 --- a/src/discussions/messages.js +++ b/src/discussions/messages.js @@ -208,6 +208,21 @@ const messages = defineMessages({ defaultMessage: 'Enroll', description: 'Action button on content page when the user has not logged into the MFE or not enrolled in the course.', }, + authorAdminDescription: { + id: 'discussions.author.admin.description', + defaultMessage: 'Part of the team that runs this course', + description: 'tooltip for course admins', + }, + authorLearnerTitle: { + id: 'discussions.author.learner.title', + defaultMessage: 'Learner', + description: 'tooltip for course learners title', + }, + authorLearnerDescription: { + id: 'discussions.author.learner.description', + defaultMessage: 'Taking the course just like you', + description: 'tooltip for course learners', + }, }); export default messages;