import { useQuery } from "@tanstack/react-query"; import { apiClient } from "../lib/apiClient"; import { BarChart2, TrendingUp, Download, Calendar, Mail, Inbox, Flame, ShieldCheck, Percent, ArrowUpRight } from "lucide-react"; import { ResponsiveContainer, LineChart, Line, BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend } from "recharts"; import { useState } from "react"; import StatCard from "../components/StatCard"; import CsvExportButton from "../components/CsvExportButton"; const timelineData = [ { date: "Oct 1", sent: 820, opens: 530, replies: 48, bounces: 4 }, { date: "Oct 5", sent: 1140, opens: 760, replies: 72, bounces: 8 }, { date: "Oct 10", sent: 1650, opens: 1120, replies: 98, bounces: 11 }, { date: "Oct 15", sent: 2100, opens: 1450, replies: 134, bounces: 15 }, { date: "Oct 20", sent: 2800, opens: 1980, replies: 182, bounces: 21 }, { date: "Oct 25", sent: 3400, opens: 2450, replies: 226, bounces: 28 }, { date: "Oct 30", sent: 4120, opens: 2980, replies: 280, bounces: 34 }, ]; const campaignComparisonData = [ { name: "SaaS Enterprise VPs", sent: 4200, opens: 2600, replies: 240 }, { name: "Series A Tech Founders", sent: 3100, opens: 2100, replies: 195 }, { name: "Agency Owners Q4", sent: 2400, opens: 1400, replies: 120 }, { name: "E-commerce Directors", sent: 1800, opens: 980, replies: 84 }, { name: "RevOps Decision Makers", sent: 1200, opens: 720, replies: 65 }, ]; export default function Analytics() { const [dateRange, setDateRange] = useState("30d"); const { data: analytics } = useQuery({ queryKey: ["analytics-campaigns"], queryFn: async () => { const res = await apiClient.get("/analytics/campaigns"); return res.data; }, }); const { data: emailAccounts = [] } = useQuery({ queryKey: ["email-accounts"], queryFn: async () => { const res = await apiClient.get("/email-accounts"); return res.data; }, }); return (
Global deliverability performance, engagement conversion funnels, and mailbox health telemetry.
Daily trajectory of outbound sends, unique opens, and replied prospects.
Volume dispatched vs. engaged prospects.
DNS authentication, warmup status, and health metrics.