From 40cfd9dfa7187877baf12575b90b340b6c0fa722 Mon Sep 17 00:00:00 2001 From: Matt Munger Date: Mon, 9 Jul 2018 12:01:24 -0500 Subject: [PATCH] use maxLevel constant instead of hard coded value --- components/LevelThermometer.js | 4 ++-- components/PointSummaries.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/LevelThermometer.js b/components/LevelThermometer.js index c570a777..6fd26c6d 100644 --- a/components/LevelThermometer.js +++ b/components/LevelThermometer.js @@ -1,7 +1,7 @@ // @flow import * as d3 from 'd3' -import { pointsToLevels, categoryPointsFromMilestoneMap, categoryColorScale, categoryIds } from '../constants' +import { pointsToLevels, categoryPointsFromMilestoneMap, categoryColorScale, categoryIds, maxLevel } from '../constants' import React from 'react' import type { MilestoneMap } from '../constants' @@ -29,7 +29,7 @@ class LevelThermometer extends React.Component { super(props) this.pointScale = d3.scaleLinear() - .domain([0, 135]) + .domain([0, maxLevel]) .rangeRound([0, width - margins.left - margins.right]); this.topAxisFn = d3.axisTop() diff --git a/components/PointSummaries.js b/components/PointSummaries.js index 7eaf9e66..61934b57 100644 --- a/components/PointSummaries.js +++ b/components/PointSummaries.js @@ -1,6 +1,6 @@ // @flow -import { pointsToLevels, milestoneToPoints, trackIds, totalPointsFromMilestoneMap } from '../constants' +import { pointsToLevels, milestoneToPoints, trackIds, totalPointsFromMilestoneMap, maxLevel } from '../constants' import type { MilestoneMap } from '../constants' import React from 'react' @@ -22,7 +22,7 @@ class PointSummaries extends React.Component { let pointsToNextLevel = 1 while (!(nextLevel = pointsToLevels[totalPoints + pointsToNextLevel])) { pointsToNextLevel++ - if (pointsToNextLevel > 135) { + if (pointsToNextLevel > maxLevel) { pointsToNextLevel = 'N/A' break }