Modzeroo's picture
make all the pages that are in nav bar and make it dynamic
97645ee verified
<!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>