Spaces:
Running
Running
Make it so that it is a calendar and I can mark specific days - Follow Up Deployment
b1b003b verified Download index.html from ThatEmoGamer713/avaailability: direct link, hf CLI and curl.
- Browser
- Download file 10.9 kB
-
https://huggingface.co/spaces/ThatEmoGamer713/avaailability/resolve/main/index.html
- Command line
-
hf download hf://spaces/ThatEmoGamer713/avaailability/index.html
-
curl -L -o index.html https://huggingface.co/spaces/ThatEmoGamer713/avaailability/resolve/main/index.html
10.9 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Work Calendar</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> | |
| .calendar-day { | |
| transition: all 0.3s ease; | |
| aspect-ratio: 1; | |
| } | |
| .calendar-day.available { | |
| background-color: #dcfce7; | |
| box-shadow: 0 0 10px rgba(74, 222, 128, 0.7); | |
| } | |
| .calendar-day.unavailable { | |
| background-color: #fee2e2; | |
| box-shadow: 0 0 10px rgba(248, 113, 113, 0.7); | |
| } | |
| .calendar-day.empty { | |
| background-color: #f3f4f6; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-100 min-h-screen flex items-center justify-center p-4"> | |
| <div class="max-w-2xl w-full"> | |
| <div class="bg-white rounded-3xl shadow-xl overflow-hidden"> | |
| <!-- Colander Header --> | |
| <div class="bg-amber-100 p-6 text-center"> | |
| <h1 class="text-3xl font-bold text-amber-800">WORK CALENDAR</h1> | |
| <p class="text-amber-600 mt-2">Mark your work availability</p> | |
| </div> | |
| <!-- Colander Body --> | |
| <div class="relative p-8 colander"> | |
| <!-- Handle --> | |
| <div class="handle absolute -top-4 left-1/2 -translate-x-1/2 w-24 h-8 rounded-full"></div> | |
| <!-- Calendar Header --> | |
| <div class="grid grid-cols-7 gap-1 mb-2"> | |
| <div class="text-center font-bold text-gray-600 p-2">Sun</div> | |
| <div class="text-center font-bold text-gray-600 p-2">Mon</div> | |
| <div class="text-center font-bold text-gray-600 p-2">Tue</div> | |
| <div class="text-center font-bold text-gray-600 p-2">Wed</div> | |
| <div class="text-center font-bold text-gray-600 p-2">Thu</div> | |
| <div class="text-center font-bold text-gray-600 p-2">Fri</div> | |
| <div class="text-center font-bold text-gray-600 p-2">Sat</div> | |
| </div> | |
| <!-- Calendar Grid --> | |
| <div class="grid grid-cols-7 gap-1" id="calendar-grid"> | |
| <!-- Days will be populated by JavaScript --> | |
| </div> | |
| <!-- Month Navigation --> | |
| <div class="flex justify-between items-center mt-4"> | |
| <button onclick="previousMonth()" class="text-gray-600 hover:text-gray-800"> | |
| <i class="fas fa-chevron-left"></i> Previous | |
| </button> | |
| <h3 class="text-lg font-semibold text-gray-800" id="current-month">Month Year</h3> | |
| <button onclick="nextMonth()" class="text-gray-600 hover:text-gray-800"> | |
| Next <i class="fas fa-chevron-right"></i> | |
| </button> | |
| </div> | |
| <!-- Legend --> | |
| <div class="flex justify-center mt-8 space-x-6"> | |
| <div class="flex items-center"> | |
| <div class="w-4 h-4 rounded-full bg-green-300 mr-2"></div> | |
| <span class="text-sm">Available</span> | |
| </div> | |
| <div class="flex items-center"> | |
| <div class="w-4 h-4 rounded-full bg-red-300 mr-2"></div> | |
| <span class="text-sm">Unavailable</span> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Controls --> | |
| <div class="bg-gray-50 p-6 flex flex-col sm:flex-row justify-between items-center"> | |
| <div class="mb-4 sm:mb-0"> | |
| <button onclick="selectAllDays(true)" class="bg-green-500 hover:bg-green-600 text-white px-4 py-2 rounded-lg mr-2 transition"> | |
| <i class="fas fa-check-circle mr-1"></i> All Available | |
| </button> | |
| <button onclick="selectAllDays(false)" class="bg-red-500 hover:bg-red-600 text-white px-4 py-2 rounded-lg transition"> | |
| <i class="fas fa-times-circle mr-1"></i> All Unavailable | |
| </button> | |
| </div> | |
| <button onclick="copyToClipboard()" class="bg-blue-500 hover:bg-blue-600 text-white px-6 py-2 rounded-lg transition"> | |
| <i class="fas fa-copy mr-1"></i> Copy Availability | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Instructions --> | |
| <div class="mt-6 bg-white p-6 rounded-xl shadow"> | |
| <h2 class="text-xl font-bold text-gray-800 mb-3">How to use your Work Calendar:</h2> | |
| <ol class="list-decimal pl-5 space-y-2 text-gray-700"> | |
| <li>Click on a date to toggle between available (green) and unavailable (red)</li> | |
| <li>Navigate between months using the Previous/Next buttons</li> | |
| <li>Use the buttons to quickly select all days as available or unavailable</li> | |
| <li>Click "Copy Availability" to get a text version you can share</li> | |
| </ol> | |
| </div> | |
| </div> | |
| <script> | |
| let currentDate = new Date(); | |
| let currentMonth = currentDate.getMonth(); | |
| let currentYear = currentDate.getFullYear(); | |
| let availabilityMap = {}; | |
| function generateCalendar() { | |
| const calendarGrid = document.getElementById('calendar-grid'); | |
| calendarGrid.innerHTML = ''; | |
| const firstDay = new Date(currentYear, currentMonth, 1).getDay(); | |
| const daysInMonth = new Date(currentYear, currentMonth + 1, 0).getDate(); | |
| // Update month/year display | |
| document.getElementById('current-month').textContent = | |
| new Date(currentYear, currentMonth).toLocaleString('default', { month: 'long', year: 'numeric' }); | |
| // Add empty cells for days before the first day of month | |
| for (let i = 0; i < firstDay; i++) { | |
| const emptyCell = document.createElement('div'); | |
| emptyCell.className = 'calendar-day empty rounded'; | |
| calendarGrid.appendChild(emptyCell); | |
| } | |
| // Add cells for each day of the month | |
| for (let day = 1; day <= daysInMonth; day++) { | |
| const dateKey = `${currentYear}-${currentMonth}-${day}`; | |
| const isAvailable = availabilityMap[dateKey] === 'available'; | |
| const isUnavailable = availabilityMap[dateKey] === 'unavailable'; | |
| const dayCell = document.createElement('div'); | |
| dayCell.className = `calendar-day rounded cursor-pointer flex items-center justify-center ${ | |
| isAvailable ? 'available' : isUnavailable ? 'unavailable' : '' | |
| }`; | |
| dayCell.textContent = day; | |
| dayCell.onclick = () => toggleDay(dayCell, day); | |
| calendarGrid.appendChild(dayCell); | |
| } | |
| } | |
| function toggleDay(element, day) { | |
| const dateKey = `${currentYear}-${currentMonth}-${day}`; | |
| if (element.classList.contains('available')) { | |
| element.classList.remove('available'); | |
| element.classList.add('unavailable'); | |
| availabilityMap[dateKey] = 'unavailable'; | |
| } else if (element.classList.contains('unavailable')) { | |
| element.classList.remove('unavailable'); | |
| availabilityMap[dateKey] = undefined; | |
| } else { | |
| element.classList.add('available'); | |
| availabilityMap[dateKey] = 'available'; | |
| } | |
| } | |
| function previousMonth() { | |
| currentMonth--; | |
| if (currentMonth < 0) { | |
| currentMonth = 11; | |
| currentYear--; | |
| } | |
| generateCalendar(); | |
| } | |
| function nextMonth() { | |
| currentMonth++; | |
| if (currentMonth > 11) { | |
| currentMonth = 0; | |
| currentYear++; | |
| } | |
| generateCalendar(); | |
| } | |
| function selectAllDays(available) { | |
| const daysInMonth = new Date(currentYear, currentMonth + 1, 0).getDate(); | |
| for (let day = 1; day <= daysInMonth; day++) { | |
| const dateKey = `${currentYear}-${currentMonth}-${day}`; | |
| availabilityMap[dateKey] = available ? 'available' : 'unavailable'; | |
| } | |
| generateCalendar(); | |
| } | |
| function copyToClipboard() { | |
| const monthName = new Date(currentYear, currentMonth).toLocaleString('default', { month: 'long' }); | |
| let availability = []; | |
| const daysInMonth = new Date(currentYear, currentMonth + 1, 0).getDate(); | |
| for (let day = 1; day <= daysInMonth; day++) { | |
| const dateKey = `${currentYear}-${currentMonth}-${day}`; | |
| const status = availabilityMap[dateKey] === 'available' ? '✅ Available' : '❌ Unavailable'; | |
| availability.push(`${monthName} ${day}: ${status}`); | |
| } | |
| const textToCopy = `My Work Availability for ${monthName} ${currentYear}:\n${availability.join('\n')}`; | |
| navigator.clipboard.writeText(textToCopy).then(() => { | |
| alert('Availability copied to clipboard!'); | |
| }).catch(err => { | |
| console.error('Failed to copy: ', err); | |
| const textarea = document.createElement('textarea'); | |
| textarea.value = textToCopy; | |
| document.body.appendChild(textarea); | |
| textarea.select(); | |
| document.execCommand('copy'); | |
| document.body.removeChild(textarea); | |
| alert('Availability copied to clipboard!'); | |
| }); | |
| } | |
| // Initialize calendar on load | |
| document.addEventListener('DOMContentLoaded', generateCalendar); | |
| </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=ThatEmoGamer713/avaailability" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |