Skip to content

Commit 9a694b1

Browse files
authored
Merge pull request #505 from topcoder-platform/develop
qa community tweaks, filter logic upgrade
2 parents 3351d96 + d1b9806 commit 9a694b1

File tree

22 files changed

+249
-109
lines changed

22 files changed

+249
-109
lines changed

.exchange-rates.cache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"disclaimer":"Usage subject to terms: https://openexchangerates.org/terms","license":"https://openexchangerates.org/license","timestamp":1506589200,"base":"USD","rates":{"AED":3.673097,"AFN":68.606,"ALL":113.74,"AMD":477.825,"ANG":1.779333,"AOA":165.9215,"ARS":17.556,"AUD":1.277596,"AWG":1.794996,"AZN":1.7,"BAM":1.664404,"BBD":2,"BDT":82.368,"BGN":1.66431,"BHD":0.377193,"BIF":1747.6,"BMD":1,"BND":1.359115,"BOB":6.96234,"BRL":3.193001,"BSD":1,"BTC":0.000234408252,"BTN":65.735583,"BWP":10.380039,"BYN":1.960654,"BZD":2.014853,"CAD":1.248048,"CDF":1562.881563,"CHF":0.973886,"CLF":0.0237,"CLP":638.5,"CNH":6.66795,"CNY":6.671014,"COP":2936.05,"CRC":573.445,"CUC":1,"CUP":25.5,"CVE":94,"CZK":22.140263,"DJF":178.77,"DKK":6.3243,"DOP":47.172224,"DZD":113.195,"EGP":17.682997,"ERN":15.323865,"ETB":23.600634,"EUR":0.849878,"FJD":2.037546,"FKP":0.748453,"GBP":0.748453,"GEL":2.4766,"GGP":0.748453,"GHS":4.525803,"GIP":0.748453,"GMD":46.125,"GNF":8954.4,"GTQ":7.320779,"GYD":208.92,"HKD":7.809138,"HNL":23.380424,"HRK":6.375305,"HTG":63.048705,"HUF":264.3815,"IDR":13462.096354,"ILS":3.53394,"IMP":0.748453,"INR":65.615,"IQD":1166.55,"IRR":33482.5,"ISK":106.91,"JEP":0.748453,"JMD":129.802793,"JOD":0.708801,"JPY":112.78455556,"KES":103.35,"KGS":68.430613,"KHR":4050.3,"KMF":419.069527,"KPW":900,"KRW":1147.7925,"KWD":0.302145,"KYD":0.832951,"KZT":340.215,"LAK":8291.1,"LBP":1507.45,"LKR":153.14,"LRD":117.505705,"LSL":13.534319,"LYD":1.3632,"MAD":9.437738,"MDL":17.624343,"MGA":3024.15,"MKD":52.385755,"MMK":1362.9,"MNT":2458.51808,"MOP":8.042813,"MRO":364.855,"MUR":33.832,"MVR":15.400126,"MWK":726.822859,"MXN":18.203515,"MYR":4.230478,"MZN":61.841595,"NAD":13.534569,"NGN":357.355,"NIO":30.332268,"NOK":7.964293,"NPR":105.06,"NZD":1.390221,"OMR":0.384992,"PAB":1,"PEN":3.273541,"PGK":3.201069,"PHP":50.935,"PKR":105.37,"PLN":3.66838,"PYG":5669.15,"QAR":3.6415,"RON":3.906405,"RSD":101.5,"RUB":58.244,"RWF":845.27,"SAR":3.750245,"SBD":7.802738,"SCR":13.596666,"SDG":6.673942,"SEK":8.136983,"SGD":1.361723,"SHP":0.748453,"SLL":7538.795349,"SOS":578.24,"SRD":7.438,"SSP":126.8343,"STD":20836.810788,"SVC":8.746669,"SYP":514.92999,"SZL":13.536834,"THB":33.37,"TJS":8.791467,"TMT":3.499986,"TND":2.466705,"TOP":2.245611,"TRY":3.575301,"TTD":6.78024,"TWD":30.345708,"TZS":2245.3,"UAH":26.461997,"UGX":3603.6,"USD":1,"UYU":28.873646,"UZS":8063.9,"VEF":10.10075,"VND":22730.535743,"VUV":105.58901,"WST":2.515803,"XAF":557.483173,"XAG":0.05970514,"XAU":0.00077997,"XCD":2.70255,"XDR":0.708837,"XOF":557.483173,"XPD":0.00107357,"XPF":101.417377,"XPT":0.00108757,"YER":250.256642,"ZAR":13.598095,"ZMW":9.611001,"ZWL":322.355011}}
1+
{"disclaimer":"Usage subject to terms: https://openexchangerates.org/terms","license":"https://openexchangerates.org/license","timestamp":1506693600,"base":"USD","rates":{"AED":3.672755,"AFN":68.35,"ALL":113.61,"AMD":478.245,"ANG":1.779798,"AOA":165.9215,"ARS":17.5585,"AUD":1.278458,"AWG":1.791501,"AZN":1.68525,"BAM":1.655504,"BBD":2,"BDT":82.299185,"BGN":1.655839,"BHD":0.377255,"BIF":1740.5,"BMD":1,"BND":1.356396,"BOB":6.964035,"BRL":3.170589,"BSD":1,"BTC":0.00023872642,"BTN":65.488982,"BWP":10.297446,"BYN":1.958441,"BZD":2.015442,"CAD":1.247974,"CDF":1565,"CHF":0.971362,"CLF":0.02362,"CLP":638.6,"CNH":6.654458,"CNY":6.652958,"COP":2937.23,"CRC":572.715,"CUC":1,"CUP":25.5,"CVE":93.87,"CZK":22.029565,"DJF":178.97,"DKK":6.309626,"DOP":47.75,"DZD":112.995,"EGP":17.638,"ERN":15.33184,"ETB":23.6,"EUR":0.847764,"FJD":2.024752,"FKP":0.748143,"GBP":0.748143,"GEL":2.474625,"GGP":0.748143,"GHS":4.401,"GIP":0.748143,"GMD":46.1,"GNF":8970,"GTQ":7.333588,"GYD":206.185,"HKD":7.810738,"HNL":23.404941,"HRK":6.3505,"HTG":63.0715,"HUF":263.229308,"IDR":13479.230225,"ILS":3.52909,"IMP":0.748143,"INR":65.39,"IQD":1184,"IRR":33482.5,"ISK":106.318587,"JEP":0.748143,"JMD":130.205609,"JOD":0.709804,"JPY":112.68057895,"KES":103.225,"KGS":68.5815,"KHR":4050.5,"KMF":418,"KPW":900,"KRW":1145.48,"KWD":0.302099,"KYD":0.833136,"KZT":340.3,"LAK":8306,"LBP":1507.95,"LKR":153.09,"LRD":117.6,"LSL":13.465,"LYD":1.365,"MAD":9.41645,"MDL":17.580964,"MGA":3030,"MKD":52.16,"MMK":1364.3,"MNT":2458.991114,"MOP":8.044352,"MRO":364.5,"MUR":33.999862,"MVR":15.409873,"MWK":726.58,"MXN":18.187207,"MYR":4.222618,"MZN":62.008262,"NAD":13.43065,"NGN":355.5,"NIO":30.36,"NOK":7.978525,"NPR":104.512493,"NZD":1.385896,"OMR":0.384963,"PAB":1,"PEN":3.265279,"PGK":3.19409,"PHP":50.907,"PKR":105.4,"PLN":3.647016,"PYG":5654.35,"QAR":3.714996,"RON":3.900912,"RSD":100.99,"RUB":57.735,"RWF":841.5,"SAR":3.7501,"SBD":7.824088,"SCR":13.777,"SDG":6.675,"SEK":8.184583,"SGD":1.358776,"SHP":0.748143,"SLL":7590.311117,"SOS":582,"SRD":7.438,"SSP":126.8534,"STD":20816.206274,"SVC":8.748699,"SYP":514.99499,"SZL":13.465,"THB":33.36,"TJS":8.794015,"TMT":3.499986,"TND":2.4822,"TOP":2.234215,"TRY":3.562525,"TTD":6.752012,"TWD":30.359,"TZS":2245.15,"UAH":26.58404,"UGX":3604.55,"USD":1,"UYU":29.192808,"UZS":8070,"VEF":10.04725,"VND":22724.281859,"VUV":105.493076,"WST":2.514093,"XAF":556.096907,"XAG":0.05974973,"XAU":0.00077938,"XCD":2.70255,"XDR":0.707566,"XOF":556.096907,"XPD":0.00106956,"XPF":101.165187,"XPT":0.00109173,"YER":250.3,"ZAR":13.516181,"ZMW":9.625,"ZWL":322.355011}}

