'use client'; import NumberFlow from '@number-flow/react'; import Image from 'next/image'; import { useEffect, useState } from 'react'; const VISITOR_DATA = [1840, 2100, 1950, 2400, 2250, 2650, 2980]; const DAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']; const STATS = [ { label: 'Visitors', value: 4128, formatted: null, change: 12, up: true }, { label: 'Page views', value: 12438, formatted: '12.4k', change: 8, up: true }, { label: 'Bounce rate', value: null, formatted: '42%', change: 3, up: false }, { label: 'Avg. session', value: null, formatted: '3m 23s', change: 5, up: true }, ]; const SOURCES = [ { icon: 'https://api.openpanel.dev/misc/favicon?url=https%3A%2F%2Fgoogle.com', name: 'google.com', pct: 49, }, { icon: 'https://api.openpanel.dev/misc/favicon?url=https%3A%2F%2Ftwitter.com', name: 'twitter.com', pct: 21, }, { icon: 'https://api.openpanel.dev/misc/favicon?url=https%3A%2F%2Fgithub.com', name: 'github.com', pct: 14, }, ]; function AreaChart({ data }: { data: number[] }) { const max = Math.max(...data); const w = 400; const h = 64; const xStep = w / (data.length - 1); const pts = data.map((v, i) => ({ x: i * xStep, y: h - (v / max) * h })); const line = pts.map((p, i) => `${i === 0 ? 'M' : 'L'} ${p.x},${p.y}`).join(' '); const area = `${line} L ${w},${h} L 0,${h} Z`; const last = pts[pts.length - 1]; return ( ); } export function WebAnalyticsIllustration() { const [liveVisitors, setLiveVisitors] = useState(47); useEffect(() => { const values = [47, 51, 44, 53, 49, 56]; let i = 0; const id = setInterval(() => { i = (i + 1) % values.length; setLiveVisitors(values[i]); }, 2500); return () => clearInterval(id); }, []); return (