File tree 4 files changed +57
-11
lines changed
src/shared/components/challenge-detail
4 files changed +57
-11
lines changed Original file line number Diff line number Diff line change @@ -244,7 +244,7 @@ workflows:
244
244
filters :
245
245
branches :
246
246
only :
247
- - issue-5041
247
+ - free
248
248
# This is beta env for production soft releases
249
249
- " build-prod-beta " :
250
250
context : org-global
Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ export default function ChallengeViewSelector(props) {
36
36
37
37
const numOfSub = numOfSubmissions + ( numOfCheckpointSubmissions || 0 ) ;
38
38
const forumId = _ . get ( challenge , 'legacy.forumId' ) || 0 ;
39
+ const discuss = _ . get ( challenge , 'discussions' , [ ] ) . filter ( d => (
40
+ d . type === 'challenge' && ! _ . isEmpty ( d . url )
41
+ ) ) ;
39
42
const roles = _ . get ( challenge , 'userDetails.roles' ) || [ ] ;
40
43
const isDesign = trackLower === 'design' ;
41
44
@@ -174,13 +177,27 @@ export default function ChallengeViewSelector(props) {
174
177
) : null
175
178
}
176
179
{ ( hasRegistered || Boolean ( roles . length ) )
177
- && (
178
- < a
179
- href = { `${ config . URL . FORUMS } ${ forumEndpoint } ` }
180
- styleName = { getSelectorStyle ( selectedView , DETAIL_TABS . CHALLENGE_FORUM ) }
181
- >
182
- CHALLENGE FORUM
183
- </ a >
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
+ ) )
184
201
)
185
202
}
186
203
</ div >
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ export default function SideBar({
21
21
eventDetail,
22
22
shareable,
23
23
forumLink,
24
+ discuss,
24
25
hasRegistered,
25
26
reviewType,
26
27
isDesign,
@@ -324,10 +325,31 @@ export default function SideBar({
324
325
< p styleName = "link-like-paragraph" >
325
326
Questions?
326
327
‌
327
- < a href = { forumLink } >
328
- Ask in the Challenge Discussion Forums.
329
- </ a >
328
+ { _ . isEmpty ( discuss ) && (
329
+ < a
330
+ href = { forumLink }
331
+ target = "_blank"
332
+ rel = "oopener noreferrer"
333
+ >
334
+ Ask in the Challenge Discussion Forums.
335
+ </ a >
336
+ ) }
330
337
</ p >
338
+ { ! _ . isEmpty ( discuss ) && (
339
+ < ul >
340
+ { discuss . map ( d => (
341
+ < li >
342
+ < a
343
+ href = { d . url }
344
+ target = "_blank"
345
+ rel = "oopener noreferrer"
346
+ >
347
+ CHALLENGE DISCUSSION
348
+ </ a >
349
+ </ li >
350
+ ) ) }
351
+ </ ul >
352
+ ) }
331
353
< h2 >
332
354
SOURCE FILES:
333
355
</ h2 >
@@ -429,6 +451,7 @@ export default function SideBar({
429
451
430
452
SideBar . defaultProps = {
431
453
eventDetail : null ,
454
+ discuss : [ ] ,
432
455
documents : undefined ,
433
456
hasRegistered : false ,
434
457
reviewType : 'COMMUNITY' ,
@@ -454,6 +477,7 @@ SideBar.propTypes = {
454
477
documents : PT . arrayOf ( PT . shape ( ) ) ,
455
478
shareable : PT . bool . isRequired ,
456
479
forumLink : PT . string . isRequired ,
480
+ discuss : PT . arrayOf ( PT . shape ( ) ) ,
457
481
hasRegistered : PT . bool ,
458
482
reviewType : PT . string ,
459
483
isDesign : PT . bool ,
Original file line number Diff line number Diff line change @@ -76,6 +76,10 @@ export default function ChallengeDetailsView(props) {
76
76
codeRepo = codeRepoData . value ;
77
77
}
78
78
79
+ const discuss = _ . get ( challenge , 'discussions' , [ ] ) . filter ( d => (
80
+ d . type === 'challenge' && ! _ . isEmpty ( d . url )
81
+ ) ) ;
82
+
79
83
let forumLink = track . toLowerCase ( ) === 'design'
80
84
? `/?module=ThreadList&forumID=${ forumId } `
81
85
: `/?module=Category&categoryID=${ forumId } ` ;
@@ -351,6 +355,7 @@ export default function ChallengeDetailsView(props) {
351
355
challengesUrl = { challengesUrl }
352
356
legacyId = { legacyId }
353
357
forumLink = { forumLink }
358
+ discuss = { discuss }
354
359
documents = { documents }
355
360
hasRegistered = { hasRegistered }
356
361
isDesign = { track . toLowerCase ( ) === 'design' }
You can’t perform that action at this time.
0 commit comments