Skip to content

Commit 69f2176

Browse files
Challenge Forums - Fix logical if user registered.
1 parent d50d174 commit 69f2176

File tree

1 file changed

+29
-24
lines changed
  • src/shared/components/challenge-detail/Header/TabSelector

1 file changed

+29
-24
lines changed

src/shared/components/challenge-detail/Header/TabSelector/index.jsx

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -176,30 +176,35 @@ export default function ChallengeViewSelector(props) {
176176
</a>
177177
) : null
178178
}
179-
{ (hasRegistered || Boolean(roles.length))
180-
&& _.isEmpty(discuss)
181-
? (
182-
<a
183-
href={`${config.URL.FORUMS}${forumEndpoint}`}
184-
styleName={getSelectorStyle(selectedView, DETAIL_TABS.CHALLENGE_FORUM)}
185-
target="_blank"
186-
rel="oopener noreferrer"
187-
>
188-
CHALLENGE FORUM
189-
</a>
190-
) : (
191-
discuss.map(d => (
192-
<a
193-
href={d.url}
194-
styleName={getSelectorStyle(selectedView, DETAIL_TABS.CHALLENGE_FORUM)}
195-
target="_blank"
196-
rel="oopener noreferrer"
197-
>
198-
CHALLENGE DISCUSSION
199-
</a>
200-
))
201-
)
202-
}
179+
{ (() => {
180+
if (hasRegistered || Boolean(roles.length)) {
181+
if (_.isEmpty(discuss)) {
182+
return (
183+
<a
184+
href={`${config.URL.FORUMS}${forumEndpoint}`}
185+
styleName={getSelectorStyle(selectedView, DETAIL_TABS.CHALLENGE_FORUM)}
186+
target="_blank"
187+
rel="oopener noreferrer"
188+
>
189+
CHALLENGE FORUM
190+
</a>
191+
);
192+
}
193+
return (
194+
discuss.map(d => (
195+
<a
196+
href={d.url}
197+
styleName={getSelectorStyle(selectedView, DETAIL_TABS.CHALLENGE_FORUM)}
198+
target="_blank"
199+
rel="oopener noreferrer"
200+
>
201+
CHALLENGE DISCUSSION
202+
</a>
203+
))
204+
);
205+
}
206+
return '';
207+
})()}
203208
</div>
204209
</div>
205210
);

0 commit comments

Comments
 (0)