Spaces:
Running
Running
Download admin.html from levitee/deepsite-project-2w4sv: direct link, hf CLI and curl.
- Browser
- Download file 26.8 kB
-
https://huggingface.co/spaces/levitee/deepsite-project-2w4sv/resolve/main/admin.html
- Command line
-
hf download hf://spaces/levitee/deepsite-project-2w4sv/admin.html
-
curl -L -o admin.html https://huggingface.co/spaces/levitee/deepsite-project-2w4sv/resolve/main/admin.html
26.8 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Admin Dashboard - Free Sites 4 You</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://unpkg.com/lucide@latest"></script> | |
| <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet"> | |
| <style> | |
| body { font-family: 'Inter', sans-serif; } | |
| .gradient-bg { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); } | |
| .sidebar-active { background-color: rgba(255,255,255,0.1); border-left: 4px solid white; } | |
| </style> | |
| </head> | |
| <body class="bg-gray-100"> | |
| <!-- Admin Check --> | |
| <script> | |
| if (!sessionStorage.getItem('adminLoggedIn')) { | |
| window.location.href = 'login.html'; | |
| } | |
| </script> | |
| <div class="flex h-screen overflow-hidden"> | |
| <!-- Sidebar --> | |
| <div class="w-64 gradient-bg text-white flex flex-col"> | |
| <div class="p-6 border-b border-purple-500"> | |
| <div class="flex items-center"> | |
| <i data-lucide="shield" class="w-8 h-8 mr-2"></i> | |
| <span class="text-xl font-bold">Admin Panel</span> | |
| </div> | |
| <p class="text-sm text-purple-200 mt-1" id="adminEmailDisplay"></p> | |
| </div> | |
| <nav class="flex-1 py-4"> | |
| <button onclick="showSection('sites')" id="navSites" class="w-full flex items-center px-6 py-3 hover:bg-white/10 transition sidebar-active"> | |
| <i data-lucide="globe" class="w-5 h-5 mr-3"></i> | |
| Manage Sites | |
| </button> | |
| <button onclick="showSection('ads')" id="navAds" class="w-full flex items-center px-6 py-3 hover:bg-white/10 transition"> | |
| <i data-lucide="megaphone" class="w-5 h-5 mr-3"></i> | |
| Manage Ads | |
| </button> | |
| <button onclick="showSection('subscribers')" id="navSubscribers" class="w-full flex items-center px-6 py-3 hover:bg-white/10 transition"> | |
| <i data-lucide="users" class="w-5 h-5 mr-3"></i> | |
| Subscribers <span id="subscriberCount" class="ml-auto bg-purple-500 text-xs px-2 py-1 rounded-full hidden">0</span> | |
| </button> | |
| <button onclick="showSection('stats')" id="navStats" class="w-full flex items-center px-6 py-3 hover:bg-white/10 transition"> | |
| <i data-lucide="bar-chart-2" class="w-5 h-5 mr-3"></i> | |
| Statistics | |
| </button> | |
| </nav> | |
| <div class="p-4 border-t border-purple-500"> | |
| <button onclick="logout()" class="w-full flex items-center px-4 py-2 bg-red-500 hover:bg-red-600 rounded-lg transition"> | |
| <i data-lucide="log-out" class="w-5 h-5 mr-2"></i> | |
| Logout | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Main Content --> | |
| <div class="flex-1 overflow-y-auto"> | |
| <!-- Header --> | |
| <div class="bg-white shadow-sm p-6 flex justify-between items-center"> | |
| <h1 class="text-2xl font-bold text-gray-800">Dashboard</h1> | |
| <div class="flex items-center space-x-4"> | |
| <a href="index.html" target="_blank" class="text-purple-600 hover:text-purple-800 flex items-center"> | |
| <i data-lucide="external-link" class="w-4 h-4 mr-1"></i> | |
| View Site | |
| </a> | |
| </div> | |
| </div> | |
| <!-- Sites Management Section --> | |
| <div id="sectionSites" class="p-6"> | |
| <div class="bg-white rounded-lg shadow-lg p-6 mb-6"> | |
| <h2 class="text-xl font-bold mb-4 flex items-center"> | |
| <i data-lucide="plus-circle" class="w-6 h-6 mr-2 text-green-500"></i> | |
| Add New Site | |
| </h2> | |
| <form id="addSiteForm" class="grid grid-cols-1 md:grid-cols-2 gap-4"> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Site Name</label> | |
| <input type="text" id="siteName" required class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-purple-600 outline-none"> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Category</label> | |
| <select id="siteCategory" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-purple-600 outline-none"> | |
| <option value="ai">AI Tools</option> | |
| <option value="design">Design</option> | |
| <option value="audio">Audio/Music</option> | |
| <option value="gaming">Gaming</option> | |
| <option value="commerce">E-Commerce</option> | |
| <option value="sports">Sports</option> | |
| <option value="productivity">Productivity</option> | |
| </select> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">URL</label> | |
| <input type="url" id="siteUrl" required placeholder="https://example.com" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-purple-600 outline-none"> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Replaces (Paid Tool)</label> | |
| <input type="text" id="siteReplaces" placeholder="e.g., Canva, ChatGPT" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-purple-600 outline-none"> | |
| </div> | |
| <div class="md:col-span-2"> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Description</label> | |
| <textarea id="siteDescription" rows="2" required class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-purple-600 outline-none"></textarea> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Image URL (optional)</label> | |
| <input type="url" id="siteImage" placeholder="http://static.photos/tech/640x360/1" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-purple-600 outline-none"> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Affiliate Link (optional)</label> | |
| <input type="url" id="siteAffiliate" placeholder="https://affiliate-link.com" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-purple-600 outline-none"> | |
| </div> | |
| <div class="md:col-span-2"> | |
| <button type="submit" class="bg-purple-600 text-white px-6 py-2 rounded-lg hover:bg-purple-700 transition flex items-center"> | |
| <i data-lucide="save" class="w-4 h-4 mr-2"></i> | |
| Add Site | |
| </button> | |
| </div> | |
| </form> | |
| </div> | |
| <div class="bg-white rounded-lg shadow-lg p-6"> | |
| <h2 class="text-xl font-bold mb-4">Existing Sites</h2> | |
| <div id="sitesList" class="space-y-4"> | |
| <!-- Sites will be listed here --> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Ads Management Section --> | |
| <div id="sectionAds" class="p-6 hidden"> | |
| <div class="bg-white rounded-lg shadow-lg p-6 mb-6"> | |
| <h2 class="text-xl font-bold mb-4 flex items-center"> | |
| <i data-lucide="megaphone" class="w-6 h-6 mr-2 text-orange-500"></i> | |
| Add New Advertisement | |
| </h2> | |
| <form id="addAdForm" class="space-y-4"> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4"> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Ad Title</label> | |
| <input type="text" id="adTitle" required class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-purple-600 outline-none"> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Advertiser Name</label> | |
| <input type="text" id="adAdvertiser" required class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-purple-600 outline-none"> | |
| </div> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Ad Content / HTML</label> | |
| <textarea id="adContent" rows="3" required placeholder="<a href='...'><img src='...'></a>" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-purple-600 outline-none font-mono text-sm"></textarea> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Ad Position</label> | |
| <select id="adPosition" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-purple-600 outline-none"> | |
| <option value="top">Top Banner</option> | |
| <option value="sidebar1">Sidebar 1</option> | |
| <option value="sidebar2">Sidebar 2</option> | |
| <option value="bottom">Bottom Banner</option> | |
| </select> | |
| </div> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4"> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Start Date</label> | |
| <input type="date" id="adStartDate" required class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-purple-600 outline-none"> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">End Date</label> | |
| <input type="date" id="adEndDate" required class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-purple-600 outline-none"> | |
| </div> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Price Tier</label> | |
| <div class="grid grid-cols-3 gap-2 mb-2"> | |
| <label class="flex items-center p-2 border rounded cursor-pointer hover:bg-gray-50"> | |
| <input type="radio" name="adPriceTier" value="5" class="mr-2" onchange="setAdPrice(5)"> | |
| <span class="text-sm">1 Week<br><strong>$5</strong></span> | |
| </label> | |
| <label class="flex items-center p-2 border rounded cursor-pointer hover:bg-gray-50"> | |
| <input type="radio" name="adPriceTier" value="10" class="mr-2" onchange="setAdPrice(10)"> | |
| <span class="text-sm">3 Weeks<br><strong>$10</strong></span> | |
| </label> | |
| <label class="flex items-center p-2 border-2 border-orange-400 bg-orange-50 rounded cursor-pointer"> | |
| <input type="radio" name="adPriceTier" value="15" class="mr-2" onchange="setAdPrice(15)" checked> | |
| <span class="text-sm">1 Month<br><strong>$15</strong></span> | |
| </label> | |
| </div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Custom Price ($)</label> | |
| <input type="number" id="adPrice" step="0.01" value="15" required class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-purple-600 outline-none"> | |
| <p class="text-xs text-gray-500 mt-1">Standard pricing: $5/week, $10/3weeks, $15/month</p> | |
| </div> | |
| <button type="submit" class="bg-orange-500 text-white px-6 py-2 rounded-lg hover:bg-orange-600 transition flex items-center"> | |
| <i data-lucide="plus" class="w-4 h-4 mr-2"></i> | |
| Add Advertisement | |
| </button> | |
| </form> | |
| </div> | |
| <div class="bg-white rounded-lg shadow-lg p-6"> | |
| <h2 class="text-xl font-bold mb-4">Active Advertisements</h2> | |
| <div id="adsList" class="space-y-4"> | |
| <!-- Ads will be listed here --> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Subscribers Section --> | |
| <div id="sectionSubscribers" class="p-6 hidden"> | |
| <div class="bg-white rounded-lg shadow-lg p-6"> | |
| <h2 class="text-xl font-bold mb-4 flex items-center"> | |
| <i data-lucide="mail" class="w-6 h-6 mr-2 text-indigo-500"></i> | |
| Email Subscribers | |
| </h2> | |
| <div class="mb-4 p-4 bg-indigo-50 rounded-lg"> | |
| <p class="text-sm text-indigo-800"> | |
| <i data-lucide="info" class="w-4 h-4 inline-block mr-1"></i> | |
| Total subscribers collected through the website signup form. | |
| </p> | |
| </div> | |
| <div id="subscribersList" class="space-y-4"> | |
| <!-- Subscribers will be listed here --> | |
| </div> | |
| <div id="noSubscribers" class="text-center py-8 text-gray-500 hidden"> | |
| <i data-lucide="inbox" class="w-12 h-12 mx-auto mb-2 text-gray-300"></i> | |
| <p>No subscribers yet.</p> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Statistics Section --> | |
| <div id="sectionStats" class="p-6 hidden"> | |
| <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6"> | |
| <div class="bg-white rounded-lg shadow-lg p-6 text-center"> | |
| <i data-lucide="globe" class="w-12 h-12 text-purple-600 mx-auto mb-2"></i> | |
| <h3 class="text-3xl font-bold text-gray-800" id="totalSites">0</h3> | |
| <p class="text-gray-600">Total Sites</p> | |
| </div> | |
| <div class="bg-white rounded-lg shadow-lg p-6 text-center"> | |
| <i data-lucide="megaphone" class="w-12 h-12 text-orange-500 mx-auto mb-2"></i> | |
| <h3 class="text-3xl font-bold text-gray-800" id="totalAds">0</h3> | |
| <p class="text-gray-600">Active Ads</p> | |
| </div> | |
| <div class="bg-white rounded-lg shadow-lg p-6 text-center"> | |
| <i data-lucide="dollar-sign" class="w-12 h-12 text-green-500 mx-auto mb-2"></i> | |
| <h3 class="text-3xl font-bold text-gray-800" id="totalRevenue">$0</h3> | |
| <p class="text-gray-600">Total Revenue</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| // Initialize data | |
| let sites = JSON.parse(localStorage.getItem('sites')) || []; | |
| let ads = JSON.parse(localStorage.getItem('ads')) || []; | |
| // Set default admin email | |
| document.getElementById('adminEmailDisplay').textContent = sessionStorage.getItem('adminEmail') || 'levytmwale@gmail.com'; | |
| function showSection(section) { | |
| // Hide all sections | |
| document.getElementById('sectionSites').classList.add('hidden'); | |
| document.getElementById('sectionAds').classList.add('hidden'); | |
| document.getElementById('sectionSubscribers').classList.add('hidden'); | |
| document.getElementById('sectionStats').classList.add('hidden'); | |
| // Remove active classes | |
| document.getElementById('navSites').classList.remove('sidebar-active'); | |
| document.getElementById('navAds').classList.remove('sidebar-active'); | |
| document.getElementById('navSubscribers').classList.remove('sidebar-active'); | |
| document.getElementById('navStats').classList.remove('sidebar-active'); | |
| // Show selected section | |
| document.getElementById('section' + section.charAt(0).toUpperCase() + section.slice(1)).classList.remove('hidden'); | |
| document.getElementById('nav' + section.charAt(0).toUpperCase() + section.slice(1)).classList.add('sidebar-active'); | |
| if (section === 'stats') updateStats(); | |
| if (section === 'subscribers') renderSubscribers(); | |
| } | |
| function setAdPrice(amount) { | |
| document.getElementById('adPrice').value = amount; | |
| } | |
| function renderSubscribers() { | |
| const subscribers = JSON.parse(localStorage.getItem('subscribers') || '[]'); | |
| const container = document.getElementById('subscribersList'); | |
| const noDataMsg = document.getElementById('noSubscribers'); | |
| const countBadge = document.getElementById('subscriberCount'); | |
| countBadge.textContent = subscribers.length; | |
| if (subscribers.length > 0) { | |
| countBadge.classList.remove('hidden'); | |
| } | |
| if (subscribers.length === 0) { | |
| container.innerHTML = ''; | |
| noDataMsg.classList.remove('hidden'); | |
| return; | |
| } | |
| noDataMsg.classList.add('hidden'); | |
| container.innerHTML = subscribers.map(sub => { | |
| const interestMap = { | |
| 'pricing': 'Advertising Pricing', | |
| 'new-tools': 'New Free Tools', | |
| 'both': 'Both Updates', | |
| 'partnerships': 'Partnerships' | |
| }; | |
| const date = new Date(sub.date).toLocaleDateString(); | |
| return ` | |
| <div class="border rounded-lg p-4 hover:bg-gray-50"> | |
| <div class="flex justify-between items-start"> | |
| <div class="flex-1"> | |
| <h3 class="font-bold text-lg text-indigo-600">${sub.name}</h3> | |
| <p class="text-sm text-gray-600">${sub.email}</p> | |
| <p class="text-sm text-gray-500 mt-1">Interest: ${interestMap[sub.interest] || sub.interest}</p> | |
| <p class="text-xs text-gray-400 mt-1">Subscribed: ${date}</p> | |
| </div> | |
| <button onclick="deleteSubscriber(${sub.id})" class="ml-4 text-red-500 hover:text-red-700"> | |
| <i data-lucide="trash-2" class="w-5 h-5"></i> | |
| </button> | |
| </div> | |
| </div> | |
| `; | |
| }).join(''); | |
| lucide.createIcons(); | |
| } | |
| function deleteSubscriber(id) { | |
| if (confirm('Remove this subscriber?')) { | |
| let subscribers = JSON.parse(localStorage.getItem('subscribers') || '[]'); | |
| subscribers = subscribers.filter(s => s.id !== id); | |
| localStorage.setItem('subscribers', JSON.stringify(subscribers)); | |
| renderSubscribers(); | |
| } | |
| } | |
| function logout() { | |
| sessionStorage.removeItem('adminLoggedIn'); | |
| sessionStorage.removeItem('adminEmail'); | |
| window.location.href = 'login.html'; | |
| } | |
| // Sites Management | |
| document.getElementById('addSiteForm').addEventListener('submit', function(e) { | |
| e.preventDefault(); | |
| const site = { | |
| id: Date.now(), | |
| name: document.getElementById('siteName').value, | |
| category: document.getElementById('siteCategory').value, | |
| url: document.getElementById('siteUrl').value, | |
| replaces: document.getElementById('siteReplaces').value, | |
| description: document.getElementById('siteDescription').value, | |
| image: document.getElementById('siteImage').value || 'http://static.photos/tech/640x360/' + Math.floor(Math.random() * 100), | |
| affiliate: document.getElementById('siteAffiliate').value | |
| }; | |
| sites.push(site); | |
| localStorage.setItem('sites', JSON.stringify(sites)); | |
| this.reset(); | |
| renderSites(); | |
| alert('Site added successfully!'); | |
| }); | |
| function renderSites() { | |
| const container = document.getElementById('sitesList'); | |
| if (sites.length === 0) { | |
| container.innerHTML = '<p class="text-gray-500 text-center py-4">No sites added yet.</p>'; | |
| return; | |
| } | |
| container.innerHTML = sites.map(site => ` | |
| <div class="border rounded-lg p-4 flex justify-between items-start hover:bg-gray-50"> | |
| <div class="flex-1"> | |
| <h3 class="font-bold text-lg text-purple-600">${site.name}</h3> | |
| <p class="text-sm text-gray-600">${site.category} • Replaces: ${site.replaces}</p> | |
| <p class="text-sm text-gray-500 mt-1">${site.description.substring(0, 100)}...</p> | |
| <a href="${site.url}" target="_blank" class="text-blue-500 text-sm hover:underline break-all">${site.url}</a> | |
| ${site.affiliate ? `<p class="text-xs text-orange-500 mt-1">Affiliate: ${site.affiliate}</p>` : ''} | |
| </div> | |
| <button onclick="deleteSite(${site.id})" class="ml-4 text-red-500 hover:text-red-700"> | |
| <i data-lucide="trash-2" class="w-5 h-5"></i> | |
| </button> | |
| </div> | |
| `).join(''); | |
| lucide.createIcons(); | |
| } | |
| function deleteSite(id) { | |
| if (confirm('Are you sure you want to delete this site?')) { | |
| sites = sites.filter(s => s.id !== id); | |
| localStorage.setItem('sites', JSON.stringify(sites)); | |
| renderSites(); | |
| } | |
| } | |
| // Ads Management | |
| document.getElementById('addAdForm').addEventListener('submit', function(e) { | |
| e.preventDefault(); | |
| const ad = { | |
| id: Date.now(), | |
| title: document.getElementById('adTitle').value, | |
| advertiser: document.getElementById('adAdvertiser').value, | |
| content: document.getElementById('adContent').value, | |
| position: document.getElementById('adPosition').value, | |
| startDate: document.getElementById('adStartDate').value, | |
| endDate: document.getElementById('adEndDate').value, | |
| price: parseFloat(document.getElementById('adPrice').value), | |
| active: true | |
| }; | |
| ads.push(ad); | |
| localStorage.setItem('ads', JSON.stringify(ads)); | |
| this.reset(); | |
| renderAds(); | |
| alert('Advertisement added successfully!'); | |
| }); | |
| function renderAds() { | |
| const container = document.getElementById('adsList'); | |
| if (ads.length === 0) { | |
| container.innerHTML = '<p class="text-gray-500 text-center py-4">No advertisements added yet.</p>'; | |
| return; | |
| } | |
| container.innerHTML = ads.map(ad => ` | |
| <div class="border rounded-lg p-4 hover:bg-gray-50"> | |
| <div class="flex justify-between items-start"> | |
| <div class="flex-1"> | |
| <h3 class="font-bold text-lg text-orange-600">${ad.title}</h3> | |
| <p class="text-sm text-gray-600">By: ${ad.advertiser} • Position: ${ad.position}</p> | |
| <p class="text-sm text-gray-500">Duration: ${ad.startDate} to ${ad.endDate}</p> | |
| <p class="text-sm font-semibold text-green-600">$${ad.price.toFixed(2)}</p> | |
| <div class="mt-2 p-2 bg-gray-100 rounded text-xs font-mono overflow-hidden">${ad.content.substring(0, 100)}...</div> | |
| </div> | |
| <button onclick="deleteAd(${ad.id})" class="ml-4 text-red-500 hover:text-red-700"> | |
| <i data-lucide="trash-2" class="w-5 h-5"></i> | |
| </button> | |
| </div> | |
| </div> | |
| `).join(''); | |
| lucide.createIcons(); | |
| } | |
| function deleteAd(id) { | |
| if (confirm('Are you sure you want to delete this advertisement?')) { | |
| ads = ads.filter(a => a.id !== id); | |
| localStorage.setItem('ads', JSON.stringify(ads)); | |
| renderAds(); | |
| } | |
| } | |
| function updateStats() { | |
| document.getElementById('totalSites').textContent = sites.length; | |
| const today = new Date().toISOString().split('T')[0]; | |
| const activeAds = ads.filter(a => a.startDate <= today && a.endDate >= today); | |
| document.getElementById('totalAds').textContent = activeAds.length; | |
| const totalRevenue = ads.reduce((sum, a) => sum + a.price, 0); | |
| document.getElementById('totalRevenue').textContent = '$' + totalRevenue.toFixed(2); | |
| } | |
| // Initialize | |
| renderSites(); | |
| renderAds(); | |
| lucide.createIcons(); | |
| </script> | |
| </body> | |
| </html> |