feat: add animated number transitions to dashboard stats

Numbers smoothly count up/down when switching date ranges,
applying filters, or as real-time visitor count changes.
Uses framer-motion useSpring for natural spring physics.
This commit is contained in:
Usman Baig
2026-03-15 21:37:11 +01:00
parent df2b3cadd7
commit c21d7b9073
4 changed files with 40 additions and 3 deletions

View File

@@ -1,3 +1,7 @@
'use client'
import { AnimatedNumber } from '@/components/ui/animated-number'
interface RealtimeVisitorsProps {
count: number
}
@@ -14,7 +18,7 @@ export default function RealtimeVisitors({ count }: RealtimeVisitorsProps) {
<div className="h-2 w-2 bg-green-500 rounded-full animate-pulse"></div>
</div>
<div className="text-3xl font-bold text-neutral-900 dark:text-white">
{count}
<AnimatedNumber value={count} format={(v) => v.toLocaleString()} />
</div>
</div>
)