Skip to content

Commit d21a40a

Browse files
authored
Merge pull request #4925 from topcoder-platform/gui-kit-components
Gui kit components
2 parents d21cfd1 + a7a0567 commit d21a40a

File tree

19 files changed

+73
-60
lines changed

19 files changed

+73
-60
lines changed

.circleci/config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,15 @@ workflows:
230230
filters:
231231
branches:
232232
only:
233-
- milestone-20200917
233+
- milestone-20200924
234234
- develop
235235
# This is alternate dev env for parallel testing
236236
- "build-test":
237237
context : org-global
238238
filters:
239239
branches:
240240
only:
241+
- hot-fix-ad-code
241242
- feature-contentful
242243
# This is alternate dev env for parallel testing
243244
- "build-qa":

__tests__/shared/__snapshots__/index.jsx.snap

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ exports[`Snapshot match 1`] = `
1919
href="/challenges/manifest.json"
2020
rel="manifest"
2121
/>
22+
<script
23+
async={true}
24+
src="https://43d132d5dbff47c59d9d53ad448f93c2.js.ubembed.com"
25+
/>
2226
</HelmetWrapper>
2327
<withRouter(Connect(Routes)) />
2428
<Connect(ErrorMessageContainer) />
@@ -53,6 +57,10 @@ exports[`Snapshot match 2`] = `
5357
href="/challenges/manifest.json"
5458
rel="manifest"
5559
/>
60+
<script
61+
async={true}
62+
src="https://43d132d5dbff47c59d9d53ad448f93c2.js.ubembed.com"
63+
/>
5664
</HelmetWrapper>
5765
<withRouter(Connect(Routes)) />
5866
<Connect(ErrorMessageContainer) />

