Skip to content

Commit f45bea2

Browse files
authored
Merge pull request #3489 from topcoder-platform/issue_3465
Issue #3465
2 parents e3f3761 + 0e17201 commit f45bea2

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

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

+30
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import PT from 'prop-types';
88
import { Link } from 'react-router-dom';
99
import { getRatingColor } from 'utils/tc';
1010
import Th from 'assets/images/th.svg';
11+
import DefaultPortrait from 'assets/images/ico-user-default.svg';
12+
import LeftArrow from 'assets/images/arrow-prev.svg';
1113
import {
1214
shouldShowGraph, getHistory, getSubTrackStats, getSummary, getDetails,
1315
} from 'utils/memberStats';
@@ -64,6 +66,11 @@ class ProfileStats extends React.Component {
6466
const subTrackStats = getSubTrackStats(stats, track, subTrack);
6567
const subTrackSummary = getSummary(stats, track, subTrack) || [];
6668
const subTrackDetails = getDetails(stats, track, subTrack) || [];
69+
const ratingObj = subTrackSummary.filter(k => k.label === 'rating');
70+
let subTrackRating = ratingObj && ratingObj[0] ? ratingObj[0].value : 0;
71+
if (subTrackRating === 0 || !subTrackRating) { // if subtrack has no rating, pick default rating
72+
subTrackRating = info.maxRating ? info.maxRating.rating : 0;
73+
}
6774

6875
if (track === 'DEVELOP') {
6976
const reliability = subTrackSummary.find(stat => stat.label === 'reliability');
@@ -85,6 +92,10 @@ class ProfileStats extends React.Component {
8592
<div styleName="page-state-header">
8693
<header>
8794
<div styleName="page-info">
95+
<Link to={`/members/${handleParam}`}>
96+
<LeftArrow styleName="left-arrow" />
97+
</Link>
98+
&nbsp;
8899
<h1>
89100
{subTrack.replace('FIRST_2_FINISH', 'FIRST2FINISH').replace(/_/g, ' ')}
90101
</h1>
@@ -128,6 +139,25 @@ Active Challenges
128139
}
129140
</ul>
130141
<ul styleName="subtrack-stats">
142+
{
143+
subTrackSummary
144+
&& (
145+
<li key={info.handle}>
146+
<div>
147+
{ info.photoURL ? <img src={info.photoURL} onError={this.loadImageError} styleName="profile-circle" alt="Member Portait" /> : <DefaultPortrait styleName="profile-circle" /> }
148+
</div>
149+
<div
150+
styleName="valueHandle"
151+
className={subTrackRating ? styles.rating : ''}
152+
style={{ color: subTrackRating ? getRatingColor(parseInt(subTrackRating.toString().replace(/\D/g, ''), 10)) : undefined }}
153+
>
154+
<Link to={`/members/${info.handle}`}>
155+
{info.handle || '-'}
156+
</Link>
157+
</div>
158+
</li>
159+
)
160+
}
131161
{
132162
subTrackSummary.map(({ label, value, link }) => (
133163
<li key={label}>

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

+18
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@
177177
.page-info {
178178
display: flex;
179179
justify-content: center;
180+
181+
.left-arrow {
182+
margin: 15px;
183+
}
180184
}
181185
}
182186

@@ -196,6 +200,13 @@
196200
}
197201
}
198202

203+
img.profile-circle {
204+
border-radius: 50%;
205+
display: inline;
206+
width: 140px;
207+
height: 140px;
208+
}
209+
199210
& + .develop {
200211
// move the cards up to compensate for size. Refactor of the component will make this obsolete!
201212
margin-top: -40px;
@@ -230,6 +241,13 @@
230241
}
231242
}
232243

244+
.valueHandle {
245+
position: relative;
246+
margin-bottom: 7px;
247+
font-size: 18px;
248+
color: #3d3d3d;
249+
}
250+
233251
&:not(:first-child)::before {
234252
content: "";
235253
top: 32px;

0 commit comments

Comments
 (0)