"use client" import { useState } from "react" import { BarChart, Bar, XAxis, YAxis, CartesianGrid } from "recharts" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { ChartContainer, ChartTooltip, ChartTooltipContent } from "@/components/ui/chart" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table" import { Button } from "@/components/ui/button" import { Users, MapPin, TrendingUp, Target, ArrowUpIcon, UserIcon } from "lucide-react" const customerGrowthData = [ { month: "Jan", new: 245, returning: 890, churn: 45 }, { month: "Feb", new: 312, returning: 934, churn: 52 }, { month: "Mar", new: 289, returning: 1023, churn: 38 }, { month: "Apr", new: 456, returning: 1156, churn: 61 }, { month: "May", new: 523, returning: 1298, churn: 47 }, { month: "Jun", new: 634, returning: 1445, churn: 55 }, ] const chartConfig = { new: { label: "New Customers", color: "var(--chart-1)", }, returning: { label: "Returning", color: "var(--chart-2)", }, churn: { label: "Churned", color: "var(--chart-3)", }, } const demographicsData = [ { ageGroup: "18-24", customers: 2847, percentage: "18.0%", growth: "+15.2%", growthColor: "text-green-600" }, { ageGroup: "25-34", customers: 4521, percentage: "28.5%", growth: "+8.7%", growthColor: "text-green-600" }, { ageGroup: "35-44", customers: 3982, percentage: "25.1%", growth: "+3.4%", growthColor: "text-blue-600" }, { ageGroup: "45-54", customers: 2734, percentage: "17.2%", growth: "+1.2%", growthColor: "text-orange-600" }, { ageGroup: "55+", customers: 1763, percentage: "11.2%", growth: "-2.1%", growthColor: "text-red-600" }, ] const regionsData = [ { region: "North America", customers: 6847, revenue: "$847,523", growth: "+12.3%", growthColor: "text-green-600" }, { region: "Europe", customers: 4521, revenue: "$563,891", growth: "+9.7%", growthColor: "text-green-600" }, { region: "Asia Pacific", customers: 2892, revenue: "$321,456", growth: "+18.4%", growthColor: "text-blue-600" }, { region: "Latin America", customers: 1123, revenue: "$187,234", growth: "+15.8%", growthColor: "text-green-600" }, { region: "Others", customers: 464, revenue: "$67,891", growth: "+5.2%", growthColor: "text-orange-600" }, ] export function CustomerInsights() { const [activeTab, setActiveTab] = useState("growth") return ( Customer Insights Growth trends and demographics Growth Demographics Regions
{/* Chart and Key Metrics Side by Side */}
{/* Chart Area - 70% */}

Customer Growth Trends

} />
{/* Key Metrics - 30% */}

Key Metrics

Total Customers
15,847
+12.5% from last month
Retention Rate
92.4%
+2.1% improvement
Avg. LTV
$2,847
+8.3% growth
Age Group Customers Percentage Growth {demographicsData.map((row, index) => ( {row.ageGroup} {row.customers.toLocaleString()} {row.percentage} {row.growth} ))}
0 of {demographicsData.length} row(s) selected.
Region Customers Revenue Growth {regionsData.map((row, index) => ( {row.region} {row.customers.toLocaleString()} {row.revenue} {row.growth} ))}
0 of {regionsData.length} row(s) selected.
) }