Spaces:
Running
Running
File size: 6,684 Bytes
97645ee |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Goals - 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="flex justify-between items-center mb-8">
<h1 class="text-2xl font-bold text-gray-900">Your Goals</h1>
<button class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-primary hover:bg-secondary">
<i data-feather="plus" class="h-4 w-4 mr-2"></i> Set New Goal
</button>
</div>
<div class="bg-white shadow rounded-lg overflow-hidden">
<div class="divide-y divide-gray-200">
<!-- Goals will be populated dynamically -->
<div id="goalsList"></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 goals data (mock data)
const goals = [
{ id: 1, title: 'Daily Target', current: 12, target: 15, period: 'day' },
{ id: 2, title: 'Weekly Goal', current: 42, target: 50, period: 'week' },
{ id: 3, title: 'Monthly Objective', current: 165, target: 200, period: 'month' }
];
const goalsList = document.getElementById('goalsList');
goals.forEach(goal => {
const progress = Math.min(100, Math.round((goal.current / goal.target) * 100));
const goalItem = document.createElement('div');
goalItem.className = 'p-6 hover:bg-gray-50 transition-colors';
goalItem.innerHTML = `
<div>
<div class="flex justify-between items-center mb-2">
<h3 class="text-lg font-medium text-gray-900">${goal.title}</h3>
<span class="text-sm font-medium ${progress >= 100 ? 'text-accent' : 'text-primary'}">
${goal.current}/${goal.target} (${progress}%)
</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2.5">
<div class="bg-primary h-2.5 rounded-full" style="width: ${progress}%"></div>
</div>
<div class="mt-2 flex justify-between text-xs text-gray-500">
<span>${goal.period === 'day' ? 'Today' : goal.period === 'week' ? 'This week' : 'This month'}</span>
<span>${progress >= 100 ? 'Completed!' : `${goal.target - goal.current} to go`}</span>
</div>
</div>
`;
goalsList.appendChild(goalItem);
});
feather.replace();
});
function logout() {
localStorage.removeItem('isLoggedIn');
localStorage.removeItem('userData');
window.location.href = '/login';
}
</script>
</body>
</html> |