From f45f47f2e076e4241f9d1b67319fabf6d0ed71f3 Mon Sep 17 00:00:00 2001 From: ayeshoali Date: Wed, 30 Nov 2022 16:45:43 +0500 Subject: [PATCH] style: 3 level topic hierarchy accomodated when incontext discussions is enabled --- src/discussions/posts/post/Post.jsx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/discussions/posts/post/Post.jsx b/src/discussions/posts/post/Post.jsx index 95e0aa7f..35521ea7 100644 --- a/src/discussions/posts/post/Post.jsx +++ b/src/discussions/posts/post/Post.jsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useContext } from 'react'; import PropTypes from 'prop-types'; import { useDispatch, useSelector } from 'react-redux'; @@ -11,6 +11,7 @@ import HTMLLoader from '../../../components/HTMLLoader'; import { ContentActions } from '../../../data/constants'; import { selectorForUnitSubsection, selectTopicContext } from '../../../data/selectors'; import { AlertBanner, Confirmation } from '../../common'; +import { DiscussionContext } from '../../common/context'; import { selectModerationSettings } from '../../data/selectors'; import { selectTopic } from '../../topics/data/selectors'; import { removeThread, updateExistingThread } from '../data/thunks'; @@ -56,6 +57,7 @@ function Post({ hideReportConfirmation(); }; + const { inContext } = useContext(DiscussionContext); const actionHandlers = { [ContentActions.EDIT_CONTENT]: () => history.push({ ...location, @@ -107,13 +109,23 @@ function Post({ {topicContext && topic && ( -
+
{intl.formatMessage(messages.relatedTo)}{' '} - {`${getTopicCategoryName(topic)} / ${topic.name}`} + {inContext + ? ( + <> + {topicContext.chapterName} + / + {topicContext.verticalName} + / + {topicContext.unitName} + + ) + : `${getTopicCategoryName(topic)} / ${topic.name}`}
)}