import { SimpleChart } from '@/components/simple-chart'; import { cn } from '@/lib/utils'; import NumberFlow from '@number-flow/react'; import { AnimatePresence, motion } from 'framer-motion'; import { ArrowUpIcon } from 'lucide-react'; import Image from 'next/image'; import { useEffect, useState } from 'react'; const TRAFFIC_SOURCES = [ { icon: 'https://api.openpanel.dev/misc/favicon?url=https%3A%2F%2Fgoogle.com', name: 'Google', percentage: 49, value: 2039, }, { icon: 'https://api.openpanel.dev/misc/favicon?url=https%3A%2F%2Finstagram.com', name: 'Instagram', percentage: 23, value: 920, }, { icon: 'https://api.openpanel.dev/misc/favicon?url=https%3A%2F%2Ffacebook.com', name: 'Facebook', percentage: 18, value: 750, }, { icon: 'https://api.openpanel.dev/misc/favicon?url=https%3A%2F%2Ftwitter.com', name: 'Twitter', percentage: 10, value: 412, }, ]; const COUNTRIES = [ { icon: 'πŸ‡ΊπŸ‡Έ', name: 'United States', percentage: 37, value: 1842 }, { icon: 'πŸ‡©πŸ‡ͺ', name: 'Germany', percentage: 28, value: 1391 }, { icon: 'πŸ‡¬πŸ‡§', name: 'United Kingdom', percentage: 20, value: 982 }, { icon: 'πŸ‡―πŸ‡΅', name: 'Japan', percentage: 15, value: 751 }, ]; export function WebAnalyticsFeature() { const [currentSourceIndex, setCurrentSourceIndex] = useState(0); const [currentCountryIndex, setCurrentCountryIndex] = useState(0); useEffect(() => { const interval = setInterval(() => { setCurrentSourceIndex((prev) => (prev + 1) % TRAFFIC_SOURCES.length); setCurrentCountryIndex((prev) => (prev + 1) % COUNTRIES.length); }, 3000); return () => clearInterval(interval); }, []); return (
); } function MetricCard({ title, value, change, chartPoints, color, className, }: { title: string; value: string; change: string; chartPoints: number[]; color: string; className?: string; }) { return (
{title}
{value}
{change}
); } function BarCell({ icon, name, percentage, value, }: { icon: string; name: string; percentage: number; value: number; }) { return (
{icon.startsWith('http') ? ( serie icon ) : (
{icon}
)} {name}
%
); }