File tree 10 files changed +31
-1
lines changed
challenge-detail/RecommendedActiveChallenges
challenge-listing/Listing
10 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ export default function ChallengesCard({
29
29
userHandle,
30
30
expandedTags,
31
31
expandTag,
32
+ isLoggedIn,
32
33
} ) {
33
34
const {
34
35
id,
@@ -101,6 +102,7 @@ export default function ChallengesCard({
101
102
selectChallengeDetailsTab = { _ . noop }
102
103
userHandle = { userHandle }
103
104
className = { styles [ 'challenge-status-container' ] }
105
+ isLoggedIn = { isLoggedIn }
104
106
/>
105
107
</ div >
106
108
</ div >
@@ -132,4 +134,5 @@ ChallengesCard.propTypes = {
132
134
userHandle : PT . string ,
133
135
expandedTags : PT . arrayOf ( PT . number ) ,
134
136
expandTag : PT . func ,
137
+ isLoggedIn : PT . bool . isRequired ,
135
138
} ;
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ export default function RecommendedActiveChallenges({
14
14
auth,
15
15
expandedTags,
16
16
expandTag,
17
+ isLoggedIn,
17
18
} ) {
18
19
const items = _ . map ( challenges , ( c , idx ) => (
19
20
< ChallengesCard
@@ -27,6 +28,7 @@ export default function RecommendedActiveChallenges({
27
28
challengeTypes = { challengeTypes }
28
29
expandedTags = { expandedTags }
29
30
expandTag = { expandTag }
31
+ isLoggedIn = { isLoggedIn }
30
32
/>
31
33
) ) ;
32
34
@@ -69,4 +71,5 @@ RecommendedActiveChallenges.propTypes = {
69
71
} ) . isRequired ,
70
72
expandedTags : PT . arrayOf ( PT . number ) ,
71
73
expandTag : PT . func ,
74
+ isLoggedIn : PT . bool . isRequired ,
72
75
} ;
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ export default function NumSubmissions({
23
23
newChallengeDetails,
24
24
selectChallengeDetailsTab,
25
25
openChallengesInNewTabs,
26
+ isLoggedIn,
26
27
} ) {
27
28
let tip ;
28
29
const numOfSub = numOfSubmissions || 0 ;
@@ -31,7 +32,8 @@ export default function NumSubmissions({
31
32
case 1 : tip = '1 total submission' ; break ;
32
33
default : tip = `${ numOfSub } total submissions` ;
33
34
}
34
- const query = numOfSub ? `?tab=${ DETAIL_TABS . SUBMISSIONS } ` : '' ;
35
+
36
+ const query = ( numOfSub && isLoggedIn ) ? `?tab=${ DETAIL_TABS . SUBMISSIONS } ` : '' ;
35
37
const { track } = legacy ;
36
38
let link = `${ challengesUrl } /${ id } ${ query } ` ;
37
39
if ( ! newChallengeDetails && track !== 'DATA_SCIENCE' ) {
@@ -81,4 +83,5 @@ NumSubmissions.propTypes = {
81
83
newChallengeDetails : PT . bool . isRequired ,
82
84
selectChallengeDetailsTab : PT . func . isRequired ,
83
85
openChallengesInNewTabs : PT . bool ,
86
+ isLoggedIn : PT . bool . isRequired ,
84
87
} ;
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ export default function ChallengeStatus(props) {
61
61
selectChallengeDetailsTab,
62
62
openChallengesInNewTabs,
63
63
userId,
64
+ isLoggedIn,
64
65
} = props ;
65
66
66
67
/* TODO: Split into a separate ReactJS component! */
@@ -183,6 +184,7 @@ export default function ChallengeStatus(props) {
183
184
newChallengeDetails = { newChallengeDetails }
184
185
selectChallengeDetailsTab = { selectChallengeDetailsTab }
185
186
openChallengesInNewTabs = { openChallengesInNewTabs }
187
+ isLoggedIn = { isLoggedIn }
186
188
/>
187
189
</ div >
188
190
{
@@ -247,6 +249,7 @@ export default function ChallengeStatus(props) {
247
249
newChallengeDetails = { newChallengeDetails }
248
250
selectChallengeDetailsTab = { selectChallengeDetailsTab }
249
251
openChallengesInNewTabs = { openChallengesInNewTabs }
252
+ isLoggedIn = { isLoggedIn }
250
253
/>
251
254
</ div >
252
255
{
@@ -308,4 +311,5 @@ ChallengeStatus.propTypes = {
308
311
selectChallengeDetailsTab : PT . func . isRequired ,
309
312
className : PT . string ,
310
313
userId : PT . string ,
314
+ isLoggedIn : PT . bool . isRequired ,
311
315
} ;
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ function ChallengeCard({
35
35
selectChallengeDetailsTab,
36
36
userId,
37
37
domRef,
38
+ isLoggedIn,
38
39
} ) {
39
40
const challenge = passedInChallenge ;
40
41
const {
@@ -117,6 +118,7 @@ function ChallengeCard({
117
118
sampleWinnerProfile = { sampleWinnerProfile }
118
119
selectChallengeDetailsTab = { selectChallengeDetailsTab }
119
120
userId = { userId }
121
+ isLoggedIn = { isLoggedIn }
120
122
/>
121
123
</ div >
122
124
</ div >
@@ -149,6 +151,7 @@ ChallengeCard.propTypes = {
149
151
expandedTags : PT . arrayOf ( PT . number ) ,
150
152
expandTag : PT . func ,
151
153
domRef : PT . func ,
154
+ isLoggedIn : PT . bool . isRequired ,
152
155
} ;
153
156
154
157
export default ChallengeCard ;
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ export default function Bucket({
47
47
expandTag,
48
48
activeBucket,
49
49
searchTimestamp,
50
+ isLoggedIn,
50
51
} ) {
51
52
const refs = useRef ( [ ] ) ;
52
53
refs . current = [ ] ;
@@ -113,6 +114,7 @@ export default function Bucket({
113
114
expandedTags = { expandedTags }
114
115
expandTag = { expandTag }
115
116
domRef = { addToRefs }
117
+ isLoggedIn = { isLoggedIn }
116
118
/>
117
119
) ) ;
118
120
@@ -219,4 +221,5 @@ Bucket.propTypes = {
219
221
expandTag : PT . func ,
220
222
activeBucket : PT . string ,
221
223
searchTimestamp : PT . number ,
224
+ isLoggedIn : PT . bool . isRequired ,
222
225
} ;
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ function Listing({
45
45
expandedTags,
46
46
expandTag,
47
47
pastSearchTimestamp,
48
+ isLoggedIn,
48
49
} ) {
49
50
const buckets = getBuckets ( userChallenges ) ;
50
51
const isChallengesAvailable = ( bucket ) => {
@@ -92,6 +93,7 @@ function Listing({
92
93
setSort = { sort => setSort ( bucket , sort ) }
93
94
sort = { sorts [ bucket ] }
94
95
challengeTypes = { challengeTypes }
96
+ isLoggedIn = { isLoggedIn }
95
97
/>
96
98
)
97
99
: (
@@ -121,6 +123,7 @@ function Listing({
121
123
userId = { _ . get ( auth , 'user.userId' ) }
122
124
activeBucket = { activeBucket }
123
125
searchTimestamp = { searchTimestamp }
126
+ isLoggedIn = { isLoggedIn }
124
127
/>
125
128
)
126
129
) ;
@@ -214,6 +217,7 @@ Listing.propTypes = {
214
217
sorts : PT . shape ( ) . isRequired ,
215
218
pastSearchTimestamp : PT . number ,
216
219
userChallenges : PT . arrayOf ( PT . shape ( ) ) ,
220
+ isLoggedIn : PT . bool . isRequired ,
217
221
} ;
218
222
219
223
const mapStateToProps = ( state ) => {
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ export default function ChallengeListing(props) {
40
40
loadingChallenges,
41
41
preListingMsg,
42
42
isBucketSwitching,
43
+ isLoggedIn,
43
44
} = props ;
44
45
45
46
let { challenges } = props ;
@@ -116,6 +117,7 @@ export default function ChallengeListing(props) {
116
117
loadMoreActive = { props . loadMoreActive }
117
118
loadingActiveChallenges = { props . loadingChallenges }
118
119
userChallenges = { props . userChallenges }
120
+ isLoggedIn = { isLoggedIn }
119
121
/>
120
122
) ;
121
123
}
@@ -239,4 +241,5 @@ ChallengeListing.propTypes = {
239
241
loadMoreActive : PT . func ,
240
242
isBucketSwitching : PT . bool ,
241
243
userChallenges : PT . arrayOf ( PT . string ) ,
244
+ isLoggedIn : PT . bool . isRequired ,
242
245
} ;
Original file line number Diff line number Diff line change @@ -602,6 +602,7 @@ class ChallengeDetailPageContainer extends React.Component {
602
602
auth = { auth }
603
603
expandedTags = { expandedTags }
604
604
expandTag = { expandTag }
605
+ isLoggedIn = { isLoggedIn }
605
606
/>
606
607
) : null
607
608
}
Original file line number Diff line number Diff line change @@ -214,6 +214,8 @@ export class ListingContainer extends React.Component {
214
214
215
215
const { tokenV3 } = auth ;
216
216
217
+ const isLoggedIn = ! _ . isEmpty ( auth . tokenV3 ) ;
218
+
217
219
let loadMorePast ;
218
220
if ( ! allPastChallengesLoaded ) {
219
221
loadMorePast = ( ) => {
@@ -312,6 +314,7 @@ export class ListingContainer extends React.Component {
312
314
auth = { auth }
313
315
isBucketSwitching = { isBucketSwitching }
314
316
userChallenges = { userChallenges }
317
+ isLoggedIn = { isLoggedIn }
315
318
/>
316
319
</ div >
317
320
) ;
You can’t perform that action at this time.
0 commit comments