Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
fix change label
Francis Cao1d9079f6adea
diff --git a/src/app/(main)/websites/[websiteId]/WebsiteMetricsBar.tsx b/src/app/(main)/websites/[websiteId]/WebsiteMetricsBar.tsxindex 646b20e3d..a6e7ad408 100644--- a/src/app/(main)/websites/[websiteId]/WebsiteMetricsBar.tsx+++ b/src/app/(main)/websites/[websiteId]/WebsiteMetricsBar.tsx@@ -62,7 +62,7 @@ export function WebsiteMetricsBar({change:(Math.min(visits.value, bounces.value) / visits.value) * 100 -(Math.min(visits.prev, bounces.prev) / visits.prev) * 100,- formatValue: n => Number(n).toFixed(0) + '%',+ formatValue: n => Math.round(+n) + '%',reverseColors: true,},{diff --git a/src/components/metrics/ChangeLabel.tsx b/src/components/metrics/ChangeLabel.tsxindex 14eb1a8b8..7e7cb77b5 100644--- a/src/components/metrics/ChangeLabel.tsx+++ b/src/components/metrics/ChangeLabel.tsx@@ -19,21 +19,22 @@ export function ChangeLabel({className?: string;children?: ReactNode;}) {- const positive = value * (reverseColors ? -1 : 1) >= 0;- const negative = value * (reverseColors ? -1 : 1) < 0;+ const positive = value >= 0;+ const negative = value < 0;const neutral = value === 0 || isNaN(value);+ const good = reverseColors ? negative : positive;return (<divclassName={classNames(styles.label, className, {- [styles.positive]: positive,- [styles.negative]: negative,+ [styles.positive]: good,+ [styles.negative]: !good,[styles.neutral]: neutral,})}title={title}>{!neutral && (- <Icon rotate={value === 0 ? 0 : positive || reverseColors ? -90 : 90} size={size}>+ <Icon rotate={positive ? -90 : 90} size={size}><Icons.ArrowRight /></Icon>)}