From 4c1767fcf4200444c7d527d9ad8066f6add21b78 Mon Sep 17 00:00:00 2001
From: "Luiz R. Rodrigues"
Date: Thu, 12 Nov 2020 09:06:58 -0300
Subject: [PATCH] Hide forum tab if haven't a forumId or discussions
---
.../Header/TabSelector/index.jsx | 28 ++++++++++---------
.../Specification/SideBar/index.jsx | 28 ++++++++++---------
.../challenge-detail/Specification/index.jsx | 10 ++++---
3 files changed, 36 insertions(+), 30 deletions(-)
diff --git a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx
index eb95429a9d..0445677aa7 100644
--- a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx
+++ b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx
@@ -178,7 +178,21 @@ export default function ChallengeViewSelector(props) {
}
{ (() => {
if (hasRegistered || Boolean(roles.length)) {
- if (_.isEmpty(discuss)) {
+ if (!_.isEmpty(discuss)) {
+ return (
+ discuss.map(d => (
+
+ CHALLENGE DISCUSSION
+
+ ))
+ );
+ }
+ if (forumId > 0) {
return (
);
}
- return (
- discuss.map(d => (
-
- CHALLENGE DISCUSSION
-
- ))
- );
}
return '';
})()}
diff --git a/src/shared/components/challenge-detail/Specification/SideBar/index.jsx b/src/shared/components/challenge-detail/Specification/SideBar/index.jsx
index 7b65735a5e..793278de7d 100644
--- a/src/shared/components/challenge-detail/Specification/SideBar/index.jsx
+++ b/src/shared/components/challenge-detail/Specification/SideBar/index.jsx
@@ -322,19 +322,21 @@ export default function SideBar({
pass screening.
-
- Questions?
-
- {_.isEmpty(discuss) && (
-
- Ask in the Challenge Discussion Forums.
-
- )}
-
+ {(forumLink || !_.isEmpty(discuss)) && (
+
+ Questions?
+
+ {_.isEmpty(discuss) && (
+
+ Ask in the Challenge Discussion Forums.
+
+ )}
+
+ )}
{!_.isEmpty(discuss) && (
{ discuss.map(d => (
diff --git a/src/shared/components/challenge-detail/Specification/index.jsx b/src/shared/components/challenge-detail/Specification/index.jsx
index 8f2f18d150..f61d3401ef 100644
--- a/src/shared/components/challenge-detail/Specification/index.jsx
+++ b/src/shared/components/challenge-detail/Specification/index.jsx
@@ -80,10 +80,12 @@ export default function ChallengeDetailsView(props) {
d.type === 'challenge' && !_.isEmpty(d.url)
));
- let forumLink = track.toLowerCase() === 'design'
- ? `/?module=ThreadList&forumID=${forumId}`
- : `/?module=Category&categoryID=${forumId}`;
- forumLink = `${config.URL.FORUMS}${forumLink}`;
+ let forumLink = '';
+ if (forumId > 0) {
+ forumLink = track.toLowerCase() === 'design'
+ ? `/?module=ThreadList&forumID=${forumId}`
+ : `/?module=Category&categoryID=${forumId}`;
+ }
let isWipro = false;
const wiproCommunity = communitiesList.find(x => x.communityId === 'wipro');