Spaces:
Running
Running
Download index.html from SM1234/flexforce-armor: direct link, hf CLI and curl.
- Browser
- Download file 14.7 kB
-
https://huggingface.co/spaces/SM1234/flexforce-armor/resolve/main/index.html
- Command line
-
hf download hf://spaces/SM1234/flexforce-armor/index.html
-
curl -L -o index.html https://huggingface.co/spaces/SM1234/flexforce-armor/resolve/main/index.html
14.7 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Date Selection UI</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 styles for date picker */ | |
| .date-picker { | |
| transition: all 0.3s ease; | |
| max-height: 0; | |
| overflow: hidden; | |
| } | |
| .date-picker.active { | |
| max-height: 500px; | |
| } | |
| .custom-shadow { | |
| box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); | |
| } | |
| .calendar-day:hover:not(.disabled) { | |
| background-color: #f0f9ff; | |
| } | |
| .calendar-day.selected { | |
| background-color: #3b82f6; | |
| color: white; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-50 min-h-screen"> | |
| <custom-navbar></custom-navbar> | |
| <div class="flex items-center justify-center p-4 min-h-screen"> | |
| <div class="w-full max-w-md mx-auto mt-16"> | |
| <div class="bg-white rounded-xl custom-shadow p-6"> | |
| <h2 class="text-xl font-semibold text-gray-800 mb-6">Time Period Selection</h2> | |
| <!-- Time period selector --> | |
| <div class="flex justify-between mb-6 bg-gray-100 rounded-lg p-1"> | |
| <button id="daily-btn" class="period-btn flex-1 py-2 px-4 rounded-md font-medium text-sm transition-all duration-300 active"> | |
| <i class="fas fa-calendar-day mr-2"></i> Daily | |
| </button> | |
| <button id="weekly-btn" class="period-btn flex-1 py-2 px-4 rounded-md font-medium text-sm transition-all duration-300"> | |
| <i class="fas fa-calendar-week mr-2"></i> Weekly | |
| </button> | |
| <button id="monthly-btn" class="period-btn flex-1 py-2 px-4 rounded-md font-medium text-sm transition-all duration-300"> | |
| <i class="fas fa-calendar-alt mr-2"></i> Monthly | |
| </button> | |
| </div> | |
| <!-- Date selection area --> | |
| <div class="mb-4"> | |
| <div class="flex justify-between items-center mb-3"> | |
| <h3 class="text-md font-medium text-gray-700">Select Date</h3> | |
| <button id="toggle-date-picker" class="text-blue-500 hover:text-blue-700 text-sm font-medium flex items-center"> | |
| <i class="fas fa-calendar mr-1"></i> Choose Date | |
| </button> | |
| </div> | |
| <!-- Display selected date range --> | |
| <div id="date-display" class="bg-blue-50 border border-blue-100 rounded-lg py-2 px-4 text-blue-800 font-medium"> | |
| Today, June 15, 2023 | |
| </div> | |
| </div> | |
| <!-- Date picker (hidden by default) --> | |
| <div id="date-picker" class="date-picker mt-4"> | |
| <div class="flex justify-between items-center mb-4"> | |
| <button id="prev-month" class="p-2 rounded-full hover:bg-gray-100"> | |
| <i class="fas fa-chevron-left text-gray-600"></i> | |
| </button> | |
| <h3 id="current-month" class="font-semibold text-gray-800">June 2023</h3> | |
| <button id="next-month" class="p-2 rounded-full hover:bg-gray-100"> | |
| <i class="fas fa-chevron-right text-gray-600"></i> | |
| </button> | |
| </div> | |
| <div class="grid grid-cols-7 gap-1 mb-2"> | |
| <div class="text-center text-xs font-medium text-gray-500 py-1">Sun</div> | |
| <div class="text-center text-xs font-medium text-gray-500 py-1">Mon</div> | |
| <div class="text-center text-xs font-medium text-gray-500 py-1">Tue</div> | |
| <div class="text-center text-xs font-medium text-gray-500 py-1">Wed</div> | |
| <div class="text-center text-xs font-medium text-gray-500 py-1">Thu</div> | |
| <div class="text-center text-xs font-medium text-gray-500 py-1">Fri</div> | |
| <div class="text-center text-xs font-medium text-gray-500 py-1">Sat</div> | |
| </div> | |
| <div id="calendar-days" class="grid grid-cols-7 gap-1"> | |
| <!-- Calendar days will be populated by JavaScript --> | |
| </div> | |
| </div> | |
| <!-- Apply button --> | |
| <button id="apply-btn" class="w-full mt-6 bg-blue-500 hover:bg-blue-600 text-white font-medium py-2 px-4 rounded-lg transition duration-300"> | |
| Apply Selection | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <custom-footer></custom-footer> | |
| <script src="components/navbar.js"></script> | |
| <script src="components/footer.js"></script> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Current date | |
| let currentDate = new Date(); | |
| let currentMonth = currentDate.getMonth(); | |
| let currentYear = currentDate.getFullYear(); | |
| let selectedDate = new Date(currentDate); | |
| let selectedPeriod = 'daily'; | |
| // DOM elements | |
| const dailyBtn = document.getElementById('daily-btn'); | |
| const weeklyBtn = document.getElementById('weekly-btn'); | |
| const monthlyBtn = document.getElementById('monthly-btn'); | |
| const dateDisplay = document.getElementById('date-display'); | |
| const toggleDatePicker = document.getElementById('toggle-date-picker'); | |
| const datePicker = document.getElementById('date-picker'); | |
| const prevMonthBtn = document.getElementById('prev-month'); | |
| const nextMonthBtn = document.getElementById('next-month'); | |
| const currentMonthDisplay = document.getElementById('current-month'); | |
| const calendarDays = document.getElementById('calendar-days'); | |
| const applyBtn = document.getElementById('apply-btn'); | |
| // Initialize | |
| updateCalendar(currentMonth, currentYear); | |
| updateDateDisplay(); | |
| // Period selection | |
| dailyBtn.addEventListener('click', () => { | |
| setActivePeriod('daily'); | |
| selectedPeriod = 'daily'; | |
| updateDateDisplay(); | |
| }); | |
| weeklyBtn.addEventListener('click', () => { | |
| setActivePeriod('weekly'); | |
| selectedPeriod = 'weekly'; | |
| updateDateDisplay(); | |
| }); | |
| monthlyBtn.addEventListener('click', () => { | |
| setActivePeriod('monthly'); | |
| selectedPeriod = 'monthly'; | |
| updateDateDisplay(); | |
| }); | |
| // Toggle date picker | |
| toggleDatePicker.addEventListener('click', () => { | |
| datePicker.classList.toggle('active'); | |
| toggleDatePicker.innerHTML = datePicker.classList.contains('active') ? | |
| '<i class="fas fa-times mr-1"></i> Close' : | |
| '<i class="fas fa-calendar mr-1"></i> Choose Date'; | |
| }); | |
| // Month navigation | |
| prevMonthBtn.addEventListener('click', () => { | |
| currentMonth--; | |
| if (currentMonth < 0) { | |
| currentMonth = 11; | |
| currentYear--; | |
| } | |
| updateCalendar(currentMonth, currentYear); | |
| }); | |
| nextMonthBtn.addEventListener('click', () => { | |
| currentMonth++; | |
| if (currentMonth > 11) { | |
| currentMonth = 0; | |
| currentYear++; | |
| } | |
| updateCalendar(currentMonth, currentYear); | |
| }); | |
| // Apply selection | |
| applyBtn.addEventListener('click', () => { | |
| // Here you would typically send the selected date/period to your backend | |
| alert(`Selection applied: ${dateDisplay.textContent}`); | |
| datePicker.classList.remove('active'); | |
| toggleDatePicker.innerHTML = '<i class="fas fa-calendar mr-1"></i> Choose Date'; | |
| }); | |
| // Helper functions | |
| function setActivePeriod(period) { | |
| document.querySelectorAll('.period-btn').forEach(btn => { | |
| btn.classList.remove('active', 'bg-white', 'text-blue-600', 'shadow-sm'); | |
| btn.classList.add('text-gray-600'); | |
| }); | |
| const activeBtn = document.getElementById(`${period}-btn`); | |
| activeBtn.classList.add('active', 'bg-white', 'text-blue-600', 'shadow-sm'); | |
| activeBtn.classList.remove('text-gray-600'); | |
| } | |
| function updateDateDisplay() { | |
| const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; | |
| if (selectedPeriod === 'daily') { | |
| dateDisplay.textContent = selectedDate.toLocaleDateString('en-US', options); | |
| } else if (selectedPeriod === 'weekly') { | |
| const weekStart = new Date(selectedDate); | |
| weekStart.setDate(selectedDate.getDate() - selectedDate.getDay()); | |
| const weekEnd = new Date(weekStart); | |
| weekEnd.setDate(weekStart.getDate() + 6); | |
| dateDisplay.textContent = `${weekStart.toLocaleDateString('en-US', { month: 'short', day: 'numeric' })} - ${weekEnd.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' })}`; | |
| } else { // monthly | |
| const monthStart = new Date(selectedDate.getFullYear(), selectedDate.getMonth(), 1); | |
| const monthEnd = new Date(selectedDate.getFullYear(), selectedDate.getMonth() + 1, 0); | |
| dateDisplay.textContent = `${monthStart.toLocaleDateString('en-US', { month: 'long', year: 'numeric' })}`; | |
| } | |
| } | |
| function updateCalendar(month, year) { | |
| currentMonthDisplay.textContent = new Date(year, month).toLocaleDateString('en-US', { month: 'long', year: 'numeric' }); | |
| calendarDays.innerHTML = ''; | |
| const firstDay = new Date(year, month, 1); | |
| const lastDay = new Date(year, month + 1, 0); | |
| const prevLastDay = new Date(year, month, 0).getDate(); | |
| const firstDayIndex = firstDay.getDay(); | |
| const lastDayIndex = lastDay.getDay(); | |
| const nextDays = 7 - lastDayIndex - 1; | |
| // Previous month days | |
| for (let i = firstDayIndex; i > 0; i--) { | |
| const day = document.createElement('div'); | |
| day.className = 'calendar-day text-center py-2 text-gray-400 disabled'; | |
| day.textContent = prevLastDay - i + 1; | |
| calendarDays.appendChild(day); | |
| } | |
| // Current month days | |
| for (let i = 1; i <= lastDay.getDate(); i++) { | |
| const day = document.createElement('div'); | |
| day.className = 'calendar-day text-center py-2 cursor-pointer rounded-full'; | |
| // Check if this day is selected | |
| const dayDate = new Date(year, month, i); | |
| if (dayDate.toDateString() === selectedDate.toDateString()) { | |
| day.classList.add('selected', 'text-white'); | |
| } else { | |
| day.classList.add('text-gray-800'); | |
| } | |
| // Check if today | |
| if (i === currentDate.getDate() && month === currentDate.getMonth() && year === currentDate.getFullYear()) { | |
| day.classList.add('font-bold'); | |
| if (!day.classList.contains('selected')) { | |
| day.classList.add('text-blue-500'); | |
| } | |
| } | |
| day.textContent = i; | |
| day.addEventListener('click', () => { | |
| // Remove selected class from all days | |
| document.querySelectorAll('.calendar-day').forEach(d => { | |
| d.classList.remove('selected', 'text-white'); | |
| if (!d.classList.contains('disabled')) { | |
| d.classList.add('text-gray-800'); | |
| } | |
| }); | |
| // Add selected class to clicked day | |
| day.classList.add('selected', 'text-white'); | |
| day.classList.remove('text-gray-800'); | |
| // Update selected date | |
| selectedDate = new Date(year, month, i); | |
| updateDateDisplay(); | |
| }); | |
| calendarDays.appendChild(day); | |
| } | |
| // Next month days | |
| for (let i = 1; i <= nextDays; i++) { | |
| const day = document.createElement('div'); | |
| day.className = 'calendar-day text-center py-2 text-gray-400 disabled'; | |
| day.textContent = i; | |
| calendarDays.appendChild(day); | |
| } | |
| } | |
| }); | |
| </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=SM1234/ui1" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p> | |
| <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script> | |
| </body> | |
| </html> |