File tree 3 files changed +46
-10
lines changed
src/shared/components/challenge-detail
3 files changed +46
-10
lines changed 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' ) || 0 ) . 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,23 @@ 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
+ >
186
+ CHALLENGE FORUM
187
+ </ a >
188
+ ) : (
189
+ discuss . map ( d => (
190
+ < a
191
+ href = { d . url }
192
+ styleName = { getSelectorStyle ( selectedView , DETAIL_TABS . CHALLENGE_FORUM ) }
193
+ >
194
+ { d . name }
195
+ </ a >
196
+ ) )
184
197
)
185
198
}
186
199
</ 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,
@@ -266,10 +267,25 @@ export default function SideBar({
266
267
< p styleName = "link-like-paragraph" >
267
268
Questions?
268
269
‌
269
- < a href = { forumLink } >
270
- Ask in the Challenge Discussion Forums.
271
- </ a >
270
+ { _ . isEmpty ( discuss ) && (
271
+ < a href = { forumLink } >
272
+ Ask in the Challenge Discussion Forums.
273
+ </ a >
274
+ ) }
272
275
</ p >
276
+ { ! _ . isEmpty ( discuss ) && (
277
+ < ul >
278
+ { discuss . map ( d => (
279
+ < li >
280
+ < a
281
+ href = { d . url }
282
+ >
283
+ { d . name }
284
+ </ a >
285
+ </ li >
286
+ ) ) }
287
+ </ ul >
288
+ ) }
273
289
< h2 >
274
290
SOURCE FILES:
275
291
</ h2 >
@@ -351,6 +367,7 @@ export default function SideBar({
351
367
352
368
SideBar . defaultProps = {
353
369
eventDetail : null ,
370
+ discuss : [ ] ,
354
371
documents : undefined ,
355
372
hasRegistered : false ,
356
373
reviewType : 'COMMUNITY' ,
@@ -376,6 +393,7 @@ SideBar.propTypes = {
376
393
documents : PT . arrayOf ( PT . shape ( ) ) ,
377
394
shareable : PT . bool . isRequired ,
378
395
forumLink : PT . string . isRequired ,
396
+ discuss : PT . arrayOf ( PT . shape ( ) ) ,
379
397
hasRegistered : PT . bool ,
380
398
reviewType : PT . string ,
381
399
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' ) || 0 ) . 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