Skip to content

Commit dc6a383

Browse files
authored
Merge pull request #4063 from topcoder-platform/develop
PR for private stats feature
2 parents 76b70d0 + 91b32b9 commit dc6a383

File tree

46 files changed

+528
-54
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+528
-54
lines changed

.circleci/config.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,14 @@ workflows:
174174
filters:
175175
branches:
176176
only:
177+
- feature-m2m-with-stats
177178
- develop
178-
- feature-m2m-token
179179
# This is alternate dev env for parallel testing
180180
- "build-test":
181181
context : org-global
182182
filters:
183183
branches:
184184
only:
185-
- develop
186185
- nav-hot-fix
187186
- hot-fixes-leaderboard
188187
# This is beta env for production soft releases
@@ -191,8 +190,7 @@ workflows:
191190
filters:
192191
branches:
193192
only:
194-
- develop
195-
- feature-contentful
193+
- develop
196194
# Production builds are exectuted only on tagged commits to the
197195
# master branch.
198196
- "build-prod":

CONTRIBUTING.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,9 @@ Optional. The footer should contain any information about **Breaking Changes** a
6868
reference GitHub issues that this commit **Closes**.
6969

7070
**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines.
71-
The rest of the commit message is then used for this.
71+
The rest of the commit message is then used for this.
72+
73+
### Generate Change long
74+
```
75+
npm run release:changelog
76+
```

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ exports[`renders a full Profile correctly 1`] = `
199199
className=""
200200
handle="testHandle"
201201
inModal={false}
202+
meta={null}
202203
stats={
203204
Object {
204205
"COPILOT": Object {
@@ -699,6 +700,7 @@ exports[`renders an empty Profile correctly 1`] = `
699700
className=""
700701
handle="testHandle"
701702
inModal={false}
703+
meta={null}
702704
stats={
703705
Object {
704706
"COPILOT": null,

docs/deployment-env.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,4 @@ workflows:
4848
- develop
4949
```
5050
4. Commit the changes
51+
5. Status of the deployment environments can be checked here https://cci-reporter.herokuapp.com/

src/shared/components/ProfilePage/Skill/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const Skill = ({
3737
Skill.propTypes = {
3838
tagId: PT.string.isRequired,
3939
tagName: PT.string.isRequired,
40-
isVerified: PT.string.isRequired,
40+
isVerified: PT.bool.isRequired,
4141
};
4242

4343
export default Skill;

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
import _ from 'lodash';
66
import React from 'react';
77
import PT from 'prop-types';
8-
import { Link } from 'react-router-dom';
98
import ReactSVG from 'react-svg';
10-
import { isomorphy } from 'topcoder-react-utils';
9+
import { Link, isomorphy } from 'topcoder-react-utils';
1110
import { getRatingColor } from 'utils/tc';
1211
import Th from 'assets/images/th.svg';
1312
import LeftArrow from 'assets/images/arrow-prev.svg';
@@ -50,7 +49,6 @@ class ProfileStats extends React.Component {
5049

5150
render() {
5251
const {
53-
stats,
5452
statsDistribution,
5553
statsHistory,
5654
track,
@@ -60,6 +58,11 @@ class ProfileStats extends React.Component {
6058
handleParam,
6159
activeChallengesCount,
6260
} = this.props;
61+
let { stats } = this.props;
62+
if (_.isArray(stats)) {
63+
// eslint-disable-next-line prefer-destructuring
64+
stats = stats[0];
65+
}
6366

6467
const { activeGraph, showModal } = this.state;
6568

@@ -300,7 +303,7 @@ ProfileStats.defaultProps = {
300303
};
301304

302305
ProfileStats.propTypes = {
303-
stats: PT.shape().isRequired,
306+
stats: PT.arrayOf(PT.shape()).isRequired,
304307
handleParam: PT.string.isRequired,
305308
track: PT.string.isRequired,
306309
subTrack: PT.string.isRequired,

src/shared/components/ProfilePage/StatsCategory/index.jsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ const isActiveSubtrack = (subtrack) => {
4343

4444
class StatsCategory extends React.Component {
4545
getActiveTracks() {
46-
const { stats } = this.props;
46+
let { stats } = this.props;
47+
if (_.isArray(stats)) {
48+
// eslint-disable-next-line prefer-destructuring
49+
stats = stats[0];
50+
}
4751
const activeTracks = [];
4852

4953
if (stats.COPILOT && stats.COPILOT.fulfillment) {
@@ -89,6 +93,7 @@ class StatsCategory extends React.Component {
8993
handle,
9094
className,
9195
inModal,
96+
meta,
9297
} = this.props;
9398

9499
const activeTracks = this.getActiveTracks();
@@ -113,7 +118,7 @@ class StatsCategory extends React.Component {
113118
<Link
114119
to={`/members/${handle}/details/?track=${track.name}&subTrack=${subtrack.name.replace(' ', '_')}`}
115120
key={subtrack.name}
116-
styleName={`subtrack ${index === 0 ? 'first' : ''}`}
121+
styleName={`subtrack ${index === 0 ? 'first' : ''} ${meta ? 'disablelink' : ''}`}
117122
>
118123
<div
119124
styleName="name"
@@ -179,13 +184,15 @@ class StatsCategory extends React.Component {
179184
StatsCategory.defaultProps = {
180185
className: '',
181186
inModal: false,
187+
meta: null,
182188
};
183189

184190
StatsCategory.propTypes = {
185191
handle: PT.string.isRequired,
186-
stats: PT.shape().isRequired,
192+
stats: PT.arrayOf(PT.shape()).isRequired,
187193
inModal: PT.bool,
188194
className: PT.string,
195+
meta: PT.shape(),
189196
};
190197

191198
export default StatsCategory;

src/shared/components/ProfilePage/StatsCategory/styles.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@
147147
}
148148
}
149149

150+
.disablelink {
151+
pointer-events: none;
152+
}
153+
150154
.icon {
151155
width: 80px;
152156
height: 80px;

src/shared/components/ProfilePage/index.jsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ class ProfilePage extends React.Component {
6363
}
6464

6565
getActiveTracks() {
66-
const { copilot, stats } = this.props;
66+
const { copilot } = this.props;
67+
let { stats } = this.props;
68+
if (_.isArray(stats)) {
69+
// eslint-disable-next-line prefer-destructuring
70+
stats = stats[0];
71+
}
6772
const activeTracks = [];
6873

6974
if (copilot && stats && stats.COPILOT && stats.COPILOT.fulfillment) {
@@ -118,6 +123,7 @@ class ProfilePage extends React.Component {
118123
skills: propSkills,
119124
stats,
120125
lookupData,
126+
meta,
121127
} = this.props;
122128

123129
const {
@@ -257,7 +263,7 @@ class ProfilePage extends React.Component {
257263
{
258264
stats && (
259265
<div id="profile-activity">
260-
<StatsCategory handle={info.handle} stats={stats} />
266+
<StatsCategory handle={info.handle} stats={stats} meta={meta} />
261267
</div>
262268
)
263269
}
@@ -297,6 +303,7 @@ ProfilePage.defaultProps = {
297303
achievements: [],
298304
skills: null,
299305
stats: null,
306+
meta: null,
300307
};
301308

302309
ProfilePage.propTypes = {
@@ -306,8 +313,9 @@ ProfilePage.propTypes = {
306313
externalLinks: PT.arrayOf(PT.shape()),
307314
info: PT.shape().isRequired,
308315
skills: PT.shape(),
309-
stats: PT.shape(),
316+
stats: PT.arrayOf(PT.shape()),
310317
lookupData: PT.shape().isRequired,
318+
meta: PT.shape(),
311319
};
312320

313321
export default ProfilePage;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function Header(props) {
6666
items: [{
6767
enforceA: true,
6868
icon: <IconNavProfile />,
69-
link: `${BASE_URL}/members/${normalizedProfile.handle}`,
69+
link: `${meta ? _.replace(BASE_URL, 'www', meta.subdomains[0]) : BASE_URL}/members/${normalizedProfile.handle}`,
7070
title: 'My Profile',
7171
}, {
7272
openNewTab: true,

src/shared/containers/Profile.jsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
22
* Connects the Redux store to the Profile display components.
33
*/
4+
import _ from 'lodash';
45
import React from 'react';
56
import PT from 'prop-types';
67
import { connect } from 'react-redux';
@@ -15,20 +16,22 @@ class ProfileContainer extends React.Component {
1516
const {
1617
handleParam,
1718
loadProfile,
19+
meta,
1820
} = this.props;
1921

20-
loadProfile(handleParam);
22+
loadProfile(handleParam, _.join(_.get(meta, 'groupIds', [])));
2123
}
2224

2325
componentWillReceiveProps(nextProps) {
2426
const {
2527
handleParam,
2628
profileForHandle,
2729
loadProfile,
30+
meta,
2831
} = nextProps;
2932

3033
if (handleParam !== profileForHandle) {
31-
loadProfile(handleParam);
34+
loadProfile(handleParam, _.join(_.get(meta, 'groupIds', [])));
3235
}
3336
}
3437

@@ -75,6 +78,7 @@ ProfileContainer.defaultProps = {
7578
profileForHandle: '',
7679
skills: null,
7780
stats: null,
81+
meta: null,
7882
};
7983

8084
ProfileContainer.propTypes = {
@@ -89,8 +93,9 @@ ProfileContainer.propTypes = {
8993
loadProfile: PT.func.isRequired,
9094
profileForHandle: PT.string,
9195
skills: PT.shape(),
92-
stats: PT.shape(),
96+
stats: PT.arrayOf(PT.shape()),
9397
lookupData: PT.shape().isRequired,
98+
meta: PT.shape(),
9499
};
95100

96101
const mapStateToProps = (state, ownProps) => ({
@@ -100,6 +105,7 @@ const mapStateToProps = (state, ownProps) => ({
100105
externalAccounts: state.profile.externalAccounts,
101106
externalLinks: state.profile.externalLinks,
102107
handleParam: ownProps.match.params.handle,
108+
meta: ownProps.meta,
103109
info: state.profile.info,
104110
loadingError: state.profile.loadingError,
105111
profileForHandle: state.profile.profileForHandle,
@@ -112,7 +118,7 @@ function mapDispatchToProps(dispatch) {
112118
const a = actions.profile;
113119
const lookupActions = actions.lookup;
114120
return {
115-
loadProfile: (handle) => {
121+
loadProfile: (handle, groupIds) => {
116122
dispatch(a.clearProfile());
117123
dispatch(a.loadProfile(handle));
118124
dispatch(a.getAchievementsInit());
@@ -127,7 +133,7 @@ function mapDispatchToProps(dispatch) {
127133
dispatch(a.getExternalLinksDone(handle));
128134
dispatch(a.getInfoDone(handle));
129135
dispatch(a.getSkillsDone(handle));
130-
dispatch(a.getStatsDone(handle));
136+
dispatch(a.getStatsDone(handle, groupIds));
131137
dispatch(lookupActions.getCountriesDone());
132138
},
133139
};

0 commit comments

Comments
 (0)