From e242fbb16f1d27b485ccf7022afe8e612097e256 Mon Sep 17 00:00:00 2001
From: Awais Ansari <79941147+awais-ansari@users.noreply.github.com>
Date: Tue, 8 Jun 2021 12:13:22 +0500
Subject: [PATCH] feat: remove deletion functionality for default discussion
topic (#125)
* feat: remove deletion functionality for default discussion topic
* refactor: update variables name and add general topic condition
---
.../shared/discussion-topics/TopicItem.jsx | 32 +++++++++++--------
.../app-config-form/apps/shared/messages.js | 10 ++++++
2 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/src/pages-and-resources/discussions/app-config-form/apps/shared/discussion-topics/TopicItem.jsx b/src/pages-and-resources/discussions/app-config-form/apps/shared/discussion-topics/TopicItem.jsx
index 0d8c3c37a..d4aa11b6a 100644
--- a/src/pages-and-resources/discussions/app-config-form/apps/shared/discussion-topics/TopicItem.jsx
+++ b/src/pages-and-resources/discussions/app-config-form/apps/shared/discussion-topics/TopicItem.jsx
@@ -13,7 +13,7 @@ import {
} from '../../../../data/slice';
const TopicItem = ({
- intl, index, name, onDelete,
+ intl, index, name, onDelete, id,
}) => {
const [title, setTitle] = useState(name);
const [showDeletePopup, setShowDeletePopup] = useState(false);
@@ -24,6 +24,7 @@ const TopicItem = ({
errors,
} = useFormikContext();
const dispatch = useDispatch();
+ const isGeneralTopic = id === 'course';
useEffect(() => {
setTitle(name);
@@ -47,10 +48,10 @@ const TopicItem = ({
const getHeading = (isOpen = false) => {
let heading;
- if (!title) {
- heading = Configure topic;
+ if (isGeneralTopic && isOpen) {
+ heading = {intl.formatMessage(messages.renameGeneralTopic)};
} else if (isOpen) {
- heading = Rename {title} topic;
+ heading = {intl.formatMessage(messages.configureAdditionalTopic)};
} else {
heading = {title};
}
@@ -124,15 +125,19 @@ const TopicItem = ({
{getHeading(true)}
-
-
-
+ {
+ !isGeneralTopic && (
+
+
+
+ )
+ }