import React, { useEffect } from 'react'; import { useAppSelector, useAppDispatch } from '../../store/hooks'; import { useNavigate } from 'react-router-dom'; import { setStats, setRecentActivities, setQuickActions } from '../../store/slices/dashboardSlice'; import { loginSuccess } from '../../store/slices/authSlice'; import { mockDashboardStats, mockRecentActivities, mockResellerQuickActions, mockResellerRecentActivities, mockUser } from '../../data/mockData'; import { formatNumber, formatRelativeTime, formatPercentage } from '../../utils/format'; import RevenueChart from '../../components/charts/RevenueChart'; import ResellerPerformanceChart from '../../components/charts/ResellerPerformanceChart'; import DualCurrencyDisplay from '../../components/DualCurrencyDisplay'; import { TrendingUp, Users, Cloud, DollarSign, UserPlus, CheckCircle, Briefcase, GraduationCap, BarChart3, CreditCard, Headphones, ShoppingBag, Award, HelpCircle, Settings, Wallet, BookOpen, Zap, Target, Star, ArrowUpRight, Activity } from 'lucide-react'; import { cn } from '../../utils/cn'; const ResellerDashboard: React.FC = () => { const dispatch = useAppDispatch(); const navigate = useNavigate(); const { stats, recentActivities, quickActions } = useAppSelector((state) => state.dashboard); useEffect(() => { // Initialize with mock data dispatch(loginSuccess({ user: { ...mockUser, role: 'reseller_admin', company: 'Tech Solutions Inc' }, token: 'mock-token', refreshToken: 'mock-refresh-token' })); dispatch(setStats(mockDashboardStats)); dispatch(setRecentActivities(mockResellerRecentActivities)); dispatch(setQuickActions(mockResellerQuickActions)); }, [dispatch]); const handleQuickAction = (action: any) => { switch (action.id) { case 'add-customer': navigate('/reseller-dashboard/customers'); break; case 'create-instance': navigate('/reseller-dashboard/instances'); break; case 'billing': navigate('/reseller-dashboard/billing'); break; case 'support': navigate('/reseller-dashboard/support'); break; case 'training': navigate('/reseller-dashboard/training'); break; case 'reports': navigate('/reseller-dashboard/reports'); break; case 'wallet': navigate('/reseller-dashboard/wallet'); break; case 'marketplace': navigate('/reseller-dashboard/marketplace'); break; case 'certifications': navigate('/reseller-dashboard/certifications'); break; case 'knowledge-base': navigate('/reseller-dashboard/knowledge-base'); break; case 'settings': navigate('/reseller-dashboard/settings'); break; default: break; } }; return (
{/* Welcome Section */}

Welcome back, John!

Here's what's happening with your cloud services business today.

{formatNumber(stats.totalResellers)}
Active Customers
Monthly Revenue
{/* Key Metrics */}

Total Revenue

+{stats.monthlyGrowth}% from last month

{formatNumber(stats.totalResellers)}

Active Customers

+5 new this month

{formatNumber(stats.activePartnerships)}

Cloud Instances

+12 new instances

{formatPercentage(15)}

Commission Rate

Premium tier
{/* Quick Actions & Recent Activity */}
{/* Quick Actions */}

Quick Actions

{quickActions.slice(0, 6).map((action) => ( ))}
{/* Recent Activity */}

Recent Activity

{recentActivities.map((activity) => (
{activity.type === 'customer_added' && } {activity.type === 'instance_created' && } {activity.type === 'payment_received' && } {activity.type === 'support_ticket' && } {activity.type === 'training_completed' && }

{activity.title}

{activity.description}

{activity.amount && (
)}

{formatRelativeTime(activity.timestamp)}

))}
{/* Charts Section */}

Revenue Overview

Customer Performance

); }; export default ResellerDashboard;