Download index.html from Kbala/testspace: direct link, hf CLI and curl.
- Browser
- Download file 26.4 kB
-
https://huggingface.co/spaces/Kbala/testspace/resolve/main/index.html
- Command line
-
hf download hf://spaces/Kbala/testspace/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Kbala/testspace/resolve/main/index.html
26.4 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Morning Sunshine - Email Notifications</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> | |
| .email-item { | |
| transition: all 0.3s ease; | |
| } | |
| .email-item:hover { | |
| transform: translateY(-2px); | |
| box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | |
| } | |
| .sun-animation { | |
| animation: sunRise 2s ease-in-out infinite alternate; | |
| } | |
| @keyframes sunRise { | |
| 0% { transform: translateY(0) rotate(0deg); } | |
| 100% { transform: translateY(-5px) rotate(5deg); } | |
| } | |
| .notification-bell { | |
| animation: ring 4s ease infinite; | |
| transform-origin: 50% 0%; | |
| } | |
| @keyframes ring { | |
| 0% { transform: rotate(0deg); } | |
| 2% { transform: rotate(10deg); } | |
| 4% { transform: rotate(-10deg); } | |
| 6% { transform: rotate(10deg); } | |
| 8% { transform: rotate(-10deg); } | |
| 10% { transform: rotate(0deg); } | |
| 100% { transform: rotate(0deg); } | |
| } | |
| .unsubscribed { | |
| opacity: 0.6; | |
| background-color: #f3f4f6; | |
| } | |
| .unsubscribed td { | |
| color: #9ca3af ; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gradient-to-br from-blue-50 to-indigo-100 min-h-screen"> | |
| <div class="container mx-auto px-4 py-8"> | |
| <!-- Header --> | |
| <header class="flex justify-between items-center mb-12"> | |
| <div class="flex items-center"> | |
| <i class="fas fa-sun text-yellow-400 text-4xl mr-3 sun-animation"></i> | |
| <h1 class="text-3xl font-bold text-indigo-800">Morning Sunshine</h1> | |
| </div> | |
| <div class="relative"> | |
| <i class="fas fa-bell text-indigo-600 text-2xl notification-bell"></i> | |
| <span class="absolute -top-2 -right-2 bg-red-500 text-white text-xs rounded-full h-5 w-5 flex items-center justify-center">3</span> | |
| </div> | |
| </header> | |
| <div class="grid grid-cols-1 lg:grid-cols-2 gap-8"> | |
| <!-- Email Management Section --> | |
| <div class="bg-white rounded-xl shadow-lg p-6"> | |
| <div class="flex justify-between items-center mb-6"> | |
| <h2 class="text-xl font-semibold text-indigo-700">Email Recipients</h2> | |
| <button id="addEmailBtn" class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg flex items-center"> | |
| <i class="fas fa-plus mr-2"></i> Add Email | |
| </button> | |
| </div> | |
| <!-- Add Email Modal (hidden by default) --> | |
| <div id="addEmailModal" class="hidden fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"> | |
| <div class="bg-white rounded-lg p-6 w-full max-w-md"> | |
| <div class="flex justify-between items-center mb-4"> | |
| <h3 class="text-lg font-semibold">Add New Email</h3> | |
| <button id="closeModalBtn" class="text-gray-500 hover:text-gray-700"> | |
| <i class="fas fa-times"></i> | |
| </button> | |
| </div> | |
| <div class="mb-4"> | |
| <label class="block text-gray-700 mb-2" for="newEmail">Email Address</label> | |
| <input type="email" id="newEmail" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500" placeholder="example@domain.com"> | |
| </div> | |
| <div class="mb-4"> | |
| <label class="block text-gray-700 mb-2" for="recipientName">Recipient Name (Optional)</label> | |
| <input type="text" id="recipientName" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500" placeholder="John Doe"> | |
| </div> | |
| <div class="mb-4"> | |
| <label class="flex items-center"> | |
| <input type="checkbox" id="subscribeCheckbox" class="rounded text-indigo-600 focus:ring-indigo-500" checked> | |
| <span class="ml-2 text-gray-700">Subscribe to notifications</span> | |
| </label> | |
| </div> | |
| <div class="flex justify-end"> | |
| <button id="cancelAddBtn" class="mr-2 px-4 py-2 text-gray-600 hover:text-gray-800">Cancel</button> | |
| <button id="confirmAddBtn" class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg">Add Email</button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Email List --> | |
| <div class="overflow-hidden rounded-lg border border-gray-200"> | |
| <table class="min-w-full divide-y divide-gray-200"> | |
| <thead class="bg-gray-50"> | |
| <tr> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Name</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Email</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th> | |
| </tr> | |
| </thead> | |
| <tbody id="emailTableBody" class="bg-white divide-y divide-gray-200"> | |
| <!-- Email rows will be added here dynamically --> | |
| </tbody> | |
| </table> | |
| </div> | |
| <div class="mt-4 text-sm text-gray-500"> | |
| <p><i class="fas fa-info-circle mr-1 text-indigo-500"></i> Only subscribed emails will receive notifications</p> | |
| </div> | |
| </div> | |
| <!-- Notification Sender Section --> | |
| <div class="bg-white rounded-xl shadow-lg p-6"> | |
| <h2 class="text-xl font-semibold text-indigo-700 mb-6">Send Good Morning Notification</h2> | |
| <div class="mb-6"> | |
| <label class="block text-gray-700 mb-2">Notification Message</label> | |
| <textarea id="notificationMessage" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 h-32" placeholder="Good morning! Wishing you a wonderful day filled with joy and productivity...">Good morning! 🌞 Wishing you a wonderful day filled with joy and productivity. | |
| To unsubscribe from these notifications, click here: <span class="text-indigo-600">[UNSUBSCRIBE_LINK]</span></textarea> | |
| </div> | |
| <div class="mb-6"> | |
| <label class="block text-gray-700 mb-2">Schedule Time</label> | |
| <div class="flex items-center"> | |
| <select id="scheduleHour" class="px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 mr-2"> | |
| <option value="7" selected>7</option> | |
| <option value="8">8</option> | |
| <option value="9">9</option> | |
| </select> | |
| <span class="mr-2">:</span> | |
| <select id="scheduleMinute" class="px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 mr-4"> | |
| <option value="0" selected>00</option> | |
| <option value="15">15</option> | |
| <option value="30">30</option> | |
| <option value="45">45</option> | |
| </select> | |
| <select id="scheduleAmPm" class="px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500"> | |
| <option value="AM" selected>AM</option> | |
| <option value="PM">PM</option> | |
| </select> | |
| </div> | |
| </div> | |
| <div class="mb-6"> | |
| <label class="flex items-center"> | |
| <input type="checkbox" id="includeWeather" class="rounded text-indigo-600 focus:ring-indigo-500" checked> | |
| <span class="ml-2 text-gray-700">Include weather information</span> | |
| </label> | |
| <label class="flex items-center mt-2"> | |
| <input type="checkbox" id="includeQuote" class="rounded text-indigo-600 focus:ring-indigo-500" checked> | |
| <span class="ml-2 text-gray-700">Include daily inspirational quote</span> | |
| </label> | |
| </div> | |
| <div class="flex flex-wrap gap-3"> | |
| <button id="sendNowBtn" class="bg-gradient-to-r from-yellow-400 to-yellow-500 hover:from-yellow-500 hover:to-yellow-600 text-white px-6 py-3 rounded-lg font-medium flex items-center"> | |
| <i class="fas fa-paper-plane mr-2"></i> Send Now | |
| </button> | |
| <button id="scheduleBtn" class="bg-gradient-to-r from-indigo-500 to-purple-600 hover:from-indigo-600 hover:to-purple-700 text-white px-6 py-3 rounded-lg font-medium flex items-center"> | |
| <i class="fas fa-clock mr-2"></i> Schedule Daily | |
| </button> | |
| <button id="testBtn" class="border border-indigo-500 text-indigo-600 hover:bg-indigo-50 px-6 py-3 rounded-lg font-medium flex items-center"> | |
| <i class="fas fa-vial mr-2"></i> Send Test | |
| </button> | |
| </div> | |
| <div id="statusMessage" class="mt-4 p-3 rounded-lg hidden"></div> | |
| </div> | |
| </div> | |
| <!-- Stats Section --> | |
| <div class="mt-12 bg-white rounded-xl shadow-lg p-6"> | |
| <h2 class="text-xl font-semibold text-indigo-700 mb-6">Notification Statistics</h2> | |
| <div class="grid grid-cols-1 md:grid-cols-4 gap-6"> | |
| <div class="bg-blue-50 p-4 rounded-lg flex items-center"> | |
| <div class="bg-blue-100 p-3 rounded-full mr-4"> | |
| <i class="fas fa-users text-blue-600 text-xl"></i> | |
| </div> | |
| <div> | |
| <p class="text-sm text-blue-500">Total Recipients</p> | |
| <p id="totalRecipients" class="text-2xl font-bold text-blue-800">0</p> | |
| </div> | |
| </div> | |
| <div class="bg-green-50 p-4 rounded-lg flex items-center"> | |
| <div class="bg-green-100 p-3 rounded-full mr-4"> | |
| <i class="fas fa-user-check text-green-600 text-xl"></i> | |
| </div> | |
| <div> | |
| <p class="text-sm text-green-500">Subscribed</p> | |
| <p id="subscribedCount" class="text-2xl font-bold text-green-800">0</p> | |
| </div> | |
| </div> | |
| <div class="bg-purple-50 p-4 rounded-lg flex items-center"> | |
| <div class="bg-purple-100 p-3 rounded-full mr-4"> | |
| <i class="fas fa-paper-plane text-purple-600 text-xl"></i> | |
| </div> | |
| <div> | |
| <p class="text-sm text-purple-500">Notifications Sent</p> | |
| <p id="notificationsSent" class="text-2xl font-bold text-purple-800">0</p> | |
| </div> | |
| </div> | |
| <div class="bg-indigo-50 p-4 rounded-lg flex items-center"> | |
| <div class="bg-indigo-100 p-3 rounded-full mr-4"> | |
| <i class="fas fa-calendar-check text-indigo-600 text-xl"></i> | |
| </div> | |
| <div> | |
| <p class="text-sm text-indigo-500">Next Scheduled</p> | |
| <p id="nextScheduled" class="text-2xl font-bold text-indigo-800">Not set</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| // Sample data - in a real app, this would come from a database | |
| let emails = [ | |
| { id: 1, name: "John Doe", email: "john@example.com", subscribed: true }, | |
| { id: 2, name: "Jane Smith", email: "jane@example.com", subscribed: true }, | |
| { id: 3, name: "Mike Johnson", email: "mike@example.com", subscribed: false } | |
| ]; | |
| // DOM elements | |
| const emailTableBody = document.getElementById('emailTableBody'); | |
| const addEmailBtn = document.getElementById('addEmailBtn'); | |
| const addEmailModal = document.getElementById('addEmailModal'); | |
| const closeModalBtn = document.getElementById('closeModalBtn'); | |
| const cancelAddBtn = document.getElementById('cancelAddBtn'); | |
| const confirmAddBtn = document.getElementById('confirmAddBtn'); | |
| const newEmailInput = document.getElementById('newEmail'); | |
| const recipientNameInput = document.getElementById('recipientName'); | |
| const subscribeCheckbox = document.getElementById('subscribeCheckbox'); | |
| const sendNowBtn = document.getElementById('sendNowBtn'); | |
| const scheduleBtn = document.getElementById('scheduleBtn'); | |
| const testBtn = document.getElementById('testBtn'); | |
| const statusMessage = document.getElementById('statusMessage'); | |
| const totalRecipients = document.getElementById('totalRecipients'); | |
| const subscribedCount = document.getElementById('subscribedCount'); | |
| const notificationsSent = document.getElementById('notificationsSent'); | |
| const nextScheduled = document.getElementById('nextScheduled'); | |
| const notificationMessage = document.getElementById('notificationMessage'); | |
| // Stats | |
| let stats = { | |
| sentCount: 42, | |
| nextSchedule: "Tomorrow 7:00 AM" | |
| }; | |
| // Initialize the app | |
| document.addEventListener('DOMContentLoaded', function() { | |
| renderEmailTable(); | |
| updateStats(); | |
| // Set up event listeners | |
| addEmailBtn.addEventListener('click', showAddEmailModal); | |
| closeModalBtn.addEventListener('click', hideAddEmailModal); | |
| cancelAddBtn.addEventListener('click', hideAddEmailModal); | |
| confirmAddBtn.addEventListener('click', addNewEmail); | |
| sendNowBtn.addEventListener('click', sendNotificationsNow); | |
| scheduleBtn.addEventListener('click', scheduleDailyNotifications); | |
| testBtn.addEventListener('click', sendTestNotification); | |
| }); | |
| // Render the email table | |
| function renderEmailTable() { | |
| emailTableBody.innerHTML = ''; | |
| if (emails.length === 0) { | |
| emailTableBody.innerHTML = ` | |
| <tr> | |
| <td colspan="4" class="px-6 py-4 text-center text-gray-500"> | |
| No email recipients added yet. Click "Add Email" to get started. | |
| </td> | |
| </tr> | |
| `; | |
| return; | |
| } | |
| emails.forEach(email => { | |
| const row = document.createElement('tr'); | |
| row.className = `email-item hover:bg-gray-50 ${email.subscribed ? '' : 'unsubscribed'}`; | |
| row.innerHTML = ` | |
| <td class="px-6 py-4 whitespace-nowrap">${email.name || '-'}</td> | |
| <td class="px-6 py-4 whitespace-nowrap">${email.email}</td> | |
| <td class="px-6 py-4 whitespace-nowrap"> | |
| <label class="inline-flex items-center"> | |
| <input type="checkbox" class="rounded text-indigo-600 focus:ring-indigo-500 subscription-toggle" | |
| data-id="${email.id}" ${email.subscribed ? 'checked' : ''}> | |
| <span class="ml-2">${email.subscribed ? 'Subscribed' : 'Unsubscribed'}</span> | |
| </label> | |
| </td> | |
| <td class="px-6 py-4 whitespace-nowrap"> | |
| <button onclick="deleteEmail(${email.id})" class="text-red-600 hover:text-red-800 mr-3"> | |
| <i class="fas fa-trash-alt"></i> | |
| </button> | |
| <button onclick="editEmail(${email.id})" class="text-indigo-600 hover:text-indigo-800"> | |
| <i class="fas fa-edit"></i> | |
| </button> | |
| </td> | |
| `; | |
| emailTableBody.appendChild(row); | |
| }); | |
| // Add event listeners to subscription toggles | |
| document.querySelectorAll('.subscription-toggle').forEach(toggle => { | |
| toggle.addEventListener('change', function() { | |
| const id = parseInt(this.getAttribute('data-id')); | |
| toggleSubscription(id, this.checked); | |
| }); | |
| }); | |
| } | |
| // Toggle subscription status | |
| function toggleSubscription(id, isSubscribed) { | |
| const emailIndex = emails.findIndex(e => e.id === id); | |
| if (emailIndex !== -1) { | |
| emails[emailIndex].subscribed = isSubscribed; | |
| updateStats(); | |
| showStatus(`Subscription status updated for ${emails[emailIndex].email}`, 'success'); | |
| // Re-render the table to update the styling | |
| renderEmailTable(); | |
| } | |
| } | |
| // Show the add email modal | |
| function showAddEmailModal() { | |
| addEmailModal.classList.remove('hidden'); | |
| addEmailModal.classList.add('flex'); | |
| newEmailInput.focus(); | |
| subscribeCheckbox.checked = true; | |
| } | |
| // Hide the add email modal | |
| function hideAddEmailModal() { | |
| addEmailModal.classList.add('hidden'); | |
| addEmailModal.classList.remove('flex'); | |
| newEmailInput.value = ''; | |
| recipientNameInput.value = ''; | |
| } | |
| // Add a new email | |
| function addNewEmail() { | |
| const email = newEmailInput.value.trim(); | |
| const name = recipientNameInput.value.trim(); | |
| const subscribed = subscribeCheckbox.checked; | |
| if (!email) { | |
| showStatus('Please enter an email address', 'error'); | |
| return; | |
| } | |
| if (!validateEmail(email)) { | |
| showStatus('Please enter a valid email address', 'error'); | |
| return; | |
| } | |
| // Check if email already exists | |
| if (emails.some(e => e.email === email)) { | |
| showStatus('This email is already in the list', 'error'); | |
| return; | |
| } | |
| const newEmail = { | |
| id: Date.now(), // Simple unique ID | |
| name: name || null, | |
| email: email, | |
| subscribed: subscribed | |
| }; | |
| emails.push(newEmail); | |
| renderEmailTable(); | |
| updateStats(); | |
| hideAddEmailModal(); | |
| showStatus('Email added successfully!', 'success'); | |
| } | |
| // Delete an email | |
| function deleteEmail(id) { | |
| if (confirm('Are you sure you want to remove this email recipient?')) { | |
| emails = emails.filter(email => email.id !== id); | |
| renderEmailTable(); | |
| updateStats(); | |
| showStatus('Email removed successfully', 'success'); | |
| } | |
| } | |
| // Edit an email | |
| function editEmail(id) { | |
| const email = emails.find(e => e.id === id); | |
| if (email) { | |
| newEmailInput.value = email.email; | |
| recipientNameInput.value = email.name || ''; | |
| subscribeCheckbox.checked = email.subscribed; | |
| showAddEmailModal(); | |
| // Remove the email from the list | |
| emails = emails.filter(e => e.id !== id); | |
| } | |
| } | |
| // Validate email format | |
| function validateEmail(email) { | |
| const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; | |
| return re.test(email); | |
| } | |
| // Send notifications now | |
| function sendNotificationsNow() { | |
| const subscribedEmails = emails.filter(e => e.subscribed); | |
| if (subscribedEmails.length === 0) { | |
| showStatus('No subscribed email recipients to send to', 'error'); | |
| return; | |
| } | |
| showStatus('Sending notifications to subscribed recipients...', 'info'); | |
| // Replace unsubscribe link placeholder with actual links | |
| const message = notificationMessage.value; | |
| const messagesWithLinks = subscribedEmails.map(email => { | |
| const unsubscribeLink = `https://yourapp.com/unsubscribe?email=${encodeURIComponent(email.email)}`; | |
| return message.replace('[UNSUBSCRIBE_LINK]', unsubscribeLink); | |
| }); | |
| // Simulate sending | |
| setTimeout(() => { | |
| stats.sentCount += subscribedEmails.length; | |
| updateStats(); | |
| showStatus(`Successfully sent ${subscribedEmails.length} good morning notifications to subscribed recipients!`, 'success'); | |
| }, 1500); | |
| } | |
| // Schedule daily notifications | |
| function scheduleDailyNotifications() { | |
| const subscribedEmails = emails.filter(e => e.subscribed); | |
| if (subscribedEmails.length === 0) { | |
| showStatus('No subscribed email recipients to schedule for', 'error'); | |
| return; | |
| } | |
| const hour = document.getElementById('scheduleHour').value; | |
| const minute = document.getElementById('scheduleMinute').value; | |
| const ampm = document.getElementById('scheduleAmPm').value; | |
| stats.nextSchedule = `Daily at ${hour}:${minute} ${ampm} (${subscribedEmails.length} recipients)`; | |
| updateStats(); | |
| showStatus(`Daily notifications scheduled for ${hour}:${minute} ${ampm} for ${subscribedEmails.length} subscribed recipients`, 'success'); | |
| } | |
| // Send test notification | |
| function sendTestNotification() { | |
| const testEmail = "your-email@example.com"; | |
| // Check if test email is in the list | |
| const existingEmail = emails.find(e => e.email === testEmail); | |
| if (existingEmail && !existingEmail.subscribed) { | |
| showStatus('Your test email is in the list but unsubscribed', 'error'); | |
| return; | |
| } | |
| showStatus('Sending test notification to your email...', 'info'); | |
| // Replace unsubscribe link placeholder with actual link | |
| const message = notificationMessage.value; | |
| const unsubscribeLink = `https://yourapp.com/unsubscribe?email=${encodeURIComponent(testEmail)}`; | |
| const messageWithLink = message.replace('[UNSUBSCRIBE_LINK]', unsubscribeLink); | |
| // Simulate sending | |
| setTimeout(() => { | |
| showStatus('Test notification sent successfully! Check your inbox.', 'success'); | |
| }, 1000); | |
| } | |
| // Show status message | |
| function showStatus(message, type) { | |
| statusMessage.textContent = message; | |
| statusMessage.className = 'mt-4 p-3 rounded-lg'; | |
| switch (type) { | |
| case 'error': | |
| statusMessage.classList.add('bg-red-100', 'text-red-700'); | |
| break; | |
| case 'success': | |
| statusMessage.classList.add('bg-green-100', 'text-green-700'); | |
| break; | |
| case 'info': | |
| statusMessage.classList.add('bg-blue-100', 'text-blue-700'); | |
| break; | |
| default: | |
| statusMessage.classList.add('bg-gray-100', 'text-gray-700'); | |
| } | |
| statusMessage.classList.remove('hidden'); | |
| // Hide after 5 seconds | |
| setTimeout(() => { | |
| statusMessage.classList.add('hidden'); | |
| }, 5000); | |
| } | |
| // Update statistics | |
| function updateStats() { | |
| const subscribedEmails = emails.filter(e => e.subscribed); | |
| totalRecipients.textContent = emails.length; | |
| subscribedCount.textContent = subscribedEmails.length; | |
| notificationsSent.textContent = stats.sentCount; | |
| nextScheduled.textContent = stats.nextSchedule; | |
| } | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Kbala/testspace" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |