diff --git a/assets/js/dashboard/stats/graph/top-stats.js b/assets/js/dashboard/stats/graph/top-stats.js index 4bdd477ed..3cc6c52e6 100644 --- a/assets/js/dashboard/stats/graph/top-stats.js +++ b/assets/js/dashboard/stats/graph/top-stats.js @@ -16,30 +16,14 @@ import { MetricFormatterLong } from '../reports/metric-formatter' -function Maybe({ condition, children }) { - if (condition) { - return children - } else { - return null - } -} - function topStatNumberShort(metric, value) { - if (typeof value == 'number') { - const formatter = MetricFormatterShort[metric] - return formatter(value) - } else { - return null - } + const formatter = MetricFormatterShort[metric] + return formatter(value) } function topStatNumberLong(metric, value) { - if (typeof value == 'number') { - const formatter = MetricFormatterLong[metric] - return formatter(value) - } else { - return null - } + const formatter = MetricFormatterLong[metric] + return formatter(value) } export default function TopStats({ data, onMetricUpdate, tooltipBoundary }) { @@ -163,22 +147,22 @@ export default function TopStats({ data, onMetricUpdate, tooltipBoundary }) { > {topStatNumberShort(stat.graph_metric, stat.value)}
-{formatDateRange(site, data.from, data.to)}
-{topStatNumberShort(stat.graph_metric, stat.comparison_value)} @@ -187,7 +171,7 @@ export default function TopStats({ data, onMetricUpdate, tooltipBoundary }) { {formatDateRange(site, data.comparing_from, data.comparing_to)}