import React, { useState } from 'react'; import { Play, BookOpen, Download, ExternalLink, CheckCircle, Clock, Users, Award, Video, FileText, Headphones, Globe, ChevronDown, ChevronUp, Plus, Edit, Trash2, Settings, Save, X, Upload, Eye, EyeOff } from 'lucide-react'; import TrainingAdmin from '../components/TrainingAdmin'; import TrainingAnalytics from '../components/TrainingAnalytics'; interface TrainingModule { id: string; title: string; description: string; duration: string; level: 'Beginner' | 'Intermediate' | 'Advanced'; category: string; videos: TrainingVideo[]; materials: TrainingMaterial[]; completed: boolean; } interface TrainingVideo { id: string; title: string; description: string; youtubeUrl: string; duration: string; thumbnail: string; } interface TrainingMaterial { id: string; title: string; description: string; type: 'PDF' | 'PPT' | 'DOC' | 'VIDEO'; downloadUrl: string; size: string; } const Training: React.FC = () => { const [expandedModule, setExpandedModule] = useState(null); const [selectedCategory, setSelectedCategory] = useState('all'); const [isAdminMode, setIsAdminMode] = useState(false); const [editingModule, setEditingModule] = useState(null); const [editingVideo, setEditingVideo] = useState(null); const [editingMaterial, setEditingMaterial] = useState(null); const [showAddModule, setShowAddModule] = useState(false); const [showAddVideo, setShowAddVideo] = useState(false); const [showAddMaterial, setShowAddMaterial] = useState(false); const [selectedModuleForAdd, setSelectedModuleForAdd] = useState(''); const [showAnalytics, setShowAnalytics] = useState(false); const [currentView, setCurrentView] = useState<'training' | 'admin' | 'analytics'>('training'); const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false); const [deletingItem, setDeletingItem] = useState<{ type: 'module' | 'video' | 'material', id: string, moduleId?: string } | null>(null); const trainingModules: TrainingModule[] = [ { id: 'getting-started', title: 'Getting Started with Cloudtopiaa', description: 'Learn the basics of the Cloudtopiaa platform and how to navigate the reseller portal.', duration: '2 hours', level: 'Beginner', category: 'Platform Basics', completed: false, videos: [ { id: 'intro-video', title: 'Introduction to Cloudtopiaa Reseller Portal', description: 'Overview of the platform features and navigation', youtubeUrl: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', duration: '15:30', thumbnail: 'https://img.youtube.com/vi/dQw4w9WgXcQ/maxresdefault.jpg' }, { id: 'dashboard-tour', title: 'Dashboard Tour and Key Features', description: 'Detailed walkthrough of the dashboard and main features', youtubeUrl: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', duration: '22:15', thumbnail: 'https://img.youtube.com/vi/dQw4w9WgXcQ/maxresdefault.jpg' } ], materials: [ { id: 'quick-start-guide', title: 'Quick Start Guide', description: 'Step-by-step guide to get started', type: 'PDF', downloadUrl: '#', size: '2.5 MB' }, { id: 'platform-overview', title: 'Platform Overview Presentation', description: 'Comprehensive overview of all features', type: 'PPT', downloadUrl: '#', size: '8.1 MB' } ] }, { id: 'sales-strategies', title: 'Sales Strategies and Best Practices', description: 'Master the art of selling cloud services and maximizing your commissions.', duration: '4 hours', level: 'Intermediate', category: 'Sales & Marketing', completed: false, videos: [ { id: 'sales-techniques', title: 'Effective Sales Techniques for Cloud Services', description: 'Learn proven sales strategies for cloud solutions', youtubeUrl: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', duration: '28:45', thumbnail: 'https://img.youtube.com/vi/dQw4w9WgXcQ/maxresdefault.jpg' }, { id: 'customer-presentation', title: 'Customer Presentation Skills', description: 'How to present cloud solutions to potential customers', youtubeUrl: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', duration: '35:20', thumbnail: 'https://img.youtube.com/vi/dQw4w9WgXcQ/maxresdefault.jpg' } ], materials: [ { id: 'sales-playbook', title: 'Sales Playbook', description: 'Complete sales strategy guide', type: 'PDF', downloadUrl: '#', size: '5.2 MB' }, { id: 'presentation-templates', title: 'Presentation Templates', description: 'Ready-to-use presentation templates', type: 'PPT', downloadUrl: '#', size: '12.3 MB' } ] }, { id: 'technical-deep-dive', title: 'Technical Deep Dive: Cloud Services', description: 'Advanced technical training on cloud infrastructure and services.', duration: '6 hours', level: 'Advanced', category: 'Technical', completed: false, videos: [ { id: 'cloud-architecture', title: 'Cloud Architecture Fundamentals', description: 'Understanding cloud infrastructure and architecture', youtubeUrl: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', duration: '42:10', thumbnail: 'https://img.youtube.com/vi/dQw4w9WgXcQ/maxresdefault.jpg' }, { id: 'security-best-practices', title: 'Security Best Practices', description: 'Implementing security measures in cloud environments', youtubeUrl: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', duration: '38:25', thumbnail: 'https://img.youtube.com/vi/dQw4w9WgXcQ/maxresdefault.jpg' } ], materials: [ { id: 'technical-whitepaper', title: 'Technical Whitepaper', description: 'In-depth technical documentation', type: 'PDF', downloadUrl: '#', size: '15.7 MB' }, { id: 'architecture-diagrams', title: 'Architecture Diagrams', description: 'Visual guides for cloud architecture', type: 'PDF', downloadUrl: '#', size: '8.9 MB' } ] }, { id: 'commission-system', title: 'Commission System and Revenue Optimization', description: 'Understand the commission structure and learn how to maximize your earnings.', duration: '3 hours', level: 'Intermediate', category: 'Business', completed: false, videos: [ { id: 'commission-structure', title: 'Understanding Commission Structure', description: 'Detailed breakdown of commission rates and tiers', youtubeUrl: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', duration: '25:30', thumbnail: 'https://img.youtube.com/vi/dQw4w9WgXcQ/maxresdefault.jpg' }, { id: 'revenue-optimization', title: 'Revenue Optimization Strategies', description: 'Tips and tricks to maximize your commission earnings', youtubeUrl: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', duration: '31:45', thumbnail: 'https://img.youtube.com/vi/dQw4w9WgXcQ/maxresdefault.jpg' } ], materials: [ { id: 'commission-guide', title: 'Commission Guide', description: 'Complete guide to commission structure', type: 'PDF', downloadUrl: '#', size: '3.8 MB' }, { id: 'revenue-calculator', title: 'Revenue Calculator Tool', description: 'Excel tool to calculate potential earnings', type: 'DOC', downloadUrl: '#', size: '1.2 MB' } ] } ]; const categories = ['all', 'Platform Basics', 'Sales & Marketing', 'Technical', 'Business']; const filteredModules = selectedCategory === 'all' ? trainingModules : trainingModules.filter(module => module.category === selectedCategory); // Analytics data const analyticsData = { totalModules: trainingModules.length, totalVideos: trainingModules.reduce((acc, module) => acc + module.videos.length, 0), totalMaterials: trainingModules.reduce((acc, module) => acc + module.materials.length, 0), totalResellers: 156, activeResellers: 142, completedModules: trainingModules.filter(m => m.completed).length, averageCompletionTime: '2.5 hours', popularCategories: [ { name: 'Platform Basics', count: 45, percentage: 35 }, { name: 'Sales & Marketing', count: 38, percentage: 29 }, { name: 'Technical', count: 28, percentage: 22 }, { name: 'Business', count: 18, percentage: 14 } ], completionRates: [ { month: 'Jan', rate: 75 }, { month: 'Feb', rate: 82 }, { month: 'Mar', rate: 78 }, { month: 'Apr', rate: 85 }, { month: 'May', rate: 88 }, { month: 'Jun', rate: 91 } ], topPerformingModules: [ { name: 'Getting Started with Cloudtopiaa', completionRate: 95, avgTime: '1.8 hours' }, { name: 'Sales Strategies and Best Practices', completionRate: 87, avgTime: '3.2 hours' }, { name: 'Technical Deep Dive: Cloud Services', completionRate: 72, avgTime: '5.1 hours' }, { name: 'Commission System and Revenue Optimization', completionRate: 89, avgTime: '2.7 hours' } ], resellerProgress: [ { name: 'John Smith', completed: 8, total: 10, percentage: 80 }, { name: 'Sarah Johnson', completed: 6, total: 10, percentage: 60 }, { name: 'Mike Davis', completed: 9, total: 10, percentage: 90 }, { name: 'Lisa Wilson', completed: 7, total: 10, percentage: 70 }, { name: 'David Brown', completed: 5, total: 10, percentage: 50 } ], recentActivity: [ { type: 'completion', description: 'Completed "Getting Started with Cloudtopiaa" module', timestamp: '2 hours ago', user: 'John Smith' }, { type: 'started', description: 'Started "Technical Deep Dive" module', timestamp: '4 hours ago', user: 'Sarah Johnson' }, { type: 'completion', description: 'Completed "Sales Strategies" module', timestamp: '1 day ago', user: 'Mike Davis' }, { type: 'warning', description: 'Module "Commission System" needs attention', timestamp: '2 days ago', user: 'Lisa Wilson' }, { type: 'completion', description: 'Completed all modules successfully', timestamp: '3 days ago', user: 'David Brown' } ] }; const getLevelColor = (level: string) => { switch (level) { case 'Beginner': return 'bg-success-100 text-success-800 dark:bg-success-900 dark:text-success-300'; case 'Intermediate': return 'bg-warning-100 text-warning-800 dark:bg-warning-900 dark:text-warning-300'; case 'Advanced': return 'bg-danger-100 text-danger-800 dark:bg-danger-900 dark:text-danger-300'; default: return 'bg-secondary-100 text-secondary-800 dark:bg-secondary-900 dark:text-secondary-300'; } }; const toggleModule = (moduleId: string) => { setExpandedModule(expandedModule === moduleId ? null : moduleId); }; const handleDeleteModule = (moduleId: string) => { setDeletingItem({ type: 'module', id: moduleId }); setIsDeleteModalOpen(true); }; const handleDeleteVideo = (moduleId: string, videoId: string) => { setDeletingItem({ type: 'video', id: videoId, moduleId }); setIsDeleteModalOpen(true); }; const handleDeleteMaterial = (moduleId: string, materialId: string) => { setDeletingItem({ type: 'material', id: materialId, moduleId }); setIsDeleteModalOpen(true); }; const confirmDelete = async () => { if (!deletingItem) return; try { if (deletingItem.type === 'module') { // Handle module deletion console.log('Deleting module:', deletingItem.id); // Here you would typically make an API call to delete the module } else if (deletingItem.type === 'video') { // Handle video deletion console.log('Deleting video:', deletingItem.id, 'from module:', deletingItem.moduleId); // Here you would typically make an API call to delete the video } else if (deletingItem.type === 'material') { // Handle material deletion console.log('Deleting material:', deletingItem.id, 'from module:', deletingItem.moduleId); // Here you would typically make an API call to delete the material } // Close modal and reset state setIsDeleteModalOpen(false); setDeletingItem(null); } catch (error) { console.error('Error deleting item:', error); } }; // Enhanced CRUD functions const handleModuleAdd = (module: Omit) => { const newModule: TrainingModule = { ...module, id: `module-${Date.now()}`, videos: [], materials: [], completed: false }; console.log('Adding new module:', newModule); // Here you would typically update your state or make an API call }; const handleModuleUpdate = (id: string, updates: Partial) => { console.log('Updating module:', id, updates); // Here you would typically update your state or make an API call }; const handleModuleDelete = (id: string) => { setDeletingItem({ type: 'module', id }); setIsDeleteModalOpen(true); }; const handleVideoAdd = (moduleId: string, video: Omit) => { const newVideo: TrainingVideo = { ...video, id: `video-${Date.now()}`, thumbnail: `https://img.youtube.com/vi/${video.youtubeUrl.split('v=')[1]}/maxresdefault.jpg` }; console.log('Adding video to module:', moduleId, newVideo); // Here you would typically update your state or make an API call }; const handleVideoUpdate = (moduleId: string, videoId: string, updates: Partial) => { console.log('Updating video:', moduleId, videoId, updates); // Here you would typically update your state or make an API call }; const handleVideoDelete = (moduleId: string, videoId: string) => { setDeletingItem({ type: 'video', id: videoId, moduleId }); setIsDeleteModalOpen(true); }; const handleMaterialAdd = (moduleId: string, material: Omit) => { const newMaterial: TrainingMaterial = { ...material, id: `material-${Date.now()}`, downloadUrl: '#' }; console.log('Adding material to module:', moduleId, newMaterial); // Here you would typically update your state or make an API call }; const handleMaterialUpdate = (moduleId: string, materialId: string, updates: Partial) => { console.log('Updating material:', moduleId, materialId, updates); // Here you would typically update your state or make an API call }; const handleMaterialDelete = (moduleId: string, materialId: string) => { setDeletingItem({ type: 'material', id: materialId, moduleId }); setIsDeleteModalOpen(true); }; const handleExportReport = (type: 'pdf' | 'excel' | 'csv') => { console.log(`Exporting ${type} report...`); // Here you would typically generate and download the report }; const handleDateRangeChange = (startDate: string, endDate: string) => { console.log('Date range changed:', startDate, endDate); // Here you would typically filter analytics data }; return (
{/* Header */}

Training Center

Master the Cloudtopiaa platform and maximize your success

{/* View Toggle Buttons */}
{/* Admin Actions */} {currentView === 'admin' && ( )}
{/* Content Based on Current View */} {currentView === 'training' && ( <> {/* How It Works Section */}

How Training Works

1. Choose Your Path

Select from beginner, intermediate, or advanced training modules based on your experience level.

2. Watch & Learn

Access high-quality video tutorials, webinars, and interactive content designed for resellers.

3. Get Certified

Complete assessments and earn certifications to demonstrate your expertise to customers.

)} {currentView === 'analytics' && ( )} {currentView === 'admin' && ( )} {/* Category Filter and Training Modules - Only show in training view */} {currentView === 'training' && ( <> {/* Category Filter */}
{categories.map((category) => ( ))}
{/* Training Modules */}
{filteredModules.map((module) => (
toggleModule(module.id)} >
{module.completed ? ( ) : (
)}

{module.title}

{module.level}

{module.description}

{module.duration}
{module.materials.length} materials
{isAdminMode && (
)} {expandedModule === module.id ? ( ) : ( )}
{/* Expanded Content */} {expandedModule === module.id && (
{/* Videos Section */}

{isAdminMode && ( )}
{module.videos.map((video) => (
{video.title}
{video.title}

{video.description}

{video.duration}
Watch {isAdminMode && ( <> )}
))}
{/* Materials Section */}

Training Materials

{isAdminMode && ( )}
{module.materials.map((material) => (
{material.title}

{material.description}

{material.size}
Download {isAdminMode && ( <> )}
))}
)}
))}
)} {/* Additional Resources */}

Additional Resources

Live Webinars

Join our weekly live webinars with industry experts and get your questions answered in real-time.

Community Forum

Connect with other resellers, share experiences, and learn from the community.

Knowledge Base

Access comprehensive documentation, FAQs, and troubleshooting guides.

{/* Certification Path */}

Get Certified

Complete our training modules and earn professional certifications to boost your credibility and sales.

Beginner Certification
Advanced Certification
Expert Certification
{/* Admin Modals */} {showAddModule && (

Add New Training Module

)} {showAddVideo && (

Add New Video

)} {showAddMaterial && (

Add New Material

Click to upload or drag and drop

)} {/* Edit Modals */} {editingModule && (

Edit Training Module

)} {editingVideo && (

Edit Video

)} {editingMaterial && (

Edit Material

)} {/* Delete Confirmation Modal */} {isDeleteModalOpen && (

Confirm Delete

{deletingItem?.type === 'module' && 'Are you sure you want to delete this training module? This action cannot be undone.'} {deletingItem?.type === 'video' && 'Are you sure you want to delete this video? This action cannot be undone.'} {deletingItem?.type === 'material' && 'Are you sure you want to delete this material? This action cannot be undone.'}

)}
); }; export default Training;