Skip to content

Commit

Permalink
Merge pull request #6947 from topcoder-platform/develop
Browse files Browse the repository at this point in the history
IC-28 Production releas -> master
  • Loading branch information
jmgasper authored Dec 13, 2023
2 parents 886fdfd + 27d2d40 commit e6afd31
Show file tree
Hide file tree
Showing 15 changed files with 279 additions and 79 deletions.
5 changes: 4 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,17 @@ workflows:
- PROD-4183
- changelog
- remove_submission_review
- standardised_skills
- TSJR-275
- skills_updates
- IC-15
# This is alternate dev env for parallel testing
- "build-test":
context : org-global
filters:
branches:
only:
- PROD-4251
- IC-13
# This is alternate dev env for parallel testing
- "build-qa":
context : org-global
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ exports[`Matches shallow shapshot 1 shapshot 1 1`] = `
>
<ChallengeTab
activeBucket="abc"
filterState={Object {}}
location={Object {}}
previousBucketOfActiveTab={null}
previousBucketOfPastChallengesTab={null}
selectBucket={[MockFunction]}
setFilterState={[MockFunction]}
setPreviousBucketOfActiveTab={[Function]}
setPreviousBucketOfPastChallengesTab={[Function]}
/>
Expand Down Expand Up @@ -70,10 +72,12 @@ exports[`Matches shallow shapshot 2 shapshot 2 1`] = `
>
<ChallengeTab
activeBucket="abc"
filterState={Object {}}
location={Object {}}
previousBucketOfActiveTab={null}
previousBucketOfPastChallengesTab={null}
selectBucket={[MockFunction]}
setFilterState={[MockFunction]}
setPreviousBucketOfActiveTab={[Function]}
setPreviousBucketOfPastChallengesTab={[Function]}
/>
Expand Down
1 change: 1 addition & 0 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,4 +476,5 @@ module.exports = {
MEMBER_PROFILE_REDIRECT_URL: 'https://profiles.topcoder-dev.com',
MEMBER_SEARCH_REDIRECT_URL: 'https://talent-search.topcoder-dev.com',
ACCOUNT_SETTINGS_REDIRECT_URL: 'https://account-settings.topcoder-dev.com',
INNOVATION_CHALLENGES_TAG: 'Innovation Challenge',
};
28 changes: 28 additions & 0 deletions src/shared/actions/challenge-listing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,27 @@ function getMyPastChallengesInit(uuid, page, frontFilter) {
// return getAllActiveChallengesWithUsersDone(uuid, tokenV3, filter);
// }

/**
* Extract search from front filter
*
* @param {Object} frontFilter
* @returns
*/
function extractSearchFilter(frontFilter = {}) {
const searchs = [];
if (frontFilter.search) {
searchs.push(frontFilter.search);
}
if (frontFilter.isInnovationChallenge === 'true') {
searchs.push('Innovation Challenge');
}

return {
search: _.uniq(searchs).join(' '),
isInnovationChallenge: '', // remove isInnovationChallenge from challenges query
};
}

/**
* Gets 1 page of active challenges (including marathon matches) from the backend.
* Once this action is completed any active challenges saved to the state before
Expand All @@ -178,6 +199,7 @@ function getActiveChallengesDone(uuid, page, backendFilter, tokenV3, frontFilter
backendFilter,
frontFilter: {
...frontFilter,
...extractSearchFilter(frontFilter),
status: 'Active',
currentPhaseName: 'Submission',
registrationEndDateEnd: new Date().toISOString(),
Expand Down Expand Up @@ -240,6 +262,7 @@ function getOpenForRegistrationChallengesDone(uuid, page, backendFilter,
backendFilter,
frontFilter: {
...frontFilter,
...extractSearchFilter(frontFilter),
status: 'Active',
currentPhaseName: 'Registration',
perPage: PAGE_SIZE,
Expand Down Expand Up @@ -275,6 +298,7 @@ function getMyChallengesDone(uuid, page, backendFilter, tokenV3, frontFilter = {
backendFilter,
frontFilter: {
...frontFilter,
...extractSearchFilter(frontFilter),
status: 'Active',
memberId: userId,
perPage: PAGE_SIZE,
Expand All @@ -300,6 +324,7 @@ function getAllChallengesDone(uuid, page, backendFilter, tokenV3, frontFilter =
backendFilter,
frontFilter: {
...frontFilter,
...extractSearchFilter(frontFilter),
status: 'Active',
perPage: PAGE_SIZE,
page: page + 1,
Expand All @@ -325,6 +350,7 @@ function getMyPastChallengesDone(uuid, page, backendFilter, tokenV3, frontFilter
backendFilter,
frontFilter: {
...frontFilter,
...extractSearchFilter(frontFilter),
status: 'Completed',
memberId: userId,
perPage: PAGE_SIZE,
Expand Down Expand Up @@ -352,6 +378,7 @@ function getTotalChallengesCountDone(uuid, tokenV3, frontFilter = {}) {
backendFilter: {},
frontFilter: {
...frontFilter,
...extractSearchFilter(frontFilter),
status: 'Active',
isLightweight: true,
perPage: 1,
Expand Down Expand Up @@ -434,6 +461,7 @@ function getPastChallengesDone(uuid, page, backendFilter, tokenV3, frontFilter =
backendFilter,
frontFilter: {
...frontFilter,
...extractSearchFilter(frontFilter),
status: 'Completed',
perPage: PAGE_SIZE,
page: page + 1,
Expand Down
16 changes: 12 additions & 4 deletions src/shared/actions/dashboard.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import _ from 'lodash';
import { createActions } from 'redux-actions';
import { getService } from '../services/dashboard';

const service = getService();

function fetchChallenges(query) {
return service.getChallenges(query);
function fetchChallengesInit(title) {
return title;
}

async function fetchChallenges(title, query) {
const challenges = await service.getChallenges(query);

return {
challenges,
title,
};
}

export default createActions({
DASHBOARD: {
FETCH_CHALLENGES_INIT: _.noop,
FETCH_CHALLENGES_INIT: fetchChallengesInit,
FETCH_CHALLENGES_DONE: fetchChallenges,
},
});
17 changes: 12 additions & 5 deletions src/shared/components/Dashboard/Challenges/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import _ from 'lodash';
import LoadingIndicator from 'components/LoadingIndicator';
import PT from 'prop-types';
import React from 'react';
import qs from 'qs';

import { config } from 'topcoder-react-utils';

Expand All @@ -11,22 +12,24 @@ export default function ChallengesFeed({
challenges,
loading,
theme,
title,
challengeListingQuery,
}) {
return (
return challenges && challenges.length ? (
<div styleName={`container ${theme}`}>
<div styleName="header">
<span styleName="title">CHALLENGES</span>
<span styleName="title">{title}</span>
<a
styleName="allLink"
href={`${config.URL.CHALLENGES_URL}`}
href={`${config.URL.CHALLENGES_URL}${challengeListingQuery ? `?${qs.stringify(challengeListingQuery)}` : ''}`}
target="_blank"
rel="noreferrer"
>View all <span>challenges</span>
</a>
</div>
<div styleName="challenges">
{loading ? <div styleName="loading"><LoadingIndicator /></div>
: challenges.map(challenge => (
: (challenges || []).map(challenge => (
<div styleName="row" key={challenge.id}>
<a
href={`/challenges/${challenge.id}`}
Expand All @@ -46,16 +49,20 @@ export default function ChallengesFeed({
))}
</div>
</div>
);
) : null;
}

ChallengesFeed.defaultProps = {
challenges: [],
theme: 'light',
title: 'CHALLENGES',
challengeListingQuery: undefined,
};

ChallengesFeed.propTypes = {
challenges: PT.arrayOf(PT.shape()),
loading: PT.bool.isRequired,
theme: PT.oneOf(['dark', 'light']),
title: PT.string,
challengeListingQuery: PT.shape(),
};
2 changes: 1 addition & 1 deletion src/shared/components/GUIKit/DropdownSkills/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function DropdownSkills({
className="dropdownContainer"
styleName={`container ${
selectedOption && !!selectedOption.length ? 'haveValue' : ''
} ${errorMsg ? 'haveError' : ''} ${_.every(internalTerms, { selected: true }) ? 'isEmptySelectList' : ''}`}
} ${errorMsg ? 'haveError' : ''}`}
>
<div styleName="relative">
<Async
Expand Down
9 changes: 0 additions & 9 deletions src/shared/components/GUIKit/DropdownSkills/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,6 @@
border-bottom-left-radius: 0 !important;
}
}

&.isEmptySelectList {
:global {
.Select-menu-outer {
border: none !important;
padding-bottom: 10px !important;
}
}
}
}

.addAnotherSkill {
Expand Down
Loading

0 comments on commit e6afd31

Please sign in to comment.