import React, { useState } from 'react';
import {
BarChart3,
TrendingUp,
Users,
DollarSign,
ShoppingCart,
Award,
Target,
Calendar,
Filter,
Download,
Eye,
EyeOff,
RefreshCw,
ArrowUp,
ArrowDown,
Activity,
PieChart,
LineChart,
BarChart,
AreaChart
} from 'lucide-react';
const Analytics: React.FC = () => {
const [dateRange, setDateRange] = useState('30d');
const [showDetailedMetrics, setShowDetailedMetrics] = useState(false);
// Mock data
const analyticsData = {
totalRevenue: 1250000,
totalResellers: 156,
activeResellers: 142,
totalDeals: 89,
conversionRate: 23.5,
averageDealSize: 14000,
monthlyGrowth: 12.8,
topPerformingResellers: [
{ name: 'John Smith', revenue: 89000, deals: 12, growth: 15.2 },
{ name: 'Sarah Johnson', revenue: 76000, deals: 9, growth: 8.7 },
{ name: 'Mike Davis', revenue: 68000, deals: 11, growth: 22.1 },
{ name: 'Lisa Wilson', revenue: 54000, deals: 7, growth: 5.3 },
{ name: 'David Brown', revenue: 48000, deals: 6, growth: 18.9 }
],
revenueByMonth: [
{ month: 'Jan', revenue: 85000, deals: 8 },
{ month: 'Feb', revenue: 92000, deals: 9 },
{ month: 'Mar', revenue: 78000, deals: 7 },
{ month: 'Apr', revenue: 105000, deals: 10 },
{ month: 'May', revenue: 118000, deals: 11 },
{ month: 'Jun', revenue: 125000, deals: 12 }
],
categoryPerformance: [
{ category: 'Cloud Services', revenue: 450000, percentage: 36 },
{ category: 'Security Solutions', revenue: 320000, percentage: 25.6 },
{ category: 'Data Analytics', revenue: 280000, percentage: 22.4 },
{ category: 'Consulting', revenue: 200000, percentage: 16 }
],
regionalPerformance: [
{ region: 'North America', revenue: 520000, growth: 15.2 },
{ region: 'Europe', revenue: 380000, growth: 8.7 },
{ region: 'Asia Pacific', revenue: 250000, growth: 22.1 },
{ region: 'Latin America', revenue: 100000, growth: 5.3 }
]
};
const getGrowthColor = (growth: number) => {
return growth >= 0 ? 'text-success-600 dark:text-success-400' : 'text-danger-600 dark:text-danger-400';
};
const getGrowthIcon = (growth: number) => {
return growth >= 0 ?
Comprehensive insights into your business performance
Total Revenue
${((Number(analyticsData.totalRevenue) || 0) / 1000).toFixed(0)}K
Active Resellers
{analyticsData.activeResellers}
Total Deals
{analyticsData.totalDeals}
Conversion Rate
{analyticsData.conversionRate}%
Revenue trend chart
Monthly revenue progression
{item.month}
${((Number(item.revenue) || 0) / 1000).toFixed(0)}K
Category distribution chart
Revenue by product category
| Reseller | Revenue | Deals | Growth | Status |
|---|---|---|---|---|
|
|
${((Number(reseller.revenue) || 0) / 1000).toFixed(0)}K | {reseller.deals} |
{getGrowthIcon(reseller.growth)}
{reseller.growth}%
|
Active |
${((Number(region.revenue) || 0) / 1000).toFixed(0)}K
Revenue
Download analytics data in various formats