Skip to content

armgit / umami

Public Imported from GitHub
0

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.

Fixed bug with rankings display.

Mike Caod95e149cf6a5
diff --git a/components/charts/RankingsChart.js b/components/charts/RankingsChart.js
index 89de63a34..be73be97e 100644
--- a/components/charts/RankingsChart.js
+++ b/components/charts/RankingsChart.js
@@ -58,7 +58,7 @@ export default function RankingsChart({
const { x, y, z } = rankings[index];
return (
<div style={style}>
- <AnimatedRow key={x} label={x} value={y} percent={z} animate={limit} />
+ <AnimatedRow key={x} label={x} value={y} percent={z} animate={limit} format={formatFunc} />
</div>
);
};
@@ -108,7 +108,7 @@ export default function RankingsChart({
);
}
-const AnimatedRow = ({ label, value, percent, animate, format }) => {
+const AnimatedRow = ({ label, value = 0, percent, animate, format }) => {
const props = useSpring({
width: percent,
y: value,
@@ -119,7 +119,7 @@ const AnimatedRow = ({ label, value, percent, animate, format }) => {
return (
<div className={styles.row}>
<div className={styles.label}>{label}</div>
- <animated.div className={styles.value}>{props.y.interpolate(format)}</animated.div>
+ <animated.div className={styles.value}>{props.y?.interpolate(format)}</animated.div>
<div className={styles.percent}>
<animated.div
className={styles.bar}
diff --git a/lib/format.js b/lib/format.js
index 5ce72c0c2..b031509ba 100644
--- a/lib/format.js
+++ b/lib/format.js
@@ -44,7 +44,9 @@ export function formatNumber(n) {
return Number(n).toFixed(0);
}
-export function formatLongNumber(n) {
+export function formatLongNumber(value) {
+ const n = Number(value);
+
if (n >= 1000000) {
return `${(n / 1000000).toFixed(1)}m`;
}
@@ -57,5 +59,6 @@ export function formatLongNumber(n) {
if (n >= 1000) {
return `${(n / 1000).toFixed(2)}k`;
}
+
return formatNumber(n);
}
diff --git a/package.json b/package.json
index 4f494e65f..dc2c4b8a6 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "umami",
- "version": "0.10.2",
+ "version": "0.10.3",
"description": "A simple, fast, website analytics alternative to Google Analytics. ",
"author": "Mike Cao <[email protected]>",
"license": "MIT",