From 8db03af9f435d4cd51e84f0334ca482546562f2c Mon Sep 17 00:00:00 2001 From: sohailfatima <23100065@lums.edu.pk> Date: Thu, 25 Jan 2024 23:29:20 +0500 Subject: [PATCH] fix: changed username to simple text for incontext view --- src/discussions/common/AuthorLabel.jsx | 41 ++++++++++--------- .../learners/learner/LearnerCard.jsx | 8 ++-- src/index.scss | 4 ++ 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/src/discussions/common/AuthorLabel.jsx b/src/discussions/common/AuthorLabel.jsx index 92b410a36..aabb388ca 100644 --- a/src/discussions/common/AuthorLabel.jsx +++ b/src/discussions/common/AuthorLabel.jsx @@ -2,7 +2,7 @@ import React, { useContext, useMemo } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import { Link, useLocation } from 'react-router-dom'; +import { generatePath, Link } from 'react-router-dom'; import * as timeago from 'timeago.js'; import { useIntl } from '@edx/frontend-platform/i18n'; @@ -11,7 +11,6 @@ import { Institution, School } from '@edx/paragon/icons'; import { Routes } from '../../data/constants'; import messages from '../messages'; -import { discussionsPath } from '../utils'; import { DiscussionContext } from './context'; import timeLocale from './time-locale'; @@ -110,26 +109,30 @@ const AuthorLabel = ({ ), [author, authorLabelMessage, authorToolTip, icon, isRetiredUser, postCreatedAt, showTextPrimary, alert]); - const { pathname } = discussionsPath(Routes.LEARNERS.POSTS, { - 0: enableInContextSidebar ? 'in-context' : undefined, - learnerUsername: author, - courseId, - })(); - - const { search } = useLocation(); - return showUserNameAsLink ? (
- - {!alert && authorName} - + { enableInContextSidebar + ? ( +
+ {!alert && authorName} +
+ ) + : ( + + {!alert && authorName} + + )} {labelContents}
) diff --git a/src/discussions/learners/learner/LearnerCard.jsx b/src/discussions/learners/learner/LearnerCard.jsx index 7d81c72b1..8304cd6c4 100644 --- a/src/discussions/learners/learner/LearnerCard.jsx +++ b/src/discussions/learners/learner/LearnerCard.jsx @@ -1,6 +1,6 @@ import React, { useContext } from 'react'; -import { Link, useLocation } from 'react-router-dom'; +import { Link } from 'react-router-dom'; import { Routes } from '../../../data/constants'; import { DiscussionContext } from '../../common/context'; @@ -14,18 +14,16 @@ const LearnerCard = ({ learner }) => { username, threads, inactiveFlags, activeFlags, responses, replies, } = learner; const { enableInContextSidebar, learnerUsername, courseId } = useContext(DiscussionContext); - const { pathname } = discussionsPath(Routes.LEARNERS.POSTS, { + const linkUrl = discussionsPath(Routes.LEARNERS.POSTS, { 0: enableInContextSidebar ? 'in-context' : undefined, learnerUsername: learner.username, courseId, })(); - const { search } = useLocation(); - return (