Skip to content

Issue#4706 : Track and Subtrack enhancements #4711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports[`Matches shallow shapshot 1`] = `
<div
className="src-shared-components-TrackIcon-___style__develop___3v4fM src-shared-components-TrackIcon-___style__main-icon___1q-1_"
>
Cd
CH
</div>
<a
href="https://www.topcoder-dev.com/tco"
Expand All @@ -26,15 +26,15 @@ exports[`Matches shallow shapshot 2`] = `
className="src-shared-components-TrackIcon-___style__trackIcon___3gJ9l"
>
<div
className="src-shared-components-TrackIcon-___style__data_science___3YlDf src-shared-components-TrackIcon-___style__main-icon___1q-1_"
className="src-shared-components-TrackIcon-___style__develop___3v4fM src-shared-components-TrackIcon-___style__main-icon___1q-1_"
>
Cd
CH
</div>
<a
href="https://www.topcoder-dev.com/tco"
>
<div
className="src-shared-components-TrackIcon-___style__data_science___3YlDf src-shared-components-TrackIcon-___style__tco-icon___18ZV7"
className="src-shared-components-TrackIcon-___style__develop___3v4fM src-shared-components-TrackIcon-___style__tco-icon___18ZV7"
>
TCO
</div>
Expand All @@ -49,7 +49,7 @@ exports[`Matches shallow shapshot 3`] = `
<div
className="src-shared-components-TrackIcon-___style__develop___3v4fM src-shared-components-TrackIcon-___style__main-icon___1q-1_"
>
Cd
CH
</div>
<a
href="https://www.topcoder-dev.com/tco"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ exports[`Matches shallow shapshot shapshot 1 1`] = `
"eventName": "Submit",
},
],
"isDataScience": true,
"legacy": Object {
"track": "DEVELOP",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ const mockDatas = [{
showTrackModal,
trackModalShown: true,
validKeywords: [''],
validSubtracks: [''],
validTypes: [''],
}, {
challengeGroupId: '1',
communityFilters: [{ filter: {} }],
communityName: 'name',
expanded: false,
filterState: {
tags: ['abc'], subtracks: ['CODE'], endDate: moment('2019-12-31T23:00:00.000Z'), startDate: moment('2019-12-31T23:00:00.000Z'), tracks: ['tracks'],
tags: ['abc'], types: ['927abff4-7af9-4145-8ba1-577c16e64e2e'], endDate: moment('2019-12-31T23:00:00.000Z'), startDate: moment('2019-12-31T23:00:00.000Z'), tracks: ['tracks'],
},
isCardTypeSet: 'Challenges',
saveFilter,
Expand All @@ -59,7 +59,7 @@ const mockDatas = [{
showTrackModal,
trackModalShown: true,
validKeywords: [''],
validSubtracks: [''],
validTypes: [''],
}];

describe('Matches shallow shapshot', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const mockDatas = [{
setFilterState,
setSearchText,
validKeywords: ['key', 'word'],
validSubtracks: [{ name: 'sub', subTrack: 'sub' }, { name: 'track', subTrack: 'track' }],
validTypes: [{ name: 'sub', subTrack: 'sub' }, { name: 'track', subTrack: 'track' }],
onClose,
}, {
communityFilters: [
Expand All @@ -42,7 +42,7 @@ const mockDatas = [{
setFilterState,
setSearchText,
validKeywords: [],
validSubtracks: [],
validTypes: [],
onClose,
}];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ exports[`Matches shallow shapshot shapshot 1`] = `
"",
]
}
validSubtracks={
validTypes={
Array [
"",
]
Expand All @@ -85,9 +85,11 @@ exports[`Matches shallow shapshot shapshot 1`] = `
devEnabled={true}
onClose={[Function]}
opened={true}
qaEnabled={true}
switchDataScience={[Function]}
switchDesign={[Function]}
switchDev={[Function]}
switchQA={[Function]}
/>
</div>
`;
Expand Down Expand Up @@ -159,6 +161,23 @@ exports[`Matches shallow shapshot shapshot 2`] = `
themePriority="adhoc-context-default"
/>
</span>
<span
aria-checked={false}
aria-label="QA toggle button pressed Off"
className="src-shared-components-challenge-listing-Filters-___ChallengeFilters__filter-switch-with-label___21Ups"
role="switch"
>
<ThemedSwitchWithLabel
composeAdhocTheme="deeply"
composeContextTheme="softly"
enabled={false}
labelAfter=""
labelBefore="QA"
mapThemrProps={[Function]}
onSwitch={[Function]}
themePriority="adhoc-context-default"
/>
</span>
</span>
<span
className="src-shared-components-challenge-listing-Filters-___ChallengeFilters__pulled-right___bfsMZ"
Expand Down Expand Up @@ -216,15 +235,15 @@ exports[`Matches shallow shapshot shapshot 2`] = `
Object {
"endDate": "2019-12-31T23:00:00.000Z",
"startDate": "2019-12-31T23:00:00.000Z",
"subtracks": Array [
"CODE",
],
"tags": Array [
"abc",
],
"tracks": Array [
"tracks",
],
"types": Array [
"927abff4-7af9-4145-8ba1-577c16e64e2e",
],
}
}
hidden={true}
Expand All @@ -242,7 +261,7 @@ exports[`Matches shallow shapshot shapshot 2`] = `
"",
]
}
validSubtracks={
validTypes={
Array [
"",
]
Expand All @@ -254,9 +273,11 @@ exports[`Matches shallow shapshot shapshot 2`] = `
devEnabled={false}
onClose={[Function]}
opened={true}
qaEnabled={false}
switchDataScience={[Function]}
switchDesign={[Function]}
switchDev={[Function]}
switchQA={[Function]}
/>
</div>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ exports[`Matches shallow shapshot 1`] = `
>
<label
className="src-shared-components-challenge-listing-Filters-FiltersPanel-___style__left-label___15kRu"
htmlFor="track-select"
htmlFor="type-select"
>
Subtrack
Type
<input
type="hidden"
/>
</label>
<Select
id="track-select"
id="type-select"
multi={true}
onChange={[Function]}
options={
Expand All @@ -132,7 +132,7 @@ exports[`Matches shallow shapshot 1`] = `
},
]
}
placeholder="Select Subtrack"
placeholder="Select Type"
selectRef={[Function]}
simpleValue={true}
value={null}
Expand Down Expand Up @@ -304,19 +304,19 @@ exports[`Matches shallow shapshot 2`] = `
>
<label
className="src-shared-components-challenge-listing-Filters-FiltersPanel-___style__left-label___15kRu"
htmlFor="track-select"
htmlFor="type-select"
>
Subtrack
Type
<input
type="hidden"
/>
</label>
<Select
id="track-select"
id="type-select"
multi={true}
onChange={[Function]}
options={Array []}
placeholder="Select Subtrack"
placeholder="Select Type"
selectRef={[Function]}
simpleValue={true}
value={null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ exports[`Matches shallow shapshot 1`] = `
},
],
"id": "2",
"isDataScience": false,
"legacy": Object {
"track": "DEVELOP",
},
Expand Down
10 changes: 5 additions & 5 deletions __tests__/shared/containers/challenge-listing/FilterPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('shallow render connnected component', () => {
loadingChallengeTags: false,
loadingChallengeTypes: false,
challengeTags: [],
challengeSubtracks: [],
challengeTypes: [],
selectedCommunityId: '1',
},
auth: {
Expand Down Expand Up @@ -68,9 +68,9 @@ describe('full render pure component', () => {
filterState: {},
getAvailableFilterName: jest.fn(),
loadingKeywords: false,
loadingSubtracks: false,
loadingTypes: false,
validKeywords: [],
validSubtracks: [],
validTypes: [],
selectedCommunityId: '1',
tokenV2: 'tokenV2',
getTypes: jest.fn(),
Expand Down Expand Up @@ -117,7 +117,7 @@ describe('full render pure component', () => {
instance = mount(<FilterPanel
{...initialProps}
challengeGroupId="1"
loadingSubtracks
loadingTypes
loadingKeywords
/>);

Expand Down Expand Up @@ -183,7 +183,7 @@ describe('full render connnected component and dispatch actions', () => {
loadingChallengeTags: true,
loadingChallengeTypes: true,
challengeTags: [],
challengeSubtracks: [],
challengeTypes: [],
selectedCommunityId: '1',
},
auth: {
Expand Down
4 changes: 2 additions & 2 deletions __tests__/shared/containers/challenge-listing/Listing.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('full render pure component', () => {
allDraftChallengesLoaded: false,
allPastChallengesLoaded: false,
challenges: [],
challengeSubtracks: [],
challengeTypes: [],
challengeTags: [],
getCommunitiesList: () => {},
communityFilters: [{ communityId: '1', name: 'My Filter', filter: {} }],
Expand Down Expand Up @@ -177,7 +177,7 @@ describe('full render connnected component and dispatch actions', () => {
allDraftChallengesLoaded: false,
allPastChallengesLoaded: false,
challenges: [{ id: '1' }],
challengeSubtracks: [],
challengeTypes: [],
challengeTags: [],
// communityFilters: [{ id: '1', name: 'My Filter', filter: {} }],
dropChallenges: jest.fn(),
Expand Down
2 changes: 1 addition & 1 deletion src/shared/actions/challenge-listing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function getAll(getter, page = 0, prev) {
}

/**
* Gets possible challenge subtracks.
* Gets possible challenge types.
* @return {Promise}
*/
function getChallengeTypesDone() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
DataScienceTrackTag,
DesignTrackTag,
DevelopmentTrackTag,
QATrackTag,
} from 'topcoder-react-ui-kit';

import { Link } from 'topcoder-react-utils';
Expand Down Expand Up @@ -40,6 +41,9 @@ export default function Card({
case COMPETITION_TRACKS.DEVELOP:
TrackTag = DevelopmentTrackTag;
break;
case COMPETITION_TRACKS.QA:
TrackTag = QATrackTag;
break;
default:
throw new Error('Wrong competition track value');
}
Expand All @@ -57,7 +61,7 @@ export default function Card({
return (
<div styleName="container">
<TrackTag
to={`${baseUrl}/challenges?filter[subtracks][0]=${
to={`${baseUrl}/challenges?filter[types][0]=${
encodeURIComponent(subTrack)}`}
>
{_.capitalize(subTrack).replace(/_/g, ' ')}
Expand Down
Loading