__tests__/shared/actions/stats.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@ const response2 = {
5252

5353
const result = {
5454
communityId: undefined,
55-
stats: {
56-
numChallenges: 0,
57-
numMembers: 0,
58-
openPrizes: '$0',
59-
},
55+
stats: {},
6056
};
6157

6258
describe('stats.getGroupStats fetch all', () => {

__tests__/shared/components/tc-communities/ResourceCard.jsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
import React from 'react';
2-
import PT from 'prop-types';
31
import _ from 'lodash';
4-
import TU from 'react-dom/test-utils';
2+
import mockReduxStore from 'redux-mock-store';
3+
import PT from 'prop-types';
4+
import React from 'react';
55
import ResourceCard from 'components/tc-communities/ResourceCard';
6+
import TU from 'react-dom/test-utils';
7+
import { Provider } from 'react-redux';
8+
9+
const store = mockReduxStore()();
610

711
class Wrapper extends React.Component {
812
getChildContext() {
@@ -19,7 +23,11 @@ class Wrapper extends React.Component {
1923
componentDidMount() {}
2024

2125
render() {
22-
return <ResourceCard {...this.props} />;
26+
return (
27+
<Provider store={store}>
28+
<ResourceCard {...this.props} />
29+
</Provider>
30+
);
2331
}
2432
}
2533

docs/coding-standards.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
<a name="basics-javascript">**JavaScript:**</a> Prefer ES6 features (we use Babel), follow AirBnB JS style. ESLint is installed and configured (`lint:js` npm script; it is also executed as a part of `lint` and `test` scripts). It is a good idea to install ESLint plugin for your IDE, that will highlight any errors when you write the code. If you really need to violate some ESLint rule: (1) double-check with Google that there is no better way to make the same without violation; (2) disable the rule only for those lines where it is violated; (3) comment, why have you decided to violate it.
2424

25+
Everywhere where it makes sense, sort code elements alphabetically (fields in object definition; functions and class methods, when another order is not enforced by ESlint, etc.). This simplifies navigation around the codebase, thus saves some time during development.
26+
2527
<a name="basics-isomorphy">**Isomorphy:**</a> Community App is an isomorphic ReactJS / Redux application. Most of the code should be located inside [`/src/shared`](https://github.com/topcoder-platform/community-app/tree/develop/src/shared) folder, and it should be compatible both with client-size (browser) and server-side (NodeJS) environments. Where necessary, use `isClientSide()` and `isServerSide()` functions from [`utils/isomorphy`](https://github.com/topcoder-platform/community-app/blob/develop/src/shared/utils/isomorphy.js) to check where the code is being executed. Note that some code, like `onClick` handlers, `componentDidMount()` and `componentWillUnmount()` methods of `React.Component`, is automatically executed at the client-side only, thus does not demand additional checks.
2628

2729
<a name="basics-scss">**SCSS:**</a> We use SCSS for styling. Follow the standard Stylelint rules (they are tested by `lint:scss` npm script; and also as a part of `lint` and `test` scripts). It is a good idea to install Stylelint plugin for your IDE. You'll find [more details on styling below](#styling).

src/assets/themes/qa/home/banner.jpg

-234 KB
Binary file not shown.

src/assets/themes/qa/home/header.jpg

264 KB
Loading
Loading
153 KB
Loading
-46.5 KB
Binary file not shown.
-44.3 KB
Binary file not shown.

src/server/tc-communities/qa/metadata.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"challengeFilter": {
3-
"groupIds": ["20000004", "20000000"]
3+
"groupIds": ["20000012","20000004"],
4+
"or": [{
5+
"tags": ["QA"]
6+
}]
47
},
58
"communityId": "qa",
69
"communityName": "QaaS",
@@ -12,7 +15,7 @@
1215
"redirect": "https://www.topcoder.com",
1316
"value": "2"
1417
}],
15-
"groupIds": ["20000004"],
18+
"groupIds": ["20000012","20000004"],
1619
"logos": [{
1720
"img": "/themes/qa/logo_topcoder_with_name.svg",
1821
"url": "https://www.topcoder.com"
@@ -27,9 +30,6 @@
2730
}, {
2831
"title": "Challenges",
2932
"url": "challenges"
30-
}, {
31-
"title": "Leaderboard",
32-
"url": "leaderboard"
3333
}
3434
],
3535
"leaderboardApiUrl": "https://api.topcoder.com/v4/looks/458/run/json/",

src/shared/actions/stats.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,21 @@ function getCommunityStats(community, challenges, token) {
2727
const groupService = getGroupService(token);
2828
const result = {
2929
communityId: community.communityId,
30-
stats: {
31-
numChallenges: filtered.length,
32-
numMembers: 0,
33-
openPrizes: `$${totalPrize.toLocaleString()}`,
34-
},
30+
stats: {},
3531
};
32+
if (filtered.length) result.stats.numChallenges = filtered.length;
33+
if (totalPrize) result.stats.openPrizes = `$${totalPrize.toLocaleString()}`;
3634
if (community.groupIds && community.groupIds.length) {
3735
const members = new Set();
3836
return Promise.all(
3937
community.groupIds.map(id =>
4038
groupService.getMembers(id)
4139
.then(res => res.forEach((member) => {
4240
if (member.membershipType === 'user') members.add(member);
43-
})).catch(),
41+
})).catch(() => null),
4442
),
4543
).then(() => {
46-
result.stats.numMembers = members.size;
44+
if (members.size) result.stats.numMembers = members.size;
4745
return result;
4846
});
4947
}

src/shared/components/challenge-detail/Specification/SideBar/index.jsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ import styles from './styles.scss';
1414
export default function SideBar({
1515
documents,
1616
eventDetail,
17-
screeningScorecardId,
1817
reviewScorecardId,
18+
screeningScorecardId,
19+
shareable,
1920
forumLink,
2021
submissionLimit,
2122
hasRegistered,
@@ -213,8 +214,12 @@ export default function SideBar({
213214
</ul>
214215
</div>
215216
}
216-
<h3>SHARE:</h3>
217-
<ShareSocial />
217+
{ shareable && (
218+
<span>
219+
<h3>SHARE:</h3>
220+
<ShareSocial />
221+
</span>
222+
)}
218223
</div>
219224
</div>
220225
);
@@ -240,6 +245,7 @@ SideBar.propTypes = {
240245
}),
241246
documents: PT.arrayOf(PT.shape()),
242247
screeningScorecardId: PT.number,
248+
shareable: PT.bool.isRequired,
243249
reviewScorecardId: PT.number,
244250
forumLink: PT.string.isRequired,
245251
submissionLimit: PT.number,

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default function ChallengeDetailsView(props) {
1616
hasRegistered,
1717
openTermsModal,
1818
challenge: {
19+
groupIds,
1920
introduction,
2021
detailedRequirements,
2122
track,
@@ -236,12 +237,17 @@ export default function ChallengeDetailsView(props) {
236237
<article>
237238
<h2>Payments</h2>
238239
<p>
239-
Topcoder will compensate members in accordance with the payment
240-
structure of this challenge. Initial payment for the winning
241-
member will be distributed in two installments. The first payment
242-
will be made at the closure of the approval phase. The second
243-
payment will be made at the completion of the
244-
support period.
240+
Topcoder will compensate members in accordance with the our
241+
standard payment policies, unless otherwise specified in this
242+
challenge. For information on payment policies, setting up your
243+
profile to receive payments, and general payment questions,
244+
please refer to
245+
&zwnj;<a
246+
href="https://help.topcoder.com/hc/en-us/articles/217482038-Payment-Policies-and-Instructions"
247+
rel="noopener noreferrer"
248+
target="_blank"
249+
>https://help.topcoder.com/hc/en-us/articles/217482038-Payment-Policies-and-Instructions
250+
</a>.
245251
</p>
246252
</article>
247253
<article>
@@ -274,6 +280,7 @@ export default function ChallengeDetailsView(props) {
274280
isDesign={track.toLowerCase() === 'design'}
275281
terms={terms}
276282
openTermsModal={openTermsModal}
283+
shareable={!groupIds}
277284
/>
278285
</div>
279286
);
@@ -308,6 +315,7 @@ ChallengeDetailsView.propTypes = {
308315
introduction: PT.string,
309316
detailedRequirements: PT.string,
310317
track: PT.string.isRequired,
318+
groupIds: PT.arrayOf(PT.string),
311319
screeningScorecardId: PT.number,
312320
reviewScorecardId: PT.number,
313321
forumLink: PT.string,

src/shared/components/tc-communities/Banner/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '~styles/tc-styles';
1+
@import '~styles/mixins';
22

33
.container {
44
align-items: center;

src/shared/components/tc-communities/ResourceCard/index.jsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,43 @@
55
import React from 'react';
66
import PT from 'prop-types';
77
import { themr } from 'react-css-super-themr';
8-
import { Link } from 'react-router-dom';
8+
import { Link } from 'utils/router';
99
import defaultStyle from './style.scss';
1010

1111
function ResourceCard(props) {
1212
const { icon: Icon, title, text, link, theme } = props;
1313

1414
return (
1515
<div className={theme.container}>
16-
<Icon className={theme.icon} />
16+
{Boolean(Icon) && <Icon className={theme.icon} />}
1717
<h3 className={theme.title}>{title}</h3>
1818
<p className={theme.text}>{text}</p>
1919
{link &&
2020
<div className={theme.linkWrap}>
21-
<Link className={theme.link} to={link.url}>{link.title}</Link>
21+
<Link
22+
className={theme.link}
23+
openNewTab={link.openNewTab}
24+
to={link.url}
25+
>{link.title}</Link>
2226
</div>
2327
}
2428
</div>
2529
);
2630
}
2731

2832
ResourceCard.defaultProps = {
33+
icon: null,
2934
link: null,
3035
text: '',
3136
theme: {},
3237
};
3338

3439
ResourceCard.propTypes = {
35-
icon: PT.func.isRequired,
40+
icon: PT.func,
3641
title: PT.string.isRequired,
3742
text: PT.string,
3843
link: PT.shape({
44+
openNewTab: PT.bool,
3945
title: PT.string.isRequired,
4046
url: PT.string.isRequired,
4147
}),

0 commit comments

Comments
 (0)