import { companyStats } from '~/data/company-stats'
import { motion } from 'framer-motion'
import { FC, useEffect, useMemo, useState } from 'react'
import { useMedia } from 'react-use'
import { AnimatedCounter, Badge, cn } from 'ui'
const UsersGrowthChart: FC = () => {
return (
)
}
const GraphLabel: FC<{ className?: string }> = ({ className }) => {
const isMobileOrTablet = useMedia('(max-width: 1280px)')
const [isClient, setIsClient] = useState(false)
useEffect(() => {
setIsClient(true)
}, [])
// Use client-side flag to prevent hydration mismatch
const shouldShowAnimated = useMemo(() => {
// Always show animated version until client-side hydration is complete
if (!isClient) return true
return !isMobileOrTablet
}, [isClient, isMobileOrTablet])
// Use the same server-safe logic for motion props
const motionProps = shouldShowAnimated
? {
initial: { offsetDistance: '0%', rotate: '0deg', opacity: 0 },
whileInView: { offsetDistance: '62%', rotate: '23.4deg', opacity: 1 },
viewport: { once: true },
transition: { type: 'spring', duration: 2.68, bounce: 0, delay: 0.25 },
style: {
offsetPath: 'path("M0 493.132C285.852 493.132 896.213 411.11 1401.8 1")',
},
}
: undefined
// Use the same server-safe logic for component selection
const Component = shouldShowAnimated ? motion.div : 'div'
return (
{companyStats.developersRegistered.label}
{shouldShowAnimated ? (
) : (
companyStats.developersRegistered.text
)}
{shouldShowAnimated ? (
) : (
companyStats.developersRegisteredChange.text
)}
)
}
const GraphPath: FC<{ className?: string }> = ({ className }) => (
)
export default UsersGrowthChart