Skip to content

Commit 869fd7e

Browse files
authored
Merge pull request #4570 from nursoltan-s/issue-4564
Submission redirect to details page when user not logged in
2 parents b708f56 + 8a55d11 commit 869fd7e

File tree

10 files changed

+31
-1
lines changed

10 files changed

+31
-1
lines changed

src/shared/components/challenge-detail/RecommendedActiveChallenges/ChallengesCard/index.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default function ChallengesCard({
2929
userHandle,
3030
expandedTags,
3131
expandTag,
32+
isLoggedIn,
3233
}) {
3334
const {
3435
id,
@@ -101,6 +102,7 @@ export default function ChallengesCard({
101102
selectChallengeDetailsTab={_.noop}
102103
userHandle={userHandle}
103104
className={styles['challenge-status-container']}
105+
isLoggedIn={isLoggedIn}
104106
/>
105107
</div>
106108
</div>
@@ -132,4 +134,5 @@ ChallengesCard.propTypes = {
132134
userHandle: PT.string,
133135
expandedTags: PT.arrayOf(PT.number),
134136
expandTag: PT.func,
137+
isLoggedIn: PT.bool.isRequired,
135138
};

src/shared/components/challenge-detail/RecommendedActiveChallenges/index.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default function RecommendedActiveChallenges({
1414
auth,
1515
expandedTags,
1616
expandTag,
17+
isLoggedIn,
1718
}) {
1819
const items = _.map(challenges, (c, idx) => (
1920
<ChallengesCard
@@ -27,6 +28,7 @@ export default function RecommendedActiveChallenges({
2728
challengeTypes={challengeTypes}
2829
expandedTags={expandedTags}
2930
expandTag={expandTag}
31+
isLoggedIn={isLoggedIn}
3032
/>
3133
));
3234

@@ -69,4 +71,5 @@ RecommendedActiveChallenges.propTypes = {
6971
}).isRequired,
7072
expandedTags: PT.arrayOf(PT.number),
7173
expandTag: PT.func,
74+
isLoggedIn: PT.bool.isRequired,
7275
};

src/shared/components/challenge-listing/ChallengeCard/NumSubmissions/index.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export default function NumSubmissions({
2323
newChallengeDetails,
2424
selectChallengeDetailsTab,
2525
openChallengesInNewTabs,
26+
isLoggedIn,
2627
}) {
2728
let tip;
2829
const numOfSub = numOfSubmissions || 0;
@@ -31,7 +32,8 @@ export default function NumSubmissions({
3132
case 1: tip = '1 total submission'; break;
3233
default: tip = `${numOfSub} total submissions`;
3334
}
34-
const query = numOfSub ? `?tab=${DETAIL_TABS.SUBMISSIONS}` : '';
35+
36+
const query = (numOfSub && isLoggedIn) ? `?tab=${DETAIL_TABS.SUBMISSIONS}` : '';
3537
const { track } = legacy;
3638
let link = `${challengesUrl}/${id}${query}`;
3739
if (!newChallengeDetails && track !== 'DATA_SCIENCE') {
@@ -81,4 +83,5 @@ NumSubmissions.propTypes = {
8183
newChallengeDetails: PT.bool.isRequired,
8284
selectChallengeDetailsTab: PT.func.isRequired,
8385
openChallengesInNewTabs: PT.bool,
86+
isLoggedIn: PT.bool.isRequired,
8487
};

src/shared/components/challenge-listing/ChallengeCard/Status/index.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export default function ChallengeStatus(props) {
6161
selectChallengeDetailsTab,
6262
openChallengesInNewTabs,
6363
userId,
64+
isLoggedIn,
6465
} = props;
6566

6667
/* TODO: Split into a separate ReactJS component! */
@@ -183,6 +184,7 @@ export default function ChallengeStatus(props) {
183184
newChallengeDetails={newChallengeDetails}
184185
selectChallengeDetailsTab={selectChallengeDetailsTab}
185186
openChallengesInNewTabs={openChallengesInNewTabs}
187+
isLoggedIn={isLoggedIn}
186188
/>
187189
</div>
188190
{
@@ -247,6 +249,7 @@ export default function ChallengeStatus(props) {
247249
newChallengeDetails={newChallengeDetails}
248250
selectChallengeDetailsTab={selectChallengeDetailsTab}
249251
openChallengesInNewTabs={openChallengesInNewTabs}
252+
isLoggedIn={isLoggedIn}
250253
/>
251254
</div>
252255
{
@@ -308,4 +311,5 @@ ChallengeStatus.propTypes = {
308311
selectChallengeDetailsTab: PT.func.isRequired,
309312
className: PT.string,
310313
userId: PT.string,
314+
isLoggedIn: PT.bool.isRequired,
311315
};

src/shared/components/challenge-listing/ChallengeCard/index.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ function ChallengeCard({
3535
selectChallengeDetailsTab,
3636
userId,
3737
domRef,
38+
isLoggedIn,
3839
}) {
3940
const challenge = passedInChallenge;
4041
const {
@@ -117,6 +118,7 @@ function ChallengeCard({
117118
sampleWinnerProfile={sampleWinnerProfile}
118119
selectChallengeDetailsTab={selectChallengeDetailsTab}
119120
userId={userId}
121+
isLoggedIn={isLoggedIn}
120122
/>
121123
</div>
122124
</div>
@@ -149,6 +151,7 @@ ChallengeCard.propTypes = {
149151
expandedTags: PT.arrayOf(PT.number),
150152
expandTag: PT.func,
151153
domRef: PT.func,
154+
isLoggedIn: PT.bool.isRequired,
152155
};
153156

154157
export default ChallengeCard;

src/shared/components/challenge-listing/Listing/Bucket/index.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export default function Bucket({
4747
expandTag,
4848
activeBucket,
4949
searchTimestamp,
50+
isLoggedIn,
5051
}) {
5152
const refs = useRef([]);
5253
refs.current = [];
@@ -113,6 +114,7 @@ export default function Bucket({
113114
expandedTags={expandedTags}
114115
expandTag={expandTag}
115116
domRef={addToRefs}
117+
isLoggedIn={isLoggedIn}
116118
/>
117119
));
118120

@@ -219,4 +221,5 @@ Bucket.propTypes = {
219221
expandTag: PT.func,
220222
activeBucket: PT.string,
221223
searchTimestamp: PT.number,
224+
isLoggedIn: PT.bool.isRequired,
222225
};

src/shared/components/challenge-listing/Listing/index.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ function Listing({
4545
expandedTags,
4646
expandTag,
4747
pastSearchTimestamp,
48+
isLoggedIn,
4849
}) {
4950
const buckets = getBuckets(userChallenges);
5051
const isChallengesAvailable = (bucket) => {
@@ -92,6 +93,7 @@ function Listing({
9293
setSort={sort => setSort(bucket, sort)}
9394
sort={sorts[bucket]}
9495
challengeTypes={challengeTypes}
96+
isLoggedIn={isLoggedIn}
9597
/>
9698
)
9799
: (
@@ -121,6 +123,7 @@ function Listing({
121123
userId={_.get(auth, 'user.userId')}
122124
activeBucket={activeBucket}
123125
searchTimestamp={searchTimestamp}
126+
isLoggedIn={isLoggedIn}
124127
/>
125128
)
126129
);
@@ -214,6 +217,7 @@ Listing.propTypes = {
214217
sorts: PT.shape().isRequired,
215218
pastSearchTimestamp: PT.number,
216219
userChallenges: PT.arrayOf(PT.shape()),
220+
isLoggedIn: PT.bool.isRequired,
217221
};
218222

219223
const mapStateToProps = (state) => {

src/shared/components/challenge-listing/index.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export default function ChallengeListing(props) {
4040
loadingChallenges,
4141
preListingMsg,
4242
isBucketSwitching,
43+
isLoggedIn,
4344
} = props;
4445

4546
let { challenges } = props;
@@ -116,6 +117,7 @@ export default function ChallengeListing(props) {
116117
loadMoreActive={props.loadMoreActive}
117118
loadingActiveChallenges={props.loadingChallenges}
118119
userChallenges={props.userChallenges}
120+
isLoggedIn={isLoggedIn}
119121
/>
120122
);
121123
}
@@ -239,4 +241,5 @@ ChallengeListing.propTypes = {
239241
loadMoreActive: PT.func,
240242
isBucketSwitching: PT.bool,
241243
userChallenges: PT.arrayOf(PT.string),
244+
isLoggedIn: PT.bool.isRequired,
242245
};

src/shared/containers/challenge-detail/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@ class ChallengeDetailPageContainer extends React.Component {
602602
auth={auth}
603603
expandedTags={expandedTags}
604604
expandTag={expandTag}
605+
isLoggedIn={isLoggedIn}
605606
/>
606607
) : null
607608
}

src/shared/containers/challenge-listing/Listing/index.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ export class ListingContainer extends React.Component {
214214

215215
const { tokenV3 } = auth;
216216

217+
const isLoggedIn = !_.isEmpty(auth.tokenV3);
218+
217219
let loadMorePast;
218220
if (!allPastChallengesLoaded) {
219221
loadMorePast = () => {
@@ -312,6 +314,7 @@ export class ListingContainer extends React.Component {
312314
auth={auth}
313315
isBucketSwitching={isBucketSwitching}
314316
userChallenges={userChallenges}
317+
isLoggedIn={isLoggedIn}
315318
/>
316319
</div>
317320
);

0 commit comments

Comments
 (0)