Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const dateFormat = require('dateformat');
const cloneDeep = require('lodash.clonedeep');
const React = require('react');
const ReactDOMServer = require('react-dom/server');
const V = require('victory');
const e = React.createElement;
const Theme = cloneDeep(V.VictoryTheme.grayscale);
Theme.axis.style.tickLabels.fontFamily = `'PT Sans', 'sans-serif'`;
Theme.axis.style.ticks.stroke = Theme.axis.style.axis.stroke;
Theme.axis.style.ticks.size = 5;
Theme.line.style.labels.fontFamily = `'PT Sans', 'sans-serif'`;
function render (alert) {
const data = cloneDeep(alert.priceHistory);
// hack to show graph if there is only one data point
if (data.length === 1) {
data.push(cloneDeep(data[0]));
data[1].time = data[0].time + 1;
}
const times = data.map(d => d.time);
const minTime = Math.min(...times);
key: "",
y: distanceKm - element.starting_value,
label: `Current: ${(
distanceKm - element.starting_value
).toLocaleString()} kms`
},
{
key: "",
y: endVal - (distanceKm - element.starting_value),
label: `Remaining: ${(
endVal -
(distanceKm - element.starting_value)
).toLocaleString()} kms`
}
]}
theme={V.VictoryTheme.material}
colorScale={["#2d728f", "#EEEEEE"]}
innerRadius={70}
labelRadius={80}
padAngle={0}
/>
<p>
{" "}
You have {moment(element.end_date).fromNow(true)} left to
accomplish this goal!{" "}
</p>
);
else if (
element.goal_type === "distance" &&
element.goal_value <= distanceKm