| "use client"; | |
| import { | |
| Area, | |
| AreaChart, | |
| CartesianGrid, | |
| ResponsiveContainer, | |
| Tooltip, | |
| XAxis, | |
| YAxis, | |
| } from "recharts"; | |
| import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card"; | |
| interface UserGrowthData { | |
| date: string; | |
| users: number; | |
| } | |
| interface UserGrowthChartProps { | |
| data: UserGrowthData[]; | |
| } | |
| export function UserGrowthChart({ data }: UserGrowthChartProps) { | |
| return ( | |
| <Card> | |
| <CardHeader> | |
| <CardTitle>User Growth</CardTitle> | |
| <CardDescription>Total users over the last 30 days</CardDescription> | |
| </CardHeader> | |
| <CardContent className="h-[300px]"> | |
| <ResponsiveContainer width="100%" height="100%"> | |
| <AreaChart | |
| data={data} | |
| margin={{ top: 10, right: 30, left: 0, bottom: 0 }} | |
| > | |
| <defs> | |
| <linearGradient id="colorUsers" x1="0" y1="0" x2="0" y2="1"> | |
| <stop offset="5%" stopColor="#8884d8" stopOpacity={0.8} /> | |
| <stop offset="95%" stopColor="#8884d8" stopOpacity={0} /> | |
| </linearGradient> | |
| </defs> | |
| <XAxis | |
| dataKey="date" | |
| stroke="#888888" | |
| fontSize={12} | |
| tickLine={false} | |
| axisLine={false} | |
| /> | |
| <YAxis | |
| stroke="#888888" | |
| fontSize={12} | |
| tickLine={false} | |
| axisLine={false} | |
| tickFormatter={(value) => `${value}`} | |
| /> | |
| <CartesianGrid strokeDasharray="3 3" vertical={false} /> | |
| <Tooltip | |
| contentStyle={{ | |
| backgroundColor: "hsl(var(--background))", | |
| borderColor: "hsl(var(--border))", | |
| borderRadius: "var(--radius)", | |
| }} | |
| /> | |
| <Area | |
| type="monotone" | |
| dataKey="users" | |
| stroke="#8884d8" | |
| fillOpacity={1} | |
| fill="url(#colorUsers)" | |
| /> | |
| </AreaChart> | |
| </ResponsiveContainer> | |
| </CardContent> | |
| </Card> | |
| ); | |
| } | |