diff options
author | Dan Miller <danjm.com@gmail.com> | 2018-10-24 06:36:36 +0800 |
---|---|---|
committer | Dan Miller <danjm.com@gmail.com> | 2018-12-04 11:36:05 +0800 |
commit | d0619b024fb092182e77e16c6742e157c89b2dc9 (patch) | |
tree | 9820359348b8ded2ab2e122dcf5772830858dd05 /ui/app/components/gas-customization/gas-price-chart/gas-price-chart.component.js | |
parent | 6f0406125d9d656a4a9826b616f28ffda894ec8e (diff) | |
download | tangerine-wallet-browser-d0619b024fb092182e77e16c6742e157c89b2dc9.tar.gz tangerine-wallet-browser-d0619b024fb092182e77e16c6742e157c89b2dc9.tar.zst tangerine-wallet-browser-d0619b024fb092182e77e16c6742e157c89b2dc9.zip |
Update tests, plus some lint fixes, for gas-price-chart
Diffstat (limited to 'ui/app/components/gas-customization/gas-price-chart/gas-price-chart.component.js')
-rw-r--r-- | ui/app/components/gas-customization/gas-price-chart/gas-price-chart.component.js | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/ui/app/components/gas-customization/gas-price-chart/gas-price-chart.component.js b/ui/app/components/gas-customization/gas-price-chart/gas-price-chart.component.js index 69f8b3a91..993dd0a2b 100644 --- a/ui/app/components/gas-customization/gas-price-chart/gas-price-chart.component.js +++ b/ui/app/components/gas-customization/gas-price-chart/gas-price-chart.component.js @@ -1,18 +1,13 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' import * as d3 from 'd3' -import c3 from 'c3' import { - appendOrUpdateCircle, generateChart, - generateDataUIObj, - getAdjacentGasPrices, getCoordinateData, - getNewXandTimeEstimate, handleChartUpdate, hideDataUI, - setSelectedCircle, setTickPosition, + handleMouseMove, } from './gas-price-chart.utils.js' export default class GasPriceChart extends Component { @@ -37,7 +32,7 @@ export default class GasPriceChart extends Component { estimatedTimesMax, updateCustomGasPrice, }) { - const chart = generateChart(gasPrices, estimatedTimes, gasPricesMax, estimatedTimesMax) + const chart = generateChart(gasPrices, estimatedTimes, gasPricesMax, estimatedTimesMax) setTimeout(function () { setTickPosition('y', 0, -5, 8) @@ -61,7 +56,7 @@ export default class GasPriceChart extends Component { const { x: chartXStart, width: chartWidth } = getCoordinateData('.c3-areas-data1') - handleChartUpdate ({ + handleChartUpdate({ chart, gasPrices, newPrice: currentPrice, @@ -69,24 +64,14 @@ export default class GasPriceChart extends Component { }) d3.select('.c3-chart').on('mousemove', function () { - const { currentPosValue, newTimeEstimate } = getNewXandTimeEstimate({ + handleMouseMove({ xMousePos: d3.event.clientX, chartXStart, chartWidth, gasPrices, estimatedTimes, + chart, }) - - if (currentPosValue === null && newTimeEstimate === null) { - hideDataUI(chart, '#overlayed-circle') - } - - const indexOfNewCircle = estimatedTimes.length + 1 - const dataUIObj = generateDataUIObj(currentPosValue, indexOfNewCircle, newTimeEstimate) - - chart.internal.overlayPoint(dataUIObj, indexOfNewCircle) - chart.internal.showTooltip([dataUIObj], d3.select('.c3-areas-data1')._groups[0]) - chart.internal.showXGridFocus([dataUIObj]) }) }, 0) @@ -97,7 +82,7 @@ export default class GasPriceChart extends Component { const { gasPrices, currentPrice: newPrice } = this.props if (prevProps.currentPrice !== newPrice) { - handleChartUpdate ({ + handleChartUpdate({ chart: this.chart, gasPrices, newPrice, |