__tests__/shared/components/ChallengeTile/__snapshots__/index.jsx.snap

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,15 @@ exports[`renders marathon 1`] = `
202202
className="src-shared-components-ChallengeTile-___style__completed-challenge___3w5tT"
203203
>
204204
<header>
205-
<a
205+
<Link
206206
className="src-shared-components-ChallengeTile-___style__name___1jF7j"
207-
href="https://community.topcoder.com/longcontest/stats/?module=ViewOverview&rd=17153"
207+
replace={false}
208+
to="/challenges/15404"
208209
>
209-
2018 TCO Marathon
210-
</a>
210+
<span>
211+
2018 TCO Marathon
212+
</span>
213+
</Link>
211214
<p
212215
className="src-shared-components-ChallengeTile-___style__subtrack-color___2AJaw"
213216
>

__tests__/shared/components/Header/__snapshots__/index.jsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ exports[`Default render 1`] = `
118118
},
119119
Object {
120120
"href": "https://www.topcoder-dev.com/blog",
121+
"openNewTab": true,
121122
"title": "Blog",
122123
},
123124
Object {

__tests__/shared/components/ProfilePage/__snapshots__/index.jsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ exports[`renders a full Profile correctly 1`] = `
5858
}
5959
onShowBadges={[Function]}
6060
showBadgesButton={true}
61-
wins={3}
61+
wins={0}
6262
/>
6363
</div>
6464
</Sticky>

config/default.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ module.exports = {
160160
COMMUNITY_API: 'http://localhost:8000',
161161
COMMUNITY_APP_GITHUB_ISSUES: 'https://github.com/topcoder-platform/community-app/issues',
162162
EMAIL_VERIFY_URL: 'http://www.topcoder-dev.com/settings/account/changeEmail',
163+
ABANDONMENT_EMBED: 'https://43d132d5dbff47c59d9d53ad448f93c2.js.ubembed.com',
163164
},
164165

165166
/* Information about Topcoder user groups can be cached in various places.
@@ -370,6 +371,7 @@ module.exports = {
370371
{
371372
title: 'Blog',
372373
href: 'https://www.topcoder-dev.com/blog',
374+
openNewTab: true,
373375
},
374376
{
375377
title: 'Thrive',

config/production.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ module.exports = {
171171
{
172172
title: 'Blog',
173173
href: 'https://www.topcoder.com/blog',
174+
openNewTab: true,
174175
},
175176
{
176177
title: 'Thrive',

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@
137137
"tc-accounts": "git+https://github.com/appirio-tech/accounts-app.git#dev",
138138
"tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3",
139139
"tc-ui": "^1.0.12",
140-
"topcoder-react-lib": "1.0.4",
141-
"topcoder-react-ui-kit": "2.0.0",
140+
"topcoder-react-lib": "1.0.5",
141+
"topcoder-react-ui-kit": "2.0.1",
142142
"topcoder-react-utils": "0.7.8",
143143
"turndown": "^4.0.2",
144144
"url-parse": "^1.4.1",

src/shared/app.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Routes from 'routes';
1111
import ErrorMessage from 'containers/ErrorMessage';
1212
import ErrorIcons from 'containers/ErrorIcons';
1313

14-
import { DevTools, isomorphy } from 'topcoder-react-utils';
14+
import { DevTools, isomorphy, config } from 'topcoder-react-utils';
1515

1616
import ExtendedReduxToastr from 'containers/toastr';
1717

@@ -37,6 +37,7 @@ export default function App() {
3737
<Helmet htmlAttributes={{ lang: 'en' }}>
3838
<meta name="theme-color" content="#FFFFFF" />
3939
<link rel="manifest" href="/challenges/manifest.json" />
40+
<script src={config.URL.ABANDONMENT_EMBED} async />
4041
</Helmet>
4142
<Routes />
4243
<ErrorMessage />

src/shared/components/ChallengeTile/index.jsx

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* Challenge tile.
33
*/
44
/* eslint-env browser */
5-
import _ from 'lodash';
65
import React from 'react';
76
import PT from 'prop-types';
87
import { Link } from 'react-router-dom';
@@ -83,36 +82,27 @@ class ChallengeTile extends React.Component {
8382
margin: '10px 5px',
8483
};
8584

86-
const isDataScience = track === COMPETITION_TRACKS.DATA_SCIENCE;
8785
const isDevelopment = track === COMPETITION_TRACKS.DEVELOP;
8886
const isDesign = track === COMPETITION_TRACKS.DESIGN;
8987

90-
const roundId = isDataScience ? _.get(challenge, 'rounds.0.id') : 0;
91-
9288
return (
9389
<div styleName="challenge tile" style={extraStyle}>
9490
<div styleName={outStyleName}>
9591
<div styleName="completed-challenge">
9692
<header>
97-
{ !isDataScience && (!challenge.isPrivate
93+
{ !challenge.isPrivate
9894
? (
9995
<Link to={`/challenges/${challenge.id}`} styleName="name">
10096
<span>
10197
{ challenge.name }
10298
</span>
10399
</Link>
104-
) : (
100+
)
101+
: (
105102
<span>
106103
{ challenge.name }
107104
</span>
108-
)) }
109-
110-
{ isDataScience
111-
&& (
112-
<a styleName="name" href={`https://community.topcoder.com/longcontest/stats/?module=ViewOverview&rd=${roundId}`}>
113-
{ challenge.name }
114-
</a>
115-
) }
105+
)}
116106

117107
<p styleName="subtrack-color">
118108
{underscoreReplace(type)}

