@@ -4,7 +4,7 @@ import moment from 'moment';
44import _ from 'lodash' ;
55import React from 'react' ;
66import PT from 'prop-types' ;
7- // import { config } from 'topcoder-react-utils';
7+ import { config } from 'topcoder-react-utils' ;
88import { getRatingColor } from 'utils/tc' ;
99// import { RATING_COLORS } from 'utils/tc';
1010import 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