Skip to content

Commit 22c1b8d

Browse files
committed
fix: challenge link on tooltip
1 parent 1a66098 commit 22c1b8d

File tree

1 file changed

+17
-21
lines changed
  • src/shared/components/ProfilePage/Stats/HistoryGraph

1 file changed

+17
-21
lines changed

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

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import moment from 'moment';
44
import _ from 'lodash';
55
import React from 'react';
66
import PT from 'prop-types';
7-
// import { config } from 'topcoder-react-utils';
7+
import { config } from 'topcoder-react-utils';
88
import { getRatingColor } from 'utils/tc';
99
// import { RATING_COLORS } from 'utils/tc';
1010
import ChartTooltip from '../ChartTooltip';
@@ -63,7 +63,7 @@ export default class HistoryGraph extends React.Component {
6363

6464
draw() {
6565
const $scope = this;
66-
const { history: wrapper, subTrack } = this.props;
66+
const { history: wrapper, track, subTrack } = this.props;
6767

6868
if (!wrapper) {
6969
return;
@@ -216,20 +216,20 @@ export default class HistoryGraph extends React.Component {
216216
}
217217
*/
218218

219-
// function getChallengeLink(challengeId) {
220-
// if (track === 'DEVELOP') {
221-
// return `/challenges/${challengeId}`;
222-
// }
223-
// if (track === 'DATA_SCIENCE') {
224-
// if (subTrack === 'MARATHON_MATCH') {
225-
// return `${config.URL.CHALLENGES_URL}/${challengeId}`;
226-
// }
227-
// if (subTrack === 'SRM') {
228-
// return `${config.URL.COMMUNITY}/stat?c=round_overview&rd=${challengeId}`;
229-
// }
230-
// }
231-
// return null;
232-
// }
219+
function getChallengeLink(challengeId) {
220+
if (track === 'DEVELOP') {
221+
return `/challenges/${challengeId}`;
222+
}
223+
if (track === 'DATA_SCIENCE') {
224+
if (subTrack === 'MARATHON_MATCH') {
225+
return `${config.URL.CHALLENGES_URL}/${challengeId}`;
226+
}
227+
if (subTrack === 'SRM') {
228+
return `${config.URL.COMMUNITY}/stat?c=round_overview&rd=${challengeId}`;
229+
}
230+
}
231+
return null;
232+
}
233233

234234
/*
235235
svg.append('g')
@@ -311,17 +311,13 @@ export default class HistoryGraph extends React.Component {
311311
challengeData: moment(d.ratingDate).format('MMM DD, YYYY'),
312312
rating: d.newRating,
313313
ratingColor: getRatingColor(d.newRating),
314+
href: getChallengeLink(d.challengeId),
314315
});
315316

316317
updateTooltipPosition();
317318
})
318319
.on('mousemove', () => {
319320
updateTooltipPosition();
320-
})
321-
.on('mouseout', () => {
322-
$scope.setState({
323-
show: false,
324-
});
325321
});
326322
}
327323

0 commit comments

Comments
 (0)