diff --git a/assets/js/dashboard/stats/graph/top-stats.js b/assets/js/dashboard/stats/graph/top-stats.js index 686517dc6..d93fb0b1a 100644 --- a/assets/js/dashboard/stats/graph/top-stats.js +++ b/assets/js/dashboard/stats/graph/top-stats.js @@ -6,6 +6,14 @@ import numberFormatter, { durationFormatter } from '../../util/number-formatter' import { METRIC_MAPPING } from './graph-util' import { parseUTCDate, formatDayShort } from '../../util/date.js' +function Maybe({condition, children}) { + if (condition) { + return children + } else { + return null + } +} + export default class TopStats extends React.Component { renderPercentageComparison(name, comparison, forceDarkMode = false) { const formattedComparison = numberFormatter(Math.abs(comparison)) @@ -145,15 +153,21 @@ export default class TopStats extends React.Component {
{this.topStatNumberShort(stat.name, stat.value)}
- { !query.comparison && this.renderPercentageComparison(stat.name, stat.change) } +{ formatRange(topStatData.from, topStatData.to) }
} +{ formatRange(topStatData.from, topStatData.to) }
+{ this.topStatNumberShort(stat.name, stat.comparison_value) }
-{ formatRange(topStatData.comparing_from, topStatData.comparing_to) }
-{ this.topStatNumberShort(stat.name, stat.comparison_value) }
+{ formatRange(topStatData.comparing_from, topStatData.comparing_to) }
+