From ca60379e5e131b801c0d3e49c30976a8283bba98 Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Wed, 11 Mar 2026 22:36:55 +0100 Subject: [PATCH] feat: replace radar with clean bar chart for scroll depth --- components/dashboard/ScrollDepth.tsx | 83 ++++++++++++++-------------- 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/components/dashboard/ScrollDepth.tsx b/components/dashboard/ScrollDepth.tsx index fa53586..531bc3d 100644 --- a/components/dashboard/ScrollDepth.tsx +++ b/components/dashboard/ScrollDepth.tsx @@ -1,6 +1,6 @@ 'use client' -import { PolarAngleAxis, PolarGrid, Radar, RadarChart, Tooltip } from 'recharts' +import { Bar, BarChart, CartesianGrid, LabelList, XAxis, ResponsiveContainer, Tooltip } from 'recharts' import { BarChartIcon } from '@ciphera-net/ui' import type { GoalCountStat } from '@/lib/api/stats' @@ -22,54 +22,57 @@ export default function ScrollDepth({ goalCounts, totalPageviews }: ScrollDepthP const hasData = scrollCounts.size > 0 && totalPageviews > 0 - const chartData = [ - { label: '0%', value: 100 }, - ...THRESHOLDS.map((threshold) => ({ - label: `${threshold}%`, - value: totalPageviews > 0 ? Math.round(((scrollCounts.get(threshold) ?? 0) / totalPageviews) * 100) : 0, - })), - ] + const chartData = THRESHOLDS.map((threshold) => ({ + label: `${threshold}%`, + value: totalPageviews > 0 ? Math.round(((scrollCounts.get(threshold) ?? 0) / totalPageviews) * 100) : 0, + })) return (
-
+

Scroll Depth

+

+ % of visitors who scrolled this far +

{hasData ? ( -
- - - - [`${value}%`, 'Reached']} - /> - - +
+ + + + + [`${value}%`, 'Reached']} + /> + + `${v}%`} + /> + + +
) : (