src/shared/components/ProfilePage/Stats/SubTrackChallengeView/index.jsx

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,10 @@ const processPastChallenge = (challenge) => {
111111
class SubTrackChallengeView extends React.Component {
112112
constructor(props, context) {
113113
super(props, context);
114-
// this is current page number. starts with 0.
115-
// everytime we scroll at the bottom, we query from offset = pageNum * CHALLENGE_PER_PAGE
116114
this.state = {
117-
// this is current page number. starts with 0.
115+
// this is current page number. starts with 1.
118116
// everytime we scroll at the bottom, we query from offset = pageNum * CHALLENGE_PER_PAGE
119-
pageNum: 0,
117+
pageNum: 1,
120118
// which challenge's modal should be poped. null means no modal
121119
challengeIndexToPopModal: null,
122120
};
@@ -140,13 +138,17 @@ class SubTrackChallengeView extends React.Component {
140138
userId,
141139
} = this.props;
142140

141+
const {
142+
pageNum,
143+
} = this.state;
144+
143145
if (track === 'DEVELOP' || track === 'DESIGN') {
144146
if (!loadingSubTrackChallengesUUID) {
145147
loadSubtrackChallenges(
146148
handle,
147149
auth.tokenV3,
148150
track, subTrack,
149-
0,
151+
pageNum,
150152
CHALLENGE_PER_PAGE,
151153
true,
152154
userId,
@@ -155,11 +157,12 @@ class SubTrackChallengeView extends React.Component {
155157
} else if (track === 'DATA_SCIENCE') {
156158
if (subTrack === 'SRM') {
157159
if (!loadingSRMUUID) {
158-
loadSRM(handle, auth.tokenV3, 0, CHALLENGE_PER_PAGE, true);
160+
// pageNum - 1 to match with v4 offset
161+
loadSRM(handle, auth.tokenV3, pageNum - 1, CHALLENGE_PER_PAGE, true);
159162
}
160163
} else if (subTrack === 'MARATHON_MATCH') {
161164
if (!loadingMarathonUUID) {
162-
loadMarathon(handle, auth.tokenV3, 0, CHALLENGE_PER_PAGE, true);
165+
loadMarathon(handle, userId, auth.tokenV3, pageNum, CHALLENGE_PER_PAGE, true);
163166
}
164167
}
165168
}
@@ -204,12 +207,12 @@ class SubTrackChallengeView extends React.Component {
204207
} else if (track === 'DATA_SCIENCE') {
205208
if (subTrack === 'SRM') {
206209
if (!loadingSRMUUID) {
207-
loadSRM(handle, auth.tokenV3, pageNum + 1, CHALLENGE_PER_PAGE, false);
210+
loadSRM(handle, auth.tokenV3, pageNum, CHALLENGE_PER_PAGE, false);
208211
this.setState({ pageNum: pageNum + 1 });
209212
}
210213
} else if (subTrack === 'MARATHON_MATCH') {
211214
if (!loadingMarathonUUID) {
212-
loadMarathon(handle, auth.tokenV3, pageNum + 1, CHALLENGE_PER_PAGE, false);
215+
loadMarathon(handle, userId, auth.tokenV3, pageNum + 1, CHALLENGE_PER_PAGE, false);
213216
this.setState({ pageNum: pageNum + 1 });
214217
}
215218
}
@@ -245,7 +248,7 @@ class SubTrackChallengeView extends React.Component {
245248
userId,
246249
} = this.props;
247250

248-
if (pageNum === 0
251+
if (pageNum === 1
249252
&& (loadingSubTrackChallengesUUID || loadingSRMUUID || loadingMarathonUUID)) {
250253
return <LoadingIndicator />;
251254
}
@@ -347,7 +350,6 @@ class SubTrackChallengeView extends React.Component {
347350
userMarathons,
348351
item => ({
349352
...item,
350-
submissionEndDate: _.get(item, 'rounds.0.systemTestEndAt'),
351353
pointTotal: _.get(item, 'rounds.0.userMMDetails.pointTotal'),
352354
}),
353355
);
@@ -440,10 +442,18 @@ function mapDispatchToProps(dispatch) {
440442
dispatch(action.getUserSrmInit(handle, uuid));
441443
dispatch(action.getUserSrmDone(uuid, handle, tokenV3, pageNum, pageSize, refresh));
442444
},
443-
loadMarathon: (handle, tokenV3, pageNum, pageSize, refresh) => {
445+
loadMarathon: (handle, memberId, tokenV3, pageNum, pageSize, refresh) => {
444446
const uuid = shortId();
445447
dispatch(action.getUserMarathonInit(handle, uuid));
446-
dispatch(action.getUserMarathonDone(uuid, handle, tokenV3, pageNum, pageSize, refresh));
448+
dispatch(action.getUserMarathonDone(
449+
uuid,
450+
handle,
451+
memberId,
452+
tokenV3,
453+
pageNum,
454+
pageSize,
455+
refresh,
456+
));
447457
},
448458
};
449459
}

src/shared/components/ProfilePage/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class ProfilePage extends React.Component {
192192
info={info}
193193
onShowBadges={() => this.setState({ badgesModalOpen: true })}
194194
showBadgesButton={achievements && achievements.length > 0}
195-
wins={_.get(stats, 'wins', 0)}
195+
wins={_.get((stats && stats[0]) || {}, 'wins', 0)}
196196
/>
197197
</div>
198198
</Sticky>

src/shared/components/challenge-listing/Filters/ChallengeFilters.jsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ import PT from 'prop-types';
66
import SwitchWithLabel from 'components/SwitchWithLabel';
77
import { challenge as challengeUtils } from 'topcoder-react-lib';
88
import { COMPETITION_TRACKS as TRACKS } from 'utils/tc';
9-
import _ from 'lodash';
109

11-
import localStorage from 'localStorage';
1210
import ChallengeSearchBar from './ChallengeSearchBar';
1311
import EditTrackPanel from './EditTrackPanel';
1412
import FiltersIcon from './FiltersSwitch/filters-icon.svg';
@@ -54,8 +52,6 @@ export default function ChallengeFilters({
5452
const switchTrack = (track, on) => {
5553
const act = on ? Filter.addTrack : Filter.removeTrack;
5654
const filterObj = act(filterState, track);
57-
const newFilterObj = _.pick(filterObj, 'tracks');
58-
localStorage.setItem('trackStatus', JSON.stringify(newFilterObj));
5955
setFilterState(filterObj);
6056
};
6157

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ export default function FiltersPanel({
349349
setFilterState({});
350350
selectCommunity(defaultCommunityId);
351351
setSearchText('');
352-
localStorage.setItem('trackStatus', JSON.stringify({}));
353352
}}
354353
size="sm"
355354
theme={{ button: style.button }}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import './style.scss';
1515

1616
const Filter = challengeUtils.filter;
1717

18-
const RSS_LINK = 'http://feeds.topcoder.com/challenges/feed?list=active&contestType=all';
18+
// DISABLED: Until feeds.topcoder.com domain fixed community-app#4606
19+
// const RSS_LINK = 'http://feeds.topcoder.com/challenges/feed?list=active&contestType=all';
1920

2021
export default function BucketSelector({
2122
activeBucket,
@@ -109,11 +110,14 @@ export default function BucketSelector({
109110
) : ''
110111
}
111112
<hr />
113+
{/* DISABLED: Until feeds.topcoder.com domain fixed community-app#4606 */}
114+
{/*
112115
<div styleName="get-rss">
113116
<a href={RSS_LINK}>
114117
Get the RSS feed
115118
</a>
116119
</div>
120+
*/}
117121
</div>
118122
);
119123
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,17 @@ function Tip(props) {
9797

9898
const allPhases = c.phases || [];
9999
const endPhaseDate = Math.max(...allPhases.map(d => phaseEndDate(d)));
100-
const registrationPhase = allPhases.find(phase => phase.name === 'Registration');
101-
const submissionPhase = allPhases.find(phase => phase.name === 'Submission');
102-
const checkpointPhase = allPhases.find(phase => phase.name === 'Checkpoint Submission');
100+
const registrationPhase = allPhases.find(phase => phase.name === 'Registration') || {};
101+
const submissionPhase = allPhases.find(phase => phase.name === 'Submission') || {};
102+
const checkpointPhase = allPhases.find(phase => phase.name === 'Checkpoint Submission') || {};
103103

104-
if (registrationPhase) {
104+
if (!_.isEmpty(registrationPhase)) {
105105
steps.push({
106106
date: phaseStartDate(registrationPhase),
107107
name: 'Start',
108108
});
109109
}
110-
if (checkpointPhase) {
110+
if (!_.isEmpty(checkpointPhase)) {
111111
steps.push({
112112
date: phaseEndDate(checkpointPhase),
113113
name: 'Checkpoint',
@@ -119,7 +119,7 @@ function Tip(props) {
119119
date: phaseEndDate(iterativeReviewPhase),
120120
name: 'Iterative Review',
121121
});
122-
} else if (submissionPhase) {
122+
} else if (!_.isEmpty(submissionPhase)) {
123123
steps.push({
124124
date: phaseEndDate(submissionPhase),
125125
name: 'Submission',

src/shared/containers/challenge-listing/FilterPanel.jsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import shortId from 'shortid';
1010
import FilterPanel from 'components/challenge-listing/Filters/ChallengeFilters';
1111
import PT from 'prop-types';
1212
import React from 'react';
13-
import localStorage from 'localStorage';
1413
import sidebarActions from 'actions/challenge-listing/sidebar';
1514
import { BUCKETS, isReviewOpportunitiesBucket } from 'utils/challenge-listing/buckets';
1615
import { bindActionCreators } from 'redux';
@@ -64,12 +63,6 @@ export class Container extends React.Component {
6463
const query = qs.parse(window.location.search.slice(1));
6564
if (query.filter && !filterState.track) {
6665
setFilterState(query.filter);
67-
} else {
68-
const trackStatus = localStorage.getItem('trackStatus');
69-
const filterObj = trackStatus ? JSON.parse(trackStatus) : null;
70-
if (filterObj) {
71-
setFilterState(filterObj);
72-
}
7366
}
7467
}
7568

0 commit comments

Comments
 (0)