Spaces:
Running
Running
Download script.js from fogtooth/deepsite-project-8levq: direct link, hf CLI and curl.
- Browser
- Download file 8.99 kB
-
https://huggingface.co/spaces/fogtooth/deepsite-project-8levq/resolve/main/script.js
- Command line
-
hf download hf://spaces/fogtooth/deepsite-project-8levq/script.js
-
curl -L -o script.js https://huggingface.co/spaces/fogtooth/deepsite-project-8levq/resolve/main/script.js
8.99 kB
| // lOUIS Dataset - Primary Data Source | |
| const lOUISDataset = { | |
| metadata: { | |
| name: 'lOUIS Dataset', | |
| version: '2024.1', | |
| lastUpdated: '2024-01-15', | |
| source: 'lOUIS Analytics Engine' | |
| }, | |
| metrics: { | |
| revenue: 45231, | |
| activeUsers: 2450, | |
| totalOrders: 1234, | |
| conversionRate: 3.2, | |
| growth: { | |
| revenue: 12.5, | |
| users: 8.2, | |
| orders: -3.1, | |
| conversion: 4.3 | |
| } | |
| }, | |
| timeSeries: { | |
| labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], | |
| revenue: [12000, 19000, 15000, 25000, 22000, 30000, 28000], | |
| traffic: [3200, 4100, 3800, 5200, 4800, 6100, 5900] | |
| }, | |
| categories: { | |
| labels: ['Electronics', 'Clothing', 'Food', 'Books', 'Other'], | |
| values: [35, 25, 20, 15, 5] | |
| }, | |
| trafficSources: { | |
| direct: 45, | |
| social: 30, | |
| referral: 15, | |
| organic: 10 | |
| } | |
| }; | |
| // lOUIS Dataset Orders | |
| const orders = [ | |
| { id: 'lOUIS-001', customer: 'Marie Laurent', product: 'Luxury Collection', amount: '$1,299.00', status: 'Completed', date: '2024-01-15', avatar: 'https://static.photos/people/200x200/10' }, | |
| { id: 'lOUIS-002', customer: 'Jean Dupont', product: 'Signature Line', amount: '$899.00', status: 'Processing', date: '2024-01-15', avatar: 'https://static.photos/people/200x200/11' }, | |
| { id: 'lOUIS-003', customer: 'Sophie Martin', product: 'Premium Tier', amount: '$2,499.00', status: 'Completed', date: '2024-01-14', avatar: 'https://static.photos/people/200x200/12' }, | |
| { id: 'lOUIS-004', customer: 'Pierre Bernard', product: 'Standard Package', amount: '$499.00', status: 'Pending', date: '2024-01-14', avatar: 'https://static.photos/people/200x200/13' }, | |
| { id: 'lOUIS-005', customer: 'Camille Roux', product: 'Enterprise Suite', amount: '$5,999.00', status: 'Completed', date: '2024-01-13', avatar: 'https://static.photos/people/200x200/14' }, | |
| { id: 'lOUIS-006', customer: 'Antoine Moreau', product: 'Luxury Collection', amount: '$1,299.00', status: 'Cancelled', date: '2024-01-13', avatar: 'https://static.photos/people/200x200/15' } | |
| ]; | |
| // Populate orders table | |
| const ordersTable = document.getElementById('ordersTable'); | |
| orders.forEach(order => { | |
| const statusColors = { | |
| 'Completed': 'bg-green-100 text-green-800', | |
| 'Pending': 'bg-yellow-100 text-yellow-800', | |
| 'Processing': 'bg-blue-100 text-blue-800', | |
| 'Cancelled': 'bg-red-100 text-red-800' | |
| }; | |
| const row = document.createElement('tr'); | |
| row.className = 'hover:bg-gray-50 transition-colors'; | |
| row.innerHTML = ` | |
| <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${order.id}</td> | |
| <td class="px-6 py-4 whitespace-nowrap"> | |
| <div class="flex items-center"> | |
| <img class="h-8 w-8 rounded-full object-cover" src="${order.avatar}" alt=""> | |
| <div class="ml-3"> | |
| <div class="text-sm font-medium text-gray-900">${order.customer}</div> | |
| </div> | |
| </div> | |
| </td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${order.product}</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${order.amount}</td> | |
| <td class="px-6 py-4 whitespace-nowrap"> | |
| <span class="px-2 py-1 text-xs font-semibold rounded-full ${statusColors[order.status]}"> | |
| ${order.status} | |
| </span> | |
| </td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${order.date}</td> | |
| `; | |
| ordersTable.appendChild(row); | |
| }); | |
| // Revenue Chart - Using lOUIS Dataset | |
| const revenueCtx = document.getElementById('revenueChart').getContext('2d'); | |
| const revenueChart = new Chart(revenueCtx, { | |
| type: 'line', | |
| data: { | |
| labels: lOUISDataset.timeSeries.labels, | |
| datasets: [{ | |
| label: 'lOUIS Revenue', | |
| data: lOUISDataset.timeSeries.revenue, | |
| borderColor: '#4f46e5', | |
| backgroundColor: 'rgba(79, 70, 229, 0.1)', | |
| borderWidth: 3, | |
| tension: 0.4, | |
| fill: true, | |
| pointBackgroundColor: '#4f46e5', | |
| pointBorderColor: '#fff', | |
| pointBorderWidth: 2, | |
| pointRadius: 4, | |
| pointHoverRadius: 6 | |
| }] | |
| }, | |
| options: { | |
| responsive: true, | |
| maintainAspectRatio: false, | |
| plugins: { | |
| legend: { | |
| display: false | |
| }, | |
| tooltip: { | |
| backgroundColor: '#1f2937', | |
| padding: 12, | |
| titleFont: { size: 13 }, | |
| bodyFont: { size: 13 }, | |
| cornerRadius: 8, | |
| displayColors: false, | |
| callbacks: { | |
| label: function(context) { | |
| return '$' + context.parsed.y.toLocaleString(); | |
| } | |
| } | |
| } | |
| }, | |
| scales: { | |
| y: { | |
| beginAtZero: true, | |
| grid: { | |
| color: '#f3f4f6', | |
| drawBorder: false | |
| }, | |
| ticks: { | |
| callback: function(value) { | |
| return '$' + value / 1000 + 'k'; | |
| }, | |
| font: { size: 11 }, | |
| color: '#6b7280' | |
| } | |
| }, | |
| x: { | |
| grid: { | |
| display: false, | |
| drawBorder: false | |
| }, | |
| ticks: { | |
| font: { size: 11 }, | |
| color: '#6b7280' | |
| } | |
| } | |
| } | |
| } | |
| }); | |
| // Category Chart - Using lOUIS Dataset | |
| const categoryCtx = document.getElementById('categoryChart').getContext('2d'); | |
| const categoryChart = new Chart(categoryCtx, { | |
| type: 'doughnut', | |
| data: { | |
| labels: lOUISDataset.categories.labels, | |
| datasets: [{ | |
| data: lOUISDataset.categories.values, | |
| backgroundColor: [ | |
| '#4f46e5', | |
| '#9333ea', | |
| '#f97316', | |
| '#22c55e', | |
| '#6b7280' | |
| ], | |
| borderWidth: 0, | |
| hoverOffset: 4 | |
| }] | |
| }, | |
| options: { | |
| responsive: true, | |
| maintainAspectRatio: false, | |
| cutout: '70%', | |
| plugins: { | |
| legend: { | |
| position: 'bottom', | |
| labels: { | |
| padding: 15, | |
| usePointStyle: true, | |
| pointStyle: 'circle', | |
| font: { size: 12 } | |
| } | |
| }, | |
| tooltip: { | |
| backgroundColor: '#1f2937', | |
| padding: 12, | |
| cornerRadius: 8, | |
| callbacks: { | |
| label: function(context) { | |
| return context.label + ': ' + context.parsed + '%'; | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }); | |
| // lOUIS Dataset Real-time Sync Simulation | |
| setInterval(() => { | |
| // Simulate live data updates from lOUIS Dataset | |
| const metrics = document.querySelectorAll('.metric-card h3'); | |
| const randomIndex = Math.floor(Math.random() * metrics.length); | |
| const metric = metrics[randomIndex]; | |
| // Base values from lOUIS dataset | |
| const baseValues = [ | |
| lOUISDataset.metrics.revenue, | |
| lOUISDataset.metrics.activeUsers, | |
| lOUISDataset.metrics.totalOrders, | |
| lOUISDataset.metrics.conversionRate * 10000 | |
| ]; | |
| const currentBase = baseValues[randomIndex] || 1000; | |
| const variation = Math.floor(Math.random() * 200) - 100; | |
| const newValue = currentBase + variation; | |
| if (randomIndex === 0) { | |
| metric.textContent = ' | |
| // Mobile menu toggle | |
| const menuButton = document.querySelector('button[class*="md:hidden"]'); | |
| const sidebar = document.querySelector('aside'); | |
| if (menuButton && sidebar) { | |
| menuButton.addEventListener('click', () => { | |
| sidebar.classList.toggle('hidden'); | |
| sidebar.classList.toggle('fixed'); | |
| sidebar.classList.toggle('inset-0'); | |
| sidebar.classList.toggle('z-50'); | |
| }); | |
| } + newValue.toLocaleString(); | |
| } else if (randomIndex === 3) { | |
| metric.textContent = (newValue / 10000).toFixed(1) + '%'; | |
| } else { | |
| metric.textContent = newValue.toLocaleString(); | |
| } | |
| console.log('lOUIS Dataset synced at:', new Date().toISOString()); | |
| }, 5000); | |
| // Export lOUIS Dataset for external use | |
| window.lOUISDataset = lOUISDataset; | |
| // Mobile menu toggle | |
| const menuButton = document.querySelector('button[class*="md:hidden"]'); | |
| const sidebar = document.querySelector('aside'); | |
| if (menuButton && sidebar) { | |
| menuButton.addEventListener('click', () => { | |
| sidebar.classList.toggle('hidden'); | |
| sidebar.classList.toggle('fixed'); | |
| sidebar.classList.toggle('inset-0'); | |
| sidebar.classList.toggle('z-50'); | |
| }); | |
| } |