Spaces:
Running
Running
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Leaderboard - ClipsCompass</title> | |
| <link rel="icon" type="image/x-icon" href="/static/favicon.ico"> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> | |
| <script> | |
| tailwind.config = { | |
| theme: { | |
| extend: { | |
| colors: { | |
| primary: '#3B82F6', | |
| secondary: '#1E40AF', | |
| accent: '#10B981' | |
| } | |
| } | |
| } | |
| } | |
| </script> | |
| </head> | |
| <body class="bg-gray-50"> | |
| <!-- Navigation --> | |
| <nav class="bg-white shadow-sm border-b"> | |
| <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> | |
| <div class="flex justify-between h-16"> | |
| <div class="flex items-center"> | |
| <div class="flex-shrink-0 flex items-center"> | |
| <i data-feather="compass" class="h-8 w-8 text-primary"></i> | |
| <span class="ml-2 text-xl font-bold text-gray-900">ClipsCompass</span> | |
| </div> | |
| <div class="hidden md:ml-6 md:flex md:space-x-8" id="mainNavLinks"> | |
| <!-- Dynamic links will be inserted here by JavaScript --> | |
| </div> | |
| </div> | |
| <div class="flex items-center space-x-4"> | |
| <span class="text-sm text-gray-700" id="userName"></span> | |
| <div class="relative"> | |
| <button id="userMenuButton" class="flex items-center text-sm rounded-full focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary"> | |
| <img class="h-8 w-8 rounded-full" src="http://static.photos/people/200x200/1" alt="User profile"> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </nav> | |
| <div class="max-w-7xl mx-auto py-6 sm:px-6 lg:px-8"> | |
| <div class="px-4 py-6 sm:px-0"> | |
| <div class="mb-8"> | |
| <h1 class="text-2xl font-bold text-gray-900">Leaderboard</h1> | |
| <p class="text-gray-600">Top performers this week</p> | |
| </div> | |
| <div class="bg-white shadow rounded-lg overflow-hidden"> | |
| <div class="divide-y divide-gray-200"> | |
| <!-- Leaderboard will be populated dynamically --> | |
| <div id="leaderboardList"></div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', function() { | |
| feather.replace(); | |
| // Navigation setup | |
| const mainNavLinks = document.getElementById('mainNavLinks'); | |
| const currentPath = window.location.pathname; | |
| const navItems = [ | |
| { path: '/dashboard', name: 'Dashboard', icon: 'home' }, | |
| { path: '/campaigns', name: 'Campaigns', icon: 'target' }, | |
| { path: '/leaderboard', name: 'Leaderboard', icon: 'trending-up' }, | |
| { path: '/goals', name: 'Goals', icon: 'award' } | |
| ]; | |
| let navHTML = ''; | |
| navItems.forEach(item => { | |
| const isActive = currentPath === item.path; | |
| navHTML += ` | |
| <a href="${item.path}" class="${isActive ? 'border-primary text-gray-900' : 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700'} inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium"> | |
| <i data-feather="${item.icon}" class="h-4 w-4 mr-1"></i> | |
| ${item.name} | |
| </a> | |
| `; | |
| }); | |
| mainNavLinks.innerHTML = navHTML; | |
| feather.replace(); | |
| // Load user data | |
| const userData = JSON.parse(localStorage.getItem('userData') || '{}'); | |
| if (userData.fullName) { | |
| document.getElementById('userName').textContent = userData.fullName; | |
| } | |
| // Load leaderboard data (mock data) | |
| const leaderboardData = [ | |
| { rank: 1, name: 'Sarah Chen', points: 1245, avatar: 'http://static.photos/people/200x200/1' }, | |
| { rank: 2, name: 'Alex Johnson', points: 1089, avatar: 'http://static.photos/people/200x200/2' }, | |
| { rank: 3, name: 'Maria Garcia', points: 975, avatar: 'http://static.photos/people/200x200/3' }, | |
| { rank: 4, name: 'James Wilson', points: 856, avatar: 'http://static.photos/people/200x200/4' }, | |
| { rank: 5, name: 'Emma Davis', points: 789, avatar: 'http://static.photos/people/200x200/5' } | |
| ]; | |
| const leaderboardList = document.getElementById('leaderboardList'); | |
| leaderboardData.forEach(user => { | |
| const isCurrentUser = user.name === userData.fullName; | |
| const userItem = document.createElement('div'); | |
| userItem.className = `p-4 ${isCurrentUser ? 'bg-primary/10' : 'hover:bg-gray-50'} transition-colors`; | |
| userItem.innerHTML = ` | |
| <div class="flex items-center justify-between"> | |
| <div class="flex items-center"> | |
| <span class="text-lg font-medium ${user.rank <= 3 ? 'text-yellow-500' : 'text-gray-700'} mr-4 w-6 text-center">${user.rank}</span> | |
| <img class="h-10 w-10 rounded-full" src="${user.avatar}" alt="${user.name}"> | |
| <div class="ml-4"> | |
| <h3 class="text-sm font-medium text-gray-900">${user.name}</h3> | |
| <p class="text-sm text-gray-500">${user.points} points</p> | |
| </div> | |
| </div> | |
| ${user.rank <= 3 ? `<i data-feather="award" class="h-5 w-5 ${user.rank === 1 ? 'text-yellow-500' : user.rank === 2 ? 'text-gray-400' : 'text-yellow-700'}"></i>` : ''} | |
| </div> | |
| `; | |
| leaderboardList.appendChild(userItem); | |
| }); | |
| feather.replace(); | |
| }); | |
| function logout() { | |
| localStorage.removeItem('isLoggedIn'); | |
| localStorage.removeItem('userData'); | |
| window.location.href = '/login'; | |
| } | |
| </script> | |
| </body> | |
| </html> |