onlyounesse / index.html
Onlyounesse's picture
Add 2 files
f113ee9 verified
Raw History Blame Contribute Delete
77.7 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>AfricaLive - Video Streaming & Live Content Platform</title> <script src="https://cdn.tailwindcss.com"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <style> /* Custom CSS */ .video-thumbnail { transition: transform 0.3s ease; } .video-thumbnail:hover { transform: scale(1.03); } .live-indicator { animation: pulse 2s infinite; } @keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } } .gradient-bg { background: linear-gradient(135deg, #4F46E5 0%, #1E40AF 100%); } .sidebar { scrollbar-width: thin; scrollbar-color: #4B5563 #1F2937; } .sidebar::-webkit-scrollbar { width: 6px; } .sidebar::-webkit-scrollbar-track { background: #1F2937; } .sidebar::-webkit-scrollbar-thumb { background-color: #4B5563; border-radius: 3px; } #videoPlayer { width: 100%; height: 0; padding-bottom: 56.25%; position: relative; } #videoPlayer iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } </style> </head> <body class="bg-gray-900 text-white"> <!-- Header/Navigation --> <header class="bg-gray-800 shadow-lg sticky top-0 z-50"> <div class="container mx-auto px-4 py-3 flex items-center justify-between"> <div class="flex items-center space-x-4 flex-1"> <div class="flex items-center cursor-pointer" onclick="window.location.href='#'"> <i class="fas fa-play-circle text-red-500 text-3xl mr-2"></i> <span class="text-xl font-bold">Africa<span class="text-red-500">Live</span></span> </div> <div class="hidden md:flex flex-1 max-w-2xl mx-4"> <div class="relative w-full"> <input type="text" id="searchInput" placeholder="Search videos, channels, or categories" class="w-full bg-gray-700 rounded-l-full py-2 px-4 focus:outline-none focus:ring-2 focus:ring-red-500"> <button onclick="searchContent()" class="absolute right-0 top-0 h-full bg-gray-600 rounded-r-full px-4 hover:bg-gray-500"> <i class="fas fa-search"></i> </button> </div> </div> </div> <div class="flex items-center space-x-4"> <button class="md:hidden text-xl" onclick="toggleMobileSearch()"> <i class="fas fa-search"></i> </button> <button class="p-2 rounded-full hover:bg-gray-700" onclick="showGoLiveModal()"> <i class="fas fa-video"></i> </button> <button class="p-2 rounded-full hover:bg-gray-700 relative" onclick="toggleNotifications()"> <i class="fas fa-bell"></i> <span class="absolute top-0 right-0 w-2 h-2 bg-red-500 rounded-full"></span> </button> <button id="userMenuButton" class="flex items-center space-x-1"> <div class="w-8 h-8 rounded-full bg-red-500 flex items-center justify-center"> <span class="font-semibold" id="userInitial">U</span> </div> </button> </div> </div> <!-- Mobile Search (hidden by default) --> <div id="mobileSearch" class="hidden md:hidden px-4 py-2 bg-gray-800"> <div class="relative"> <input type="text" placeholder="Search..." class="w-full bg-gray-700 rounded-full py-2 px-4 pl-10 focus:outline-none focus:ring-2 focus:ring-red-500"> <button class="absolute left-3 top-2.5 text-gray-400"> <i class="fas fa-search"></i> </button> </div> </div> </header> <!-- User Dropdown Menu --> <div id="userMenu" class="hidden absolute right-4 mt-2 w-48 bg-gray-800 rounded-md shadow-lg z-50 py-1"> <a href="#" class="block px-4 py-2 hover:bg-gray-700" onclick="navigateToChannel()"><i class="fas fa-user mr-2"></i> Your Channel</a> <a href="#" class="block px-4 py-2 hover:bg-gray-700" onclick="showWallet()"><i class="fas fa-wallet mr-2"></i> Wallet: $<span id="walletBalance">5.00</span></a> <a href="#" class="block px-4 py-2 hover:bg-gray-700" onclick="showSettings()"><i class="fas fa-cog mr-2"></i> Settings</a> <a href="#" class="block px-4 py-2 hover:bg-gray-700" onclick="logout()"><i class="fas fa-sign-out-alt mr-2"></i> Sign Out</a> </div> <!-- Notifications Panel --> <div id="notificationsPanel" class="hidden absolute right-4 mt-2 w-72 bg-gray-800 rounded-md shadow-lg z-50 py-1 max-h-96 overflow-y-auto"> <div class="px-4 py-2 border-b border-gray-700 flex justify-between items-center"> <h3 class="font-medium">Notifications</h3> <button class="text-blue-400 text-sm" onclick="markAllAsRead()">Mark all as read</button> </div> <div id="notificationsList"> <!-- Notifications will be populated here --> </div> </div> <!-- Main Content --> <div class="flex"> <!-- Sidebar --> <aside class="hidden md:block w-64 bg-gray-800 h-screen sticky top-16 overflow-y-auto sidebar"> <div class="p-4"> <div class="mb-6"> <h3 class="text-lg font-semibold mb-2">Main Menu</h3> <ul> <li class="mb-1"><a href="#" class="flex items-center p-2 rounded hover:bg-gray-700" onclick="loadHomePage()"><i class="fas fa-home mr-3"></i> Home</a></li> <li class="mb-1"><a href="#" class="flex items-center p-2 rounded hover:bg-gray-700" onclick="loadExplorePage()"><i class="fas fa-compass mr-3"></i> Explore</a></li> <li class="mb-1"><a href="#" class="flex items-center p-2 rounded hover:bg-gray-700" onclick="loadTrendingPage()"><i class="fas fa-fire mr-3"></i> Trending</a></li> <li class="mb-1"><a href="#" class="flex items-center p-2 rounded hover:bg-gray-700" onclick="loadSubscriptionsPage()"><i class="fas fa-film mr-3"></i> Subscriptions</a></li> </ul> </div> <div class="mb-6"> <h3 class="text-lg font-semibold mb-2">Live & Streaming</h3> <ul> <li class="mb-1"><a href="#" class="flex items-center p-2 rounded hover:bg-gray-700" onclick="loadLiveNowPage()"><i class="fas fa-broadcast-tower mr-3"></i> Live Now</a></li> <li class="mb-1"><a href="#" class="flex items-center p-2 rounded hover:bg-gray-700" onclick="loadCategory('gaming')"><i class="fas fa-gamepad mr-3"></i> Gaming</a></li> <li class="mb-1"><a href="#" class="flex items-center p-2 rounded hover:bg-gray-700" onclick="loadCategory('music')"><i class="fas fa-music mr-3"></i> Music</a></li> <li class="mb-1"><a href="#" class="flex items-center p-2 rounded hover:bg-gray-700" onclick="loadCategory('education')"><i class="fas fa-chalkboard-teacher mr-3"></i> Education</a></li> </ul> </div> <div class="mb-6"> <h3 class="text-lg font-semibold mb-2">Fintech Services</h3> <ul> <li class="mb-1"><a href="#" class="flex items-center p-2 rounded hover:bg-gray-700" onclick="showSendMoney()"><i class="fas fa-money-bill-wave mr-3"></i> Send Money</a></li> <li class="mb-1"><a href="#" class="flex items-center p-2 rounded hover:bg-gray-700" onclick="showWallet()"><i class="fas fa-wallet mr-3"></i> Wallet</a></li> <li class="mb-1"><a href="#" class="flex items-center p-2 rounded hover:bg-gray-700" onclick="showDonations()"><i class="fas fa-gift mr-3"></i> Tips & Donations</a></li> <li class="mb-1"><a href="#" class="flex items-center p-2 rounded hover:bg-gray-700" onclick="showMerchStore()"><i class="fas fa-shopping-bag mr-3"></i> Merch Store</a></li> </ul> </div> <div class="mb-6"> <h3 class="text-lg font-semibold mb-2">Subscriptions</h3> <ul id="subscriptionsList"> <!-- Subscriptions will be populated here --> </ul> </div> </div> </aside> <!-- Main Content Area --> <main class="flex-1 p-4" id="mainContent"> <!-- Content will be dynamically loaded here --> </main> </div> <!-- Video Player Modal --> <div id="videoPlayerModal" class="hidden fixed inset-0 bg-black bg-opacity-90 z-50 flex flex-col"> <div class="flex justify-between items-center p-4 bg-black"> <button onclick="closeVideoPlayer()" class="text-white hover:text-gray-300"> <i class="fas fa-times text-xl"></i> </button> <h2 id="videoPlayerTitle" class="text-xl font-bold truncate max-w-md px-4"></h2> <div class="w-8"></div> <!-- Spacer for alignment --> </div> <div id="videoPlayer" class="flex-1"> <!-- Video player will be loaded here --> </div> <div class="bg-gray-900 p-4"> <div class="flex items-start mb-4"> <div class="w-12 h-12 rounded-full bg-gray-700 mr-3 overflow-hidden"> <img id="videoChannelImage" src="https://via.placeholder.com/100" alt="Channel" class="w-full h-full object-cover"> </div> <div class="flex-1"> <h3 id="videoTitle" class="font-bold text-lg"></h3> <p id="videoChannelName" class="text-gray-400"></p> <p id="videoStats" class="text-gray-400 text-sm"></p> </div> <button id="subscribeBtn" onclick="toggleSubscription()" class="bg-red-600 hover:bg-red-700 px-4 py-2 rounded-full font-medium"> Subscribe </button> </div> <div class="flex items-center justify-between border-t border-gray-800 pt-3"> <div class="flex space-x-4"> <button onclick="likeVideo()" class="flex items-center text-gray-400 hover:text-white"> <i class="fas fa-thumbs-up mr-1"></i> <span id="likeCount">0</span> </button> <button onclick="dislikeVideo()" class="flex items-center text-gray-400 hover:text-white"> <i class="fas fa-thumbs-down mr-1"></i> <span id="dislikeCount">0</span> </button> <button onclick="shareVideo()" class="flex items-center text-gray-400 hover:text-white"> <i class="fas fa-share mr-1"></i> Share </button> </div> <div class="flex items-center"> <div class="bg-gray-800 rounded-full px-3 py-1 text-sm"> <i class="fas fa-eye mr-1"></i> <span id="viewCount">0</span> watching </div> </div> </div> </div> </div> <!-- Live Chat Modal --> <div id="liveChatModal" class="hidden fixed right-4 bottom-4 w-80 bg-gray-800 rounded-t-lg shadow-xl z-50 flex flex-col" style="max-height: 70vh;"> <div class="bg-gray-700 px-4 py-2 rounded-t-lg flex justify-between items-center"> <h3 class="font-medium">Live Chat</h3> <button onclick="closeLiveChat()" class="text-gray-300 hover:text-white"> <i class="fas fa-times"></i> </button> </div> <div id="liveChatMessages" class="flex-1 overflow-y-auto p-3 space-y-2"> <!-- Chat messages will appear here --> </div> <div class="p-3 border-t border-gray-700"> <div class="flex"> <input type="text" id="chatMessageInput" placeholder="Send a message" class="flex-1 bg-gray-700 rounded-l-full px-4 py-2 focus:outline-none"> <button onclick="sendChatMessage()" class="bg-blue-600 hover:bg-blue-700 rounded-r-full px-4"> <i class="fas fa-paper-plane"></i> </button> </div> </div> </div> <!-- Go Live Modal --> <div id="goLiveModal" class="hidden fixed inset-0 bg-black bg-opacity-75 flex items-center justify-center z-50 p-4"> <div class="bg-gray-800 rounded-lg w-full max-w-2xl"> <div class="flex justify-between items-center border-b border-gray-700 p-4"> <h3 class="text-xl font-bold">Go Live on AfricaLive</h3> <button id="closeModal" class="text-gray-400 hover:text-white"> <i class="fas fa-times"></i> </button> </div> <div class="p-4"> <div class="mb-4"> <label class="block text-gray-300 mb-2">Stream Title</label> <input type="text" id="streamTitle" placeholder="What are you streaming about?" class="w-full bg-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-red-500"> </div> <div class="mb-4"> <label class="block text-gray-300 mb-2">Category</label> <select id="streamCategory" class="w-full bg-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-red-500"> <option value="">Select a category</option> <option value="gaming">Gaming</option> <option value="music">Music</option> <option value="talk">Talk Show</option> <option value="education">Education</option> <option value="just_chatting">Just Chatting</option> </select> </div> <div class="mb-4"> <label class="block text-gray-300 mb-2">Thumbnail</label> <div class="border-2 border-dashed border-gray-600 rounded-lg p-8 text-center cursor-pointer" onclick="document.getElementById('thumbnailUpload').click()"> <i class="fas fa-cloud-upload-alt text-3xl text-gray-500 mb-2"></i> <p class="text-gray-400">Click to upload thumbnail or drag and drop</p> <input type="file" id="thumbnailUpload" class="hidden" accept="image/*"> </div> <div id="thumbnailPreview" class="mt-2 hidden"> <img id="previewImage" src="#" alt="Thumbnail Preview" class="max-h-40 rounded-lg"> </div> </div> <div class="mb-4"> <label class="block text-gray-300 mb-2">Stream Key</label> <div class="flex"> <input type="text" id="streamKey" value="africalive-12345-67890" class="flex-1 bg-gray-700 rounded-l-lg px-4 py-2 focus:outline-none" readonly> <button onclick="copyStreamKey()" class="bg-gray-600 hover:bg-gray-500 rounded-r-lg px-4 py-2"> <i class="fas fa-copy"></i> </button> </div> <p class="text-gray-400 text-sm mt-1">Use this key in your streaming software (OBS, Streamlabs, etc.)</p> </div> <div class="flex justify-end space-x-3 mt-6"> <button onclick="closeGoLiveModal()" class="px-4 py-2 border border-gray-600 rounded-lg hover:bg-gray-700">Cancel</button> <button onclick="startStreaming()" class="px-4 py-2 bg-red-600 rounded-lg hover:bg-red-700 font-medium">Start Streaming</button> </div> </div> </div> </div> <!-- Wallet Modal --> <div id="walletModal" class="hidden fixed inset-0 bg-black bg-opacity-75 flex items-center justify-center z-50 p-4"> <div class="bg-gray-800 rounded-lg w-full max-w-md"> <div class="flex justify-between items-center border-b border-gray-700 p-4"> <h3 class="text-xl font-bold">AfricaLive Wallet</h3> <button onclick="closeWalletModal()" class="text-gray-400 hover:text-white"> <i class="fas fa-times"></i> </button> </div> <div class="p-4"> <div class="bg-gray-700 rounded-lg p-4 mb-4"> <div class="text-gray-400 text-sm mb-1">Available Balance</div> <div class="text-2xl font-bold">$<span id="walletModalBalance">5.00</span></div> </div> <div class="grid grid-cols-2 gap-3 mb-4"> <button onclick="showAddMoneyModal()" class="bg-gray-700 hover:bg-gray-600 p-3 rounded-lg flex flex-col items-center"> <i class="fas fa-plus-circle text-blue-400 text-xl mb-1"></i> <span>Add Money</span> </button> <button onclick="showWithdrawModal()" class="bg-gray-700 hover:bg-gray-600 p-3 rounded-lg flex flex-col items-center"> <i class="fas fa-minus-circle text-green-400 text-xl mb-1"></i> <span>Withdraw</span> </button> <button onclick="showSendMoneyModal()" class="bg-gray-700 hover:bg-gray-600 p-3 rounded-lg flex flex-col items-center"> <i class="fas fa-paper-plane text-purple-400 text-xl mb-1"></i> <span>Send Money</span> </button> <button onclick="showTransactionHistory()" class="bg-gray-700 hover:bg-gray-600 p-3 rounded-lg flex flex-col items-center"> <i class="fas fa-history text-yellow-400 text-xl mb-1"></i> <span>History</span> </button> </div> <div class="border-t border-gray-700 pt-4"> <h4 class="font-medium mb-2">Recent Transactions</h4> <div id="walletTransactions" class="space-y-3"> <!-- Transactions will be loaded here --> </div> </div> </div> </div> </div> <!-- Add Money Modal --> <div id="addMoneyModal" class="hidden fixed inset-0 bg-black bg-opacity-75 flex items-center justify-center z-50 p-4"> <div class="bg-gray-800 rounded-lg w-full max-w-md"> <div class="flex justify-between items-center border-b border-gray-700 p-4"> <h3 class="text-xl font-bold">Add Money to Wallet</h3> <button onclick="closeAddMoneyModal()" class="text-gray-400 hover:text-white"> <i class="fas fa-times"></i> </button> </div> <div class="p-4"> <div class="mb-4"> <label class="block text-gray-300 mb-2">Amount (USD)</label> <input type="number" id="addMoneyAmount" placeholder="10.00" class="w-full bg-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"> </div> <div class="mb-4"> <label class="block text-gray-300 mb-2">Payment Method</label> <select id="paymentMethod" class="w-full bg-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"> <option value="mobile_money">Mobile Money</option> <option value="card">Credit/Debit Card</option> <option value="bank">Bank Transfer</option> <option value="crypto">Cryptocurrency</option> </select> </div> <div id="mobileMoneyFields" class="space-y-3"> <div> <label class="block text-gray-300 mb-1">Mobile Money Provider</label> <select class="w-full bg-gray-700 rounded-lg px-4 py-2 focus:outline-none"> <option>MTN Mobile Money</option> <option>Airtel Money</option> <option>M-Pesa</option> <option>Orange Money</option> </select> </div> <div> <label class="block text-gray-300 mb-1">Phone Number</label> <input type="tel" placeholder="+256XXXXXXXXX" class="w-full bg-gray-700 rounded-lg px-4 py-2 focus:outline-none"> </div> </div> <div id="cardFields" class="space-y-3 hidden"> <div> <label class="block text-gray-300 mb-1">Card Number</label> <input type="text" placeholder="1234 5678 9012 3456" class="w-full bg-gray-700 rounded-lg px-4 py-2 focus:outline-none"> </div> <div class="grid grid-cols-2 gap-3"> <div> <label class="block text-gray-300 mb-1">Expiry Date</label> <input type="text" placeholder="MM/YY" class="w-full bg-gray-700 rounded-lg px-4 py-2 focus:outline-none"> </div> <div> <label class="block text-gray-300 mb-1">CVV</label> <input type="text" placeholder="123" class="w-full bg-gray-700 rounded-lg px-4 py-2 focus:outline-none"> </div> </div> </div> <button onclick="processPayment()" class="w-full bg-blue-600 hover:bg-blue-700 py-2 rounded-lg font-medium mt-4"> Add Money </button> </div> </div> </div> <!-- Send Money Modal --> <div id="sendMoneyModal" class="hidden fixed inset-0 bg-black bg-opacity-75 flex items-center justify-center z-50 p-4"> <div class="bg-gray-800 rounded-lg w-full max-w-md"> <div class="flex justify-between items-center border-b border-gray-700 p-4"> <h3 class="text-xl font-bold">Send Money</h3> <button onclick="closeSendMoneyModal()" class="text-gray-400 hover:text-white"> <i class="fas fa-times"></i> </button> </div> <div class="p-4"> <div class="mb-4"> <label class="block text-gray-300 mb-2">Recipient</label> <div class="flex"> <select id="recipientType" class="bg-gray-700 rounded-l-lg px-4 py-2 focus:outline-none"> <option value="user">AfricaLive User</option> <option value="mobile">Mobile Money</option> <option value="bank">Bank Account</option> </select> <input type="text" id="recipientInput" placeholder="Username, phone or account" class="flex-1 bg-gray-700 rounded-r-lg px-4 py-2 focus:outline-none"> </div> </div> <div class="mb-4"> <label class="block text-gray-300 mb-2">Amount (USD)</label> <input type="number" id="sendMoneyAmount" placeholder="10.00" class="w-full bg-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"> </div> <div class="mb-4"> <label class="block text-gray-300 mb-2">Message (Optional)</label> <textarea id="sendMoneyMessage" placeholder="What's this for?" class="w-full bg-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"></textarea> </div> <button onclick="sendMoney()" class="w-full bg-blue-600 hover:bg-blue-700 py-2 rounded-lg font-medium"> Send Money </button> </div> </div> </div> <!-- Donation Modal --> <div id="donationModal" class="hidden fixed inset-0 bg-black bg-opacity-75 flex items-center justify-center z-50 p-4"> <div class="bg-gray-800 rounded-lg w-full max-w-md"> <div class="flex justify-between items-center border-b border-gray-700 p-4"> <h3 class="text-xl font-bold">Support Creator</h3> <button onclick="closeDonationModal()" class="text-gray-400 hover:text-white"> <i class="fas fa-times"></i> </button> </div> <div class="p-4"> <div class="flex items-center mb-4"> <div class="w-12 h-12 rounded-full bg-gray-700 mr-3 overflow-hidden"> <img id="donationChannelImage" src="https://via.placeholder.com/100" alt="Channel" class="w-full h-full object-cover"> </div> <div> <h3 id="donationChannelName" class="font-medium"></h3> <p class="text-gray-400 text-sm">Live Stream: <span id="donationStreamTitle"></span></p> </div> </div> <div class="mb-4"> <label class="block text-gray-300 mb-2">Amount (USD)</label> <div class="grid grid-cols-4 gap-2"> <button onclick="setDonationAmount(1)" class="bg-gray-700 hover:bg-gray-600 py-2 rounded-lg">$1</button> <button onclick="setDonationAmount(5)" class="bg-gray-700 hover:bg-gray-600 py-2 rounded-lg">$5</button> <button onclick="setDonationAmount(10)" class="bg-gray-700 hover:bg-gray-600 py-2 rounded-lg">$10</button> <button onclick="setDonationAmount(20)" class="bg-gray-700 hover:bg-gray-600 py-2 rounded-lg">$20</button> </div> <input type="number" id="donationAmount" placeholder="Or enter custom amount" class="w-full bg-gray-700 rounded-lg px-4 py-2 mt-2 focus:outline-none focus:ring-2 focus:ring-blue-500"> </div> <div class="mb-4"> <label class="block text-gray-300 mb-2">Message (Optional)</label> <textarea id="donationMessage" placeholder="Say something nice!" class="w-full bg-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"></textarea> </div> <div class="flex items-center mb-4"> <input type="checkbox" id="showAnonymous" class="mr-2"> <label for="showAnonymous" class="text-gray-300">Send anonymously</label> </div> <button onclick="processDonation()" class="w-full bg-purple-600 hover:bg-purple-700 py-2 rounded-lg font-medium"> Send Donation </button> </div> </div> </div> <!-- Login Modal --> <div id="loginModal" class="hidden fixed inset-0 bg-black bg-opacity-75 flex items-center justify-center z-50 p-4"> <div class="bg-gray-800 rounded-lg w-full max-w-md"> <div class="flex justify-between items-center border-b border-gray-700 p-4"> <h3 class="text-xl font-bold">Welcome to AfricaLive</h3> <button onclick="closeLoginModal()" class="text-gray-400 hover:text-white"> <i class="fas fa-times"></i> </button> </div> <div class="p-4"> <div class="mb-4"> <label class="block text-gray-300 mb-2">Email or Username</label> <input type="text" id="loginUsername" placeholder="Enter your email or username" class="w-full bg-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"> </div> <div class="mb-4"> <label class="block text-gray-300 mb-2">Password</label> <input type="password" id="loginPassword" placeholder="Enter your password" class="w-full bg-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"> </div> <div class="flex items-center justify-between mb-4"> <div class="flex items-center"> <input type="checkbox" id="rememberMe" class="mr-2"> <label for="rememberMe" class="text-gray-300">Remember me</label> </div> <a href="#" class="text-blue-400 hover:underline text-sm">Forgot password?</a> </div> <button onclick="login()" class="w-full bg-red-600 hover:bg-red-700 py-2 rounded-lg font-medium mb-4"> Sign In </button> <div class="text-center text-gray-400 mb-4"> Don't have an account? <a href="#" class="text-blue-400 hover:underline" onclick="showRegisterModal()">Sign up</a> </div> <div class="flex items-center my-4"> <div class="flex-1 border-t border-gray-700"></div> <span class="px-4 text-gray-400">or</span> <div class="flex-1 border-t border-gray-700"></div> </div> <div class="grid grid-cols-2 gap-3"> <button class="bg-gray-700 hover:bg-gray-600 py-2 rounded-lg flex items-center justify-center"> <i class="fab fa-google mr-2"></i> Google </button> <button class="bg-gray-700 hover:bg-gray-600 py-2 rounded-lg flex items-center justify-center"> <i class="fab fa-facebook mr-2"></i> Facebook </button> </div> </div> </div> </div> <!-- Register Modal --> <div id="registerModal" class="hidden fixed inset-0 bg-black bg-opacity-75 flex items-center justify-center z-50 p-4"> <div class="bg-gray-800 rounded-lg w-full max-w-md"> <div class="flex justify-between items-center border-b border-gray-700 p-4"> <h3 class="text-xl font-bold">Create Account</h3> <button onclick="closeRegisterModal()" class="text-gray-400 hover:text-white"> <i class="fas fa-times"></i> </button> </div> <div class="p-4"> <div class="mb-4"> <label class="block text-gray-300 mb-2">Username</label> <input type="text" id="registerUsername" placeholder="Choose a username" class="w-full bg-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"> </div> <div class="mb-4"> <label class="block text-gray-300 mb-2">Email</label> <input type="email" id="registerEmail" placeholder="Enter your email" class="w-full bg-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"> </div> <div class="mb-4"> <label class="block text-gray-300 mb-2">Password</label> <input type="password" id="registerPassword" placeholder="Create a password" class="w-full bg-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"> </div> <div class="mb-4"> <label class="block text-gray-300 mb-2">Confirm Password</label> <input type="password" id="registerConfirmPassword" placeholder="Confirm your password" class="w-full bg-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"> </div> <div class="mb-4"> <label class="block text-gray-300 mb-2">Country</label> <select id="registerCountry" class="w-full bg-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"> <option value="">Select your country</option> <option value="NG">Nigeria</option> <option value="KE">Kenya</option> <option value="ZA">South Africa</option> <option value="GH">Ghana</option> <option value="EG">Egypt</option> <option value="ET">Ethiopia</option> <option value="TZ">Tanzania</option> <option value="UG">Uganda</option> <option value="DZ">Algeria</option> <option value="SD">Sudan</option> </select> </div> <div class="flex items-center mb-4"> <input type="checkbox" id="acceptTerms" class="mr-2"> <label for="acceptTerms" class="text-gray-300 text-sm">I agree to the <a href="#" class="text-blue-400 hover:underline">Terms of Service</a> and <a href="#" class="text-blue-400 hover:underline">Privacy Policy</a></label> </div> <button onclick="register()" class="w-full bg-red-600 hover:bg-red-700 py-2 rounded-lg font-medium mb-4"> Create Account </button> <div class="text-center text-gray-400"> Already have an account? <a href="#" class="text-blue-400 hover:underline" onclick="showLoginModal()">Sign in</a> </div> </div> </div> </div> <!-- Footer --> <footer class="bg-gray-800 py-8"> <div class="container mx-auto px-4"> <div class="grid grid-cols-1 md:grid-cols-4 gap-8"> <div> <h4 class="text-lg font-semibold mb-4">AfricaLive</h4> <p class="text-gray-400">Africa's premier video sharing and live streaming platform with integrated fintech services.</p> </div> <div> <h4 class="text-lg font-semibold mb-4">Company</h4> <ul class="space-y-2"> <li><a href="#" class="text-gray-400 hover:text-white">About</a></li> <li><a href="#" class="text-gray-400 hover:text-white">Careers</a></li> <li><a href="#" class="text-gray-400 hover:text-white">Press</a></li> <li><a href="#" class="text-gray-400 hover:text-white">Contact</a></li> </ul> </div> <div> <h4 class="text-lg font-semibold mb-4">Services</h4> <ul class="space-y-2"> <li><a href="#" class="text-gray-400 hover:text-white">Video Hosting</a></li> <li><a href="#" class="text-gray-400 hover:text-white">Live Streaming</a></li> <li><a href="#" class="text-gray-400 hover:text-white">AfricaLive Wallet</a></li> <li><a href="#" class="text-gray-400 hover:text-white">Money Transfers</a></li> </ul> </div> <div> <h4 class="text-lg font-semibold mb-4">Connect</h4> <div class="flex space-x-4 mb-4"> <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-facebook-f"></i></a> <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-twitter"></i></a> <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-instagram"></i></a> <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-linkedin-in"></i></a> </div> <div class="flex space-x-2"> <img src="https://via.placeholder.com/120x40/1E293B/FFFFFF?text=App+Store" alt="App Store" class="h-10"> <img src="https://via.placeholder.com/120x40/1E293B/FFFFFF?text=Google+Play" alt="Google Play" class="h-10"> </div> </div> </div> <div class="border-t border-gray-700 mt-8 pt-6 flex flex-col md:flex-row justify-between items-center"> <p class="text-gray-400 mb-4 md:mb-0">© 2023 AfricaLive. All rights reserved.</p> <div class="flex space-x-6"> <a href="#" class="text-gray-400 hover:text-white">Terms</a> <a href="#" class="text-gray-400 hover:text-white">Privacy</a> <a href="#" class="text-gray-400 hover:text-white">Cookies</a> </div> </div> </div> </footer> <!-- Mobile Bottom Navigation --> <div class="md:hidden fixed bottom-0 left-0 right-0 bg-gray-800 shadow-lg flex justify-around items-center py-3 z-40"> <a href="#" class="flex flex-col items-center text-white" onclick="loadHomePage()"> <i class="fas fa-home text-lg"></i> <span class="text-xs mt-1">Home</span> </a> <a href="#" class="flex flex-col items-center text-gray-400" onclick="loadExplorePage()"> <i class="fas fa-compass text-lg"></i> <span class="text-xs mt-1">Explore</span> </a> <a href="#" class="flex flex-col items-center text-gray-400" onclick="loadLiveNowPage()"> <i class="fas fa-broadcast-tower text-lg"></i> <span class="text-xs mt-1">Live</span> </a> <a href="#" class="flex flex-col items-center text-gray-400" onclick="showWallet()"> <i class="fas fa-wallet text-lg"></i> <span class="text-xs mt-1">Wallet</span> </a> <a href="#" class="flex flex-col items-center text-gray-400" onclick="navigateToChannel()"> <i class="fas fa-user text-lg"></i> <span class="text-xs mt-1">Account</span> </a> </div> <!-- Backend Simulation Script --> <script> // ============================================== // BACKEND SIMULATION // ============================================== // Database simulation const db = { users: [ { id: 1, username: 'demo', email: 'demo@africalive.com', password: 'demo123', // In real app, this would be hashed name: 'Demo User', country: 'NG', walletBalance: 5.00, avatar: 'https://randomuser.me/api/portraits/men/1.jpg', subscriptions: [2, 3], watchHistory: [], createdAt: new Date() } ], channels: [ { id: 1, userId: 1, name: 'Demo Channel', description: 'My personal channel', avatar: 'https://randomuser.me/api/portraits/men/1.jpg', banner: 'https://via.placeholder.com/800x200', subscribers: 42, isVerified: false, createdAt: new Date() }, { id: 2, userId: 2, name: 'AfroTech', description: 'African technology news and reviews', avatar: 'https://randomuser.me/api/portraits/women/2.jpg', banner: 'https://via.placeholder.com/800x200/4F46E5/FFFFFF', subscribers: 12500, isVerified: true, createdAt: new Date() }, { id: 3, userId: 3, name: 'NaijaComedy', description: 'Nigerian comedy at its finest', avatar: 'https://randomuser.me/api/portraits/men/3.jpg', banner: 'https://via.placeholder.com/800x200/1E40AF/FFFFFF', subscribers: 87200, isVerified: true, createdAt: new Date() } ], videos: [ { id: 1, channelId: 2, title: 'How to Send Money Across Africa with Zero Fees', description: 'Learn how to use AfricaLive Wallet to send money to any African country with no fees.', thumbnail: 'https://via.placeholder.com/320x180', duration: 754, // seconds views: 12000, likes: 950, dislikes: 12, comments: 42, isLive: false, category: 'fintech', tags: ['fintech', 'money', 'africa'], createdAt: new Date(Date.now() - 3 * 24 * 60 * 60 * 1000) }, { id: 2, channelId: 3, title: 'Nairobi Street Food Tour - Best Places to Eat', description: 'Join me as I explore the best street food spots in Nairobi!', thumbnail: 'https://via.placeholder.com/320x180/4F46E5/FFFFFF', duration: 1518, views: 45000, likes: 3200, dislikes: 45, comments: 213, isLive: false, category: 'food', tags: ['food', 'nairobi', 'travel'], createdAt: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000) }, { id: 3, channelId: 2, title: 'African Tech Startups to Watch in 2023', description: 'These are the most promising African tech startups this year.', thumbnail: 'https://via.placeholder.com/320x180/1E40AF/FFFFFF', duration: 512, views: 32000, likes: 2800, dislikes: 30, comments: 187, isLive: false, category: 'tech', tags: ['tech', 'startups', 'africa'], createdAt: new Date(Date.now() - 14 * 24 * 60 * 60 * 1000) } ], liveStreams: [ { id: 1, channelId: 2, title: 'Tech Talk Africa: Building Fintech for the Continent', description: 'Live discussion with fintech founders from across Africa', thumbnail: 'https://via.placeholder.com/640x360/4F46E5/FFFFFF', viewers: 8200, likes: 4200, category: 'fintech', streamKey: 'africalive-12345-67890', isActive: true, startedAt: new Date(Date.now() - 30 * 60 * 1000) }, { id: 2, channelId: 3, title: 'Afrobeat Live Concert - Burna Boy Performance', description: 'Live from Lagos, Nigeria - Burna Boy performing his greatest hits!', thumbnail: 'https://via.placeholder.com/640x360', viewers: 12500, likes: 9800, category: 'music', streamKey: 'africalive-54321-09876', isActive: true, startedAt: new Date(Date.now() - 45 * 60 * 1000) } ], transactions: [ { id: 1, userId: 1, amount: 5.00, type: 'deposit', method: 'mobile_money', status: 'completed', description: 'Initial wallet funding', createdAt: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000) }, { id: 2, userId: 1, amount: -2.50, type: 'donation', method: 'wallet', status: 'completed', description: 'Donation to AfroTech', recipientId: 2, createdAt: new Date(Date.now() - 3 * 24 * 60 * 60 * 1000) }, { id: 3, userId: 1, amount: -1.00, type: 'subscription', method: 'wallet', status: 'completed', description: 'Monthly subscription to NaijaComedy', recipientId: 3, createdAt: new Date(Date.now() - 1 * 24 * 60 * 60 * 1000) } ], notifications: [ { id: 1, userId: 1, title: 'New video from AfroTech', message: 'AfroTech just uploaded a new video: "African Tech Startups to Watch in 2023"', isRead: false, type: 'video', referenceId: 3, createdAt: new Date(Date.now() - 14 * 24 * 60 * 60 * 1000) }, { id: 2, userId: 1, title: 'Donation received', message: 'You received $5.00 from @techfan123', isRead: false, type: 'donation', referenceId: 2, createdAt: new Date(Date.now() - 3 * 24 * 60 * 60 * 1000) }, { id: 3, userId: 1, title: 'Stream starting soon', message: 'NaijaComedy is going live in 15 minutes: "Comedy Night Live"', isRead: false, type: 'stream', referenceId: 2, createdAt: new Date(Date.now() - 1 * 60 * 60 * 1000) } ] }; // Current user session let currentUser = null; // Simulate API functions const api = { // Authentication login: (username, password) => { return new Promise((resolve, reject) => { setTimeout(() => { const user = db.users.find(u => (u.username === username || u.email === username) && u.password === password ); if (user) { currentUser = user; resolve({ success: true, user }); } else { reject({ success: false, message: 'Invalid username or password' }); } }, 800); }); }, register: (userData) => { return new Promise((resolve, reject) => { setTimeout(() => { // Check if username or email already exists const usernameExists = db.users.some(u => u.username === userData.username); const emailExists = db.users.some(u => u.email === userData.email); if (usernameExists) { reject({ success: false, message: 'Username already exists' }); return; } if (emailExists) { reject({ success: false, message: 'Email already registered' }); return; } // Create new user const newUser = { id: db.users.length + 1, ...userData, walletBalance: 0, subscriptions: [], watchHistory: [], createdAt: new Date() }; db.users.push(newUser); currentUser = newUser; // Create default channel const newChannel = { id: db.channels.length + 1, userId: newUser.id, name: `${newUser.username}'s Channel`, description: 'My personal channel', avatar: newUser.avatar || 'https://via.placeholder.com/100', banner: 'https://via.placeholder.com/800x200', subscribers: 0, isVerified: false, createdAt: new Date() }; db.channels.push(newChannel); resolve({ success: true, user: newUser }); }, 1000); }); }, logout: () => { return new Promise((resolve) => { setTimeout(() => { currentUser = null; resolve({ success: true }); }, 300); }); }, // Videos getVideos: (options = {}) => { return new Promise((resolve) => { setTimeout(() => { let videos = [...db.videos]; if (options.category) { videos = videos.filter(v => v.category === options.category); } if (options.sort === 'trending') { videos.sort((a, b) => b.views - a.views); } else if (options.sort === 'newest') { videos.sort((a, b) => b.createdAt - a.createdAt); } if (options.limit) { videos = videos.slice(0, options.limit); } // Add channel info to each video const videosWithChannels = videos.map(video => { const channel = db.channels.find(c => c.id === video.channelId); return { ...video, channel }; }); resolve(videosWithChannels); }, 500); }); }, getVideoById: (id) => { return new Promise((resolve, reject) => { setTimeout(() => { const video = db.videos.find(v => v.id === id); if (video) { const channel = db.channels.find(c => c.id === video.channelId); resolve({ ...video, channel }); } else { reject({ success: false, message: 'Video not found' }); } }, 300); }); }, // Live Streams getLiveStreams: () => { return new Promise((resolve) => { setTimeout(() => { const activeStreams = db.liveStreams.filter(s => s.isActive); // Add channel info to each stream const streamsWithChannels = activeStreams.map(stream => { const channel = db.channels.find(c => c.id === stream.channelId); return { ...stream, channel }; }); resolve(streamsWithChannels); }, 500); }); }, startStream: (streamData) => { return new Promise((resolve) => { setTimeout(() => { const newStream = { id: db.liveStreams.length + 1, channelId: streamData.channelId, title: streamData.title, description: streamData.description || '', thumbnail: streamData.thumbnail || 'https://via.placeholder.com/640x360', viewers: 0, likes: 0, category: streamData.category || 'other', streamKey: `africalive-${Math.floor(Math.random() * 100000)}-${Math.floor(Math.random() * 100000)}`, isActive: true, startedAt: new Date() }; db.liveStreams.push(newStream); const channel = db.channels.find(c => c.id === streamData.channelId); resolve({ ...newStream, channel }); }, 1000); }); }, // Wallet getWalletBalance: (userId) => { return new Promise((resolve) => { setTimeout(() => { const user = db.users.find(u => u.id === userId); resolve(user ? user.walletBalance : 0); }, 300); }); }, addToWallet: (userId, amount) => { return new Promise((resolve) => { setTimeout(() => { const user = db.users.find(u => u.id === userId); if (user) { user.walletBalance += amount; // Record transaction const newTransaction = { id: db.transactions.length + 1, userId, amount, type: 'deposit', method: 'mobile_money', status: 'completed', description: 'Wallet top-up', createdAt: new Date() }; db.transactions.push(newTransaction); resolve({ success: true, newBalance: user.walletBalance }); } else { resolve({ success: false, message: 'User not found' }); } }, 800); }); }, sendMoney: (senderId, recipientId, amount, message = '') => { return new Promise((resolve) => { setTimeout(() => { const sender = db.users.find(u => u.id === senderId); const recipient = db.users.find(u => u.id === recipientId); if (!sender || !recipient) { resolve({ success: false, message: 'User not found' }); return; } if (sender.walletBalance < amount) { resolve({ success: false, message: 'Insufficient funds' }); return; } // Deduct from sender sender.walletBalance -= amount; // Add to recipient recipient.walletBalance += amount; // Record transaction for sender const senderTransaction = { id: db.transactions.length + 1, userId: senderId, amount: -amount, type: 'transfer', method: 'wallet', status: 'completed', description: message || 'Money transfer', recipientId, createdAt: new Date() }; // Record transaction for recipient const recipientTransaction = { id: db.transactions.length + 2, userId: recipientId, amount, type: 'transfer', method: 'wallet', status: 'completed', description: message || 'Money received', senderId, createdAt: new Date() }; db.transactions.push(senderTransaction, recipientTransaction); resolve({ success: true, newBalance: sender.walletBalance }); }, 1000); }); }, donateToStream: (donorId, streamId, amount, message = '', isAnonymous = false) => { return new Promise((resolve) => { setTimeout(() => { const donor = db.users.find(u => u.id === donorId); const stream = db.liveStreams.find(s => s.id === streamId); if (!donor || !stream) { resolve({ success: false, message: 'Not found' }); return; } if (donor.walletBalance < amount) { resolve({ success: false, message: 'Insufficient funds' }); return; } // Deduct from donor donor.walletBalance -= amount; // Add to streamer (channel owner) const channel = db.channels.find(c => c.id === stream.channelId); const streamer = db.users.find(u => u.id === channel.userId); streamer.walletBalance += amount; // Record transaction for donor const donorTransaction = { id: db.transactions.length + 1, userId: donorId, amount: -amount, type: 'donation', method: 'wallet', status: 'completed', description: `Donation to ${channel.name}`, recipientId: streamer.id, referenceId: streamId, createdAt: new Date() }; // Record transaction for streamer const streamerTransaction = { id: db.transactions.length + 2, userId: streamer.id, amount, type: 'donation', method: 'wallet', status: 'completed', description: `Donation from ${isAnonymous ? 'Anonymous' : donor.username}`, senderId: isAnonymous ? null : donorId, referenceId: streamId, createdAt: new Date() }; db.transactions.push(donorTransaction, streamerTransaction); // Add notification for streamer const notification = { id: db.notifications.length + 1, userId: streamer.id, title: 'New donation received', message: `You received $${amount.toFixed(2)} ${isAnonymous ? 'from Anonymous' : 'from ' + donor.username}`, isRead: false, type: 'donation', referenceId: streamId, createdAt: new Date() }; db.notifications.push(notification); resolve({ success: true, newBalance: donor.walletBalance, donorTransaction, streamerTransaction }); }, 800); }); }, // Subscriptions getSubscriptions: (userId) => { return new Promise((resolve) => { setTimeout(() => { const user = db.users.find(u => u.id === userId); if (!user) { resolve([]); return; } const subscriptions = user.subscriptions.map(channelId => { return db.channels.find(c => c.id === channelId); }).filter(Boolean); resolve(subscriptions); }, 300); }); }, toggleSubscription: (userId, channelId) => { return new Promise((resolve) => { setTimeout(() => { const user = db.users.find(u => u.id === userId); const channel = db.channels.find(c => c.id === channelId); if (!user || !channel) { resolve({ success: false, message: 'Not found' }); return; } const subscriptionIndex = user.subscriptions.indexOf(channelId); let isSubscribed = false; if (subscriptionIndex === -1) { // Subscribe user.subscriptions.push(channelId); channel.subscribers += 1; isSubscribed = true; } else { // Unsubscribe user.subscriptions.splice(subscriptionIndex, 1); channel.subscribers -= 1; isSubscribed = false; } resolve({ success: true, isSubscribed, subscribers: channel.subscribers }); }, 500); }); }, // Notifications getNotifications: (userId) => { return new Promise((resolve) => { setTimeout(() => { const notifications = db.notifications .filter(n => n.userId === userId) .sort((a, b) => b.createdAt - a.createdAt); resolve(notifications); }, 300); }); }, markNotificationAsRead: (notificationId) => { return new Promise((resolve) => { setTimeout(() => { const notification = db.notifications.find(n => n.id === notificationId); if (notification) { notification.isRead = true; resolve({ success: true }); } else { resolve({ success: false }); } }, 200); }); }, markAllNotificationsAsRead: (userId) => { return new Promise((resolve) => { setTimeout(() => { db.notifications .filter(n => n.userId === userId && !n.isRead) .forEach(n => n.isRead = true); resolve({ success: true }); }, 300); }); } }; // ============================================== // FRONTEND FUNCTIONALITY // ============================================== // DOM Elements const elements = { mainContent: document.getElementById('mainContent'), userMenu: document.getElementById('userMenu'), userMenuButton: document.getElementById('userMenuButton'), userInitial: document.getElementById('userInitial'), walletBalance: document.getElementById('walletBalance'), notificationsPanel: document.getElementById('notificationsPanel'), notificationsList: document.getElementById('notificationsList'), subscriptionsList: document.getElementById('subscriptionsList'), videoPlayerModal: document.getElementById('videoPlayerModal'), videoPlayer: document.getElementById('videoPlayer'), videoPlayerTitle: document.getElementById('videoPlayerTitle'), videoTitle: document.getElementById('videoTitle'), videoChannelName: document.getElementById('videoChannelName'), videoChannelImage: document.getElementById('videoChannelImage'), videoStats: document.getElementById('videoStats'), likeCount: document.getElementById('likeCount'), dislikeCount: document.getElementById('dislikeCount'), viewCount: document.getElementById('viewCount'), subscribeBtn: document.getElementById('subscribeBtn'), liveChatModal: document.getElementById('liveChatModal'), liveChatMessages: document.getElementById('liveChatMessages'), chatMessageInput: document.getElementById('chatMessageInput'), goLiveModal: document.getElementById('goLiveModal'), streamTitle: document.getElementById('streamTitle'), streamCategory: document.getElementById('streamCategory'), thumbnailUpload: document.getElementById('thumbnailUpload'), thumbnailPreview: document.getElementById('thumbnailPreview'), previewImage: document.getElementById('previewImage'), streamKey: document.getElementById('streamKey'), walletModal: document.getElementById('walletModal'), walletModalBalance: document.getElementById('walletModalBalance'), walletTransactions: document.getElementById('walletTransactions'), addMoneyModal: document.getElementById('addMoneyModal'), addMoneyAmount: document.getElementById('addMoneyAmount'), paymentMethod: document.getElementById('paymentMethod'), mobileMoneyFields: document.getElementById('mobileMoneyFields'), cardFields: document.getElementById('cardFields'), sendMoneyModal: document.getElementById('sendMoneyModal'), sendMoneyAmount: document.getElementById('sendMoneyAmount'), recipientType: document.getElementById('recipientType'), recipientInput: document.getElementById('recipientInput'), sendMoneyMessage: document.getElementById('sendMoneyMessage'), donationModal: document.getElementById('donationModal'), donationAmount: document.getElementById('donationAmount'), donationMessage: document.getElementById('donationMessage'), donationChannelImage: document.getElementById('donationChannelImage'), donationChannelName: document.getElementById('donationChannelName'), donationStreamTitle: document.getElementById('donationStreamTitle'), showAnonymous: document.getElementById('showAnonymous'), loginModal: document.getElementById('loginModal'), loginUsername: document.getElementById('loginUsername'), loginPassword: document.getElementById('loginPassword'), rememberMe: document.getElementById('rememberMe'), registerModal: document.getElementById('registerModal'), registerUsername: document.getElementById('registerUsername'), registerEmail: document.getElementById('registerEmail'), registerPassword: document.getElementById('registerPassword'), registerConfirmPassword: document.getElementById('registerConfirmPassword'), registerCountry: document.getElementById('registerCountry'), acceptTerms: document.getElementById('acceptTerms'), mobileSearch: document.getElementById('mobileSearch'), searchInput: document.getElementById('searchInput') }; // State let state = { currentVideo: null, currentStream: null, isSubscribed: false, chatMessages: [], activeDonation: null }; // Initialize the app function init() { // Check for logged in user const rememberedUser = localStorage.getItem('africalive_user'); if (rememberedUser) { try { const user = JSON.parse(rememberedUser); api.login(user.username, user.password) .then(() => { loadHomePage(); updateUserUI(); }) .catch(() => { localStorage.removeItem('africalive_user'); showLoginModal(); }); } catch (e) { localStorage.removeItem('africalive_user'); showLoginModal(); } } else { showLoginModal(); } // Event listeners elements.userMenuButton.addEventListener('click', toggleUserMenu); document.addEventListener('click', closeMenusOnClickOutside); elements.thumbnailUpload.addEventListener('change', handleThumbnailUpload); elements.paymentMethod.addEventListener('change', togglePaymentFields); elements.recipientType.addEventListener('change', updateRecipientPlaceholder); // Load home page if no hash if (!window.location.hash) { loadHomePage(); } else { handleRouteChange(); } // Handle route changes window.addEventListener('hashchange', handleRouteChange); } // Route handling function handleRouteChange() { const hash = window.location.hash.substring(1); if (hash.startsWith('video=')) { const videoId = parseInt(hash.split('=')[1]); playVideo(videoId); } else if (hash.startsWith('live=')) { const streamId = parseInt(hash.split('=')[1]); watchLiveStream(streamId); } else if (hash === 'login') { showLoginModal(); } else if (hash === 'register') { showRegisterModal(); } else if (hash === 'home') { loadHomePage(); } else if (hash === 'explore') { loadExplorePage(); } else if (hash === 'trending') { loadTrendingPage(); } else if (hash === 'subscriptions') { loadSubscriptionsPage(); } else if (hash === 'live') { loadLiveNowPage(); } else if (hash === 'wallet') { showWallet(); } else if (hash === 'send-money') { showSendMoneyModal(); } else if (hash === 'donate') { if (state.activeDonation) { showDonationModal(state.activeDonation.streamId, state.activeDonation.channelId); } } } // Navigation functions function loadHomePage() { window.location.hash = 'home'; api.getVideos({ limit: 8, sort: 'newest' }) .then(videos => { api.getLiveStreams() .then(streams => { renderHomePage(videos, streams); }); }); } function loadExplorePage() { window.location.hash = 'explore'; api.getVideos({ limit: 12 }) .then(videos => { renderExplorePage(videos); }); } function loadTrendingPage() { window.location.hash = 'trending'; api.getVideos({ sort: 'trending' }) .then(videos => { renderTrendingPage(videos); }); } function loadSubscriptionsPage() { window.location.hash = 'subscriptions'; if (!currentUser) { showLoginModal(); return; } api.getVideos() .then(videos => { // Filter videos from subscribed channels const subscribedVideos = videos.filter(video => currentUser.subscriptions.includes(video.channelId) ); renderSubscriptionsPage(subscribedVideos); }); } function loadLiveNowPage() { window.location.hash = 'live'; api.getLiveStreams() .then(streams => { renderLiveNowPage(streams); }); } function loadCategory(category) { window.location.hash = `category=${category}`; api.getVideos({ category }) .then(videos => { renderCategoryPage(category, videos); }); } // Page rendering functions function renderHomePage(videos, streams) { let html = ` <section class="mb-8"> <div class="flex items-center justify-between mb-4"> <h2 class="text-xl font-bold">Live Now <span class="text-red-500 ml-2"><i class="fas fa-broadcast-tower"></i></span></h2> <a href="#live" class="text-blue-400 hover:underline"> </html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AfricaLive - Video Streaming & Live Content Platform</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
/* Custom CSS */
.video-thumbnail { transition: transform 0.3s ease; }
.video-thumbnail:hover { transform: scale(1.03); }
.live-indicator { animation: pulse 2s infinite; }
@keyframes pulse {
0% { opacity: 1; }
50% { opacity: 0.5; }
100% { opacity: 1; }
}
.gradient-bg { background: linear-gradient(135deg, #4F46E5 0%, #1E40AF 100%); }
.sidebar {
scrollbar-width: thin;
scrollbar-color: #4B5563 #1F2937;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: #1F2937; }
.sidebar::-webkit-scrollbar-thumb { background-color: #4B5563; border-radius: 3px; }
#videoPlayer { width: 100%; height: 0; padding-bottom: 56.25%; position: relative; }
#videoPlayer iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
</style>
</head>
<body class="bg-gray-900 text-white">
<!-- Header/Navigation -->
<header class="bg-gray-800 shadow-lg sticky top-0 z-50">
<div class="container mx-auto px-4 py-3 flex items-center justify-between">
<div class="flex items-center space-x-4 flex-1">
<div class="flex items-center cursor-pointer" onclick="window.location.href='#'">
<i class="fas fa-play-circle text-red-500 text-3xl mr-2"></i>
<span class="text-xl font-bold">Africa<span class="text-red-500">Live</span></span>
</div>
<div class="hidden md:flex flex-1 max-w-2xl mx-4">
<div class="relative w-full">
<input type="text" id="searchInput" placeholder="Search videos, channels, or categories"
class="w-full bg-gray-700 rounded-l-full py-2 px-4 focus:outline-none focus:ring-2 focus:ring-red-500">
<button onclick="searchContent()" class="absolute right-0 top-0 h-full bg-gray-600 rounded-r-full px-4 hover:bg-gray-500">
<i class="fas fa-search"></i>
</button>
</div>
</div>
</div>
<div class="flex items-center space-x-4">
<button class="md:hidden text-xl" onclick="toggleMobileSearch()">
<i class="fas fa-search"></i>
</button>
<button class="p-2 rounded-full hover:bg-gray-700" onclick="showGoLiveModal()">
<i class="fas fa-video"></i>
</button>
<button class="p-2 rounded-full hover:bg-gray-700 relative" onclick="toggleNotifications()">
<i class="fas fa-bell"></i>
<span class="absolute top-0 right-0 w-2 h-2 bg-red-500 rounded-full"></span>
</button>
<button id="userMenuButton" class="flex items-center space-x-1">
<div class="w-8 h-8 rounded-full bg-red-500 flex items-center justify-center">
<span class="font-semibold" id="userInitial">U</span>
</div>
</button>
</div>
</div>
<!-- Mobile Search (hidden by default) -->
<div id="mobileSearch" class="hidden md:hidden px-4 py-2 bg-gray-800">
<div class="relative">
<input type="text" placeholder="Search..." class="w-full bg-gray-700 rounded-full py-2 px-4 pl-10 focus:outline-none focus:ring-2 focus:ring-red-500">
<button class="absolute left-3 top-2.5 text-gray-400">
<i class="fas fa-search"></i>
</button>
</div>
</div>
</header>
<!-- User Dropdown Menu -->
<div id="userMenu" class="hidden absolute right-4 mt-2 w-48 bg-gray-800 rounded-md shadow-lg z-50 py-1">
<a href="#" class="block px-4 py-2 hover:bg-gray-700" onclick="navigateToChannel()"><i class="fas fa-user mr-2"></i> Your Channel</a>
<a href="#" class="block px-4 py-2 hover:bg-gray-700" onclick="showWallet()"><i class="fas fa-wallet mr-2"></i> Wallet: $<span id="walletBalance">5.00</span></a>
<a href="#" class="block px-4 py-2 hover:bg-gray-700" onclick="showSettings()"><i class="fas fa-cog mr-2"></i> Settings</a>
<a href="#" class="block px-4 py-2 hover:bg-gray-700" onclick="logout()"><i class="fas fa-sign-out-alt mr-2"></i> Sign Out</a>
</div>
<!-- Notifications Panel -->
<div id="notificationsPanel" class="hidden absolute right-4 mt-2 w-72 bg-gray-800 rounded-md shadow-lg z-50 py-1 max-h-96 overflow-y-auto">
<div class="px-4 py-2 border-b border-gray-700 flex justify-between items-center">
<h3 class="font-medium">Notifications</h3>
<button class="text-blue-400 text-sm" onclick="markAllAsRead()">Mark all as read</button>
</div>
<div id="notificationsList">
<!-- Notifications will be populated here -->
</div>
</div>