Skip to content

Commit 5415f67

Browse files
committed
Implemented/Fixed review comments, except package.json. Will do that next.
1 parent d82a31a commit 5415f67

File tree

9 files changed

+32
-281
lines changed

9 files changed

+32
-281
lines changed

app/directives/distribution-graph/distribution-graph.directive.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,20 +257,22 @@ import Tooltip from 'appirio-tech-react-components/components/Tooltip/Tooltip.js
257257
.on('mouseout', function(d) {
258258
$scope.displayCoders = false
259259
$scope.highlightedRating = false
260-
$('#chart-tooltip').removeClass('distribution')
261260
$scope.isFocused = false
262261
$scope.$digest()
263262
})
264263

265264
d3.select('body').on('click', function(){
266265
if((d3.event.target.classList[0] != 'tooltip-target') && !$('#chart-tooltip .tooltip-container').hasClass('tooltip-hide') &&
267-
(d3.event.target.classList[0] != 'tooltip-content-container') && (d3.event.target.classList[0] != 'tooltip-container') &&
268-
(d3.event.target.classList[0] != 'tooltip-body') && (d3.event.target.classList[0] != 'Tooltip') &&
266+
!isInArray(d3.event.target.classList[0], ['tooltip-content-container', 'tooltip-container', 'tooltip-body', 'Tooltip']) &&
269267
(d3.event.target.tagName.toLowerCase()!='circle') && !(d3.event.target.tagName.toLowerCase()=='rect' && d3.event.target.classList[0] == 'hover')) {
270-
$('#chart-tooltip .tooltip-container').addClass('tooltip-hide')
271-
$('#chart-tooltip .tooltip-container').css('opacity', 0)
268+
$('#chart-tooltip .tooltip-target').trigger('click')
269+
$('#chart-tooltip').removeClass('distribution')
272270
}
273271
})
272+
273+
function isInArray(value, array) {
274+
return array.indexOf(value) > -1;
275+
}
274276

275277
svg.selectAll('line.xaxis')
276278
.data(ranges)

app/directives/history-graph/history-graph.directive.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ import Tooltip from 'appirio-tech-react-components/components/Tooltip/Tooltip.js
1919
rating: '=',
2020
graphState: '='
2121
},
22-
controller: ['$scope', '$state', 'CONSTANTS', HistoryGraphController]
22+
controller: ['$scope', '$state', '$filter', 'CONSTANTS', HistoryGraphController]
2323
}
2424
}
2525

26-
function HistoryGraphController($scope, $state, CONSTANTS) {
26+
function HistoryGraphController($scope, $state, $filter, CONSTANTS) {
2727
$scope.colors = [
2828
// grey
2929
{
@@ -275,13 +275,11 @@ import Tooltip from 'appirio-tech-react-components/components/Tooltip/Tooltip.js
275275
$scope.historyRating = d.newRating
276276
$scope.historyDate = moment(d.ratingDate).format('YYYY-MM-DD')
277277
$scope.historyChallenge = d.challengeName
278-
$('#chart-tooltip .tooltip-container').on('click', function(){
279-
if($state.params && $state.params.track === 'DEVELOP')
280-
location.href = (CONSTANTS.CHALLENGE_DETAIL_URL + d.challengeId + '/?type=develop')
281-
else if($state.params && $state.params.subTrack === 'SRM')
282-
location.href = (CONSTANTS.SRM_DETAIL_URL + d.challengeId)
283-
else if($state.params && $state.params.subTrack === 'MARATHON_MATCH')
284-
location.href = (CONSTANTS.MARATHON_DETAIL_URL + d.challengeId)
278+
$('#chart-tooltip .tooltip-container').on('click', function(){
279+
if($state.params && ($state.params.subTrack === 'SRM' || $state.params.subTrack === 'MARATHON_MATCH'))
280+
location.href = $filter('challengeLinks')({'rounds': [{id: d.challengeId, forumId: null}], 'track': $state.params.track, 'subTrack': $state.params.subTrack}, 'detail')
281+
else
282+
location.href = $filter('challengeLinks')({id: d.challengeId, 'track': $state.params.track, 'subTrack': $state.params.subTrack}, 'detail')
285283
})
286284
d3.select('#chart-tooltip')
287285
.style('left', (d3.event.pageX-5) + 'px')
@@ -297,21 +295,20 @@ import Tooltip from 'appirio-tech-react-components/components/Tooltip/Tooltip.js
297295
d3.select('#chart-tooltip .challenge-date').text(moment(d.ratingDate).format('MMM DD, YYYY'))
298296
d3.select('#chart-tooltip .tooltip-rating').text($scope.historyRating)
299297
d3.select('#chart-tooltip .tooltip-rating').style('background', ratingToColor($scope.colors, $scope.historyRating))
298+
$('#chart-tooltip').removeClass('distribution')
300299
$scope.$digest()
301300
})
302301
.on('mouseout', function(d) {
303302
$scope.historyRating = undefined
304-
$('#chart-tooltip').off('click')
305303
$scope.$digest()
306304
})
307305

308306
d3.select('body').on('click', function(){
309307
if((d3.event.target.classList[0] != 'tooltip-target') && !$('#chart-tooltip .tooltip-container').hasClass('tooltip-hide') &&
310-
(d3.event.target.classList[0] != 'tooltip-content-container') && (d3.event.target.classList[0] != 'tooltip-container') &&
311-
(d3.event.target.classList[0] != 'tooltip-body') && (d3.event.target.classList[0] != 'Tooltip') &&
312308
(d3.event.target.tagName.toLowerCase()!='circle') && !(d3.event.target.tagName.toLowerCase()=='rect' && d3.event.target.classList[0] == 'hover')) {
313309
$('#chart-tooltip .tooltip-target').trigger('click')
314-
}
310+
$('#chart-tooltip .tooltip-container').off('click')
311+
}
315312
})
316313

317314
}
@@ -322,5 +319,9 @@ import Tooltip from 'appirio-tech-react-components/components/Tooltip/Tooltip.js
322319
})
323320
return colors[0] && colors[0].color || 'black'
324321
}
322+
323+
function isInArray(value, array) {
324+
return array.indexOf(value) > -1;
325+
}
325326
}
326327
})()

app/filters/challengeLinks.filter.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import angular from 'angular'
99
function challengeLinks(CONSTANTS) {
1010
return function(challenge, type) {
1111
var data
12-
if (challenge.subTrack === 'MARATHON_MATCH') {
12+
if (challenge.subTrack === 'MARATHON_MATCH') {
1313
data = {
1414
domain: CONSTANTS.domain,
1515
roundId: challenge.rounds[0].id,
@@ -23,6 +23,15 @@ import angular from 'angular'
2323
case 'detail':
2424
return String.supplant('https://community.{domain}/longcontest/stats/?module=ViewOverview&rd={roundId}', data)
2525
}
26+
} else if (challenge.subTrack === 'SRM') {
27+
data = {
28+
domain: CONSTANTS.domain,
29+
roundId: challenge.rounds[0].id
30+
}
31+
switch (type) {
32+
case 'detail':
33+
return String.supplant('https://community.{domain}/stat?c=round_overview&rd={roundId}', data)
34+
}
2635
} else {
2736
data = {
2837
domain: CONSTANTS.domain,

assets/css/my-dashboard/subtrack-stats.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,12 @@
114114
position: absolute;
115115
z-index: 1000;
116116
cursor: pointer;
117-
font-family: 'Proxima Nova', Helvetica, Arial, sans-serif;
118117
}
119118

120119
#chart-tooltip.distribution {
121120
width: 4px;
122121
height: 4px;
122+
cursor: auto;
123123
}
124124

125125
.tooltip-target {

assets/css/topcoder.scss

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,6 @@
183183
font-weight: 300;
184184
font-style: italic;
185185
}
186-
@font-face {
187-
font-family: 'Proxima Nova';
188-
src: url('../fonts/proximanova/proximanova-regular-webfont.eot');
189-
src: url('../fonts/proximanova/proximanova-regular-webfont.eot?#iefix') format('embedded-opentype'),
190-
url('../fonts/proximanova/proximanova-regular-webfont') format('woff'),
191-
url('../fonts/proximanova/proximanova-regular-webfont.ttf') format('truetype'),
192-
url('../fonts/proximanova/proximanova-regular-webfont.svg') format('svg');
193-
font-weight: 400;
194-
font-style: normal;
195-
}
196186

197187
body {
198188
@include font-with-weight('Merriweather Sans', 400);
Binary file not shown.

0 commit comments

Comments
 (0)