clipscompass-navigator / dashboard.html
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>Dashboard - 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 src="https://cdn.jsdelivr.net/npm/chart.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">John Doe</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>
<script>
document.addEventListener('DOMContentLoaded', function() {
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;
document.getElementById('welcomeName').textContent = userData.fullName.split(' ')[0];
}
});
function logout() {
localStorage.removeItem('isLoggedIn');
localStorage.removeItem('userData');
window.location.href = '/login';
}
</script>
<div class="max-w-7xl mx-auto py-6 sm:px-6 lg:px-8">
<div class="px-4 py-6 sm:px-0">
<!-- Welcome Section -->
<div class="mb-8">
<h1 class="text-2xl font-bold text-gray-900">Welcome back, <span id="welcomeName">John</span>!</h1>
<p class="text-gray-600">Here's your campaign overview for today</p>
</div>
<!-- Stats Grid -->
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4">
<div class="bg-white overflow-hidden shadow rounded-lg transition-transform hover:scale-105">
<div class="p-4 sm:p-6">
<div class="flex items-center">
<div class="flex-shrink-0 bg-primary/10 p-2 rounded-full">
<i data-feather="target" class="h-5 w-5 sm:h-6 sm:w-6 text-primary"></i>
</div>
<div class="ml-4 flex-1 min-w-0">
<dt class="text-xs sm:text-sm font-medium text-gray-500 truncate">Active Campaigns</dt>
<dd class="text-base sm:text-lg font-semibold text-gray-900" id="activeCampaigns">12</dd>
</div>
</div>
</div>
</div>
<div class="bg-white overflow-hidden shadow rounded-lg transition-transform hover:scale-105">
<div class="p-4 sm:p-6">
<div class="flex items-center">
<div class="flex-shrink-0 bg-accent/10 p-2 rounded-full">
<i data-feather="check-circle" class="h-5 w-5 sm:h-6 sm:w-6 text-accent"></i>
</div>
<div class="ml-4 flex-1 min-w-0">
<dt class="text-xs sm:text-sm font-medium text-gray-500 truncate">Completed Today</dt>
<dd class="text-base sm:text-lg font-semibold text-gray-900" id="completedToday">8</dd>
</div>
</div>
</div>
</div>
<div class="bg-white overflow-hidden shadow rounded-lg transition-transform hover:scale-105">
<div class="p-4 sm:p-6">
<div class="flex items-center">
<div class="flex-shrink-0 bg-primary/10 p-2 rounded-full">
<i data-feather="trending-up" class="h-5 w-5 sm:h-6 sm:w-6 text-primary"></i>
</div>
<div class="ml-4 flex-1 min-w-0">
<dt class="text-xs sm:text-sm font-medium text-gray-500 truncate">Weekly Progress</dt>
<dd class="text-base sm:text-lg font-semibold text-gray-900" id="weeklyProgress">75%</dd>
</div>
</div>
</div>
</div>
<div class="bg-white overflow-hidden shadow rounded-lg transition-transform hover:scale-105">
<div class="p-4 sm:p-6">
<div class="flex items-center">
<div class="flex-shrink-0 bg-yellow-500/10 p-2 rounded-full">
<i data-feather="award" class="h-5 w-5 sm:h-6 sm:w-6 text-yellow-500"></i>
</div>
<div class="ml-4 flex-1 min-w-0">
<dt class="text-xs sm:text-sm font-medium text-gray-500 truncate">Team Rank</dt>
<dd class="text-base sm:text-lg font-semibold text-gray-900" id="teamRank">#2</dd>
</div>
</div>
</div>
</div>
</div>
<!-- Progress Section -->
<div class="mt-6 sm:mt-8 grid grid-cols-1 gap-4 sm:gap-5 lg:grid-cols-2">
<!-- Personal Progress -->
<div class="bg-white shadow rounded-lg">
<div class="p-4 sm:p-6">
<h3 class="text-base sm:text-lg leading-6 font-medium text-gray-900">Personal Progress</h3>
<div class="mt-3 sm:mt-4 space-y-3 sm:space-y-4">
<div>
<div class="flex justify-between text-xs sm:text-sm text-gray-600 mb-1">
<span>Daily Goal</span>
<span id="dailyGoalProgress">8/10</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-1.5 sm:h-2">
<div class="bg-primary h-1.5 sm:h-2 rounded-full" style="width: 80%"></div>
</div>
<div>
<div class="flex justify-between text-xs sm:text-sm text-gray-600 mb-1">
<span>Weekly Target</span>
<span id="weeklyTargetProgress">35/50</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-1.5 sm:h-2">
<div class="bg-accent h-1.5 sm:h-2 rounded-full" style="width: 70%"></div>
</div>
<div>
<div class="flex justify-between text-xs sm:text-sm text-gray-600 mb-1">
<span>Monthly Objective</span>
<span id="monthlyObjectiveProgress">120/200</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-1.5 sm:h-2">
<div class="bg-secondary h-1.5 sm:h-2 rounded-full" style="width: 60%"></div>
</div>
</div>
</div>
<!-- Recent Activity -->
<div class="bg-white shadow rounded-lg">
<div class="p-4 sm:p-6">
<h3 class="text-base sm:text-lg leading-6 font-medium text-gray-900">Recent Activity</h3>
<div class="mt-3 sm:mt-4 space-y-2 sm:space-y-3" id="recentActivity">
<div class="flex items-center text-xs sm:text-sm">
<i data-feather="check" class="h-3 w-3 sm:h-4 sm:w-4 text-accent mr-2"></i>
<span class="truncate">Completed campaign "Tech News Roundup"</span>
</div>
<div class="flex items-center text-xs sm:text-sm">
<i data-feather="plus" class="h-3 w-3 sm:h-4 sm:w-4 text-primary mr-2"></i>
<span class="truncate">Started new campaign "Social Media Highlights"</span>
</div>
<div class="flex items-center text-xs sm:text-sm">
<i data-feather="award" class="h-3 w-3 sm:h-4 sm:w-4 text-yellow-500 mr-2"></i>
<span class="truncate">Reached weekly goal milestone</span>
</div>
</div>
</div>
</div>
</div>
<!-- Quick Actions -->
<div class="mt-6 sm:mt-8">
<h3 class="text-base sm:text-lg leading-6 font-medium text-gray-900 mb-3 sm:mb-4">Quick Actions</h3>
<div class="grid grid-cols-1 gap-3 sm:grid-cols-3 sm:gap-4">
<a href="/campaigns" class="inline-flex items-center justify-center px-3 py-1.5 sm:px-4 sm:py-2 border border-transparent text-xs sm:text-sm font-medium rounded-md text-white bg-primary hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
<i data-feather="plus" class="h-3 w-3 sm:h-4 sm:w-4 mr-1 sm:mr-2"></i>
New Campaign
</a>
<a href="/goals" class="inline-flex items-center justify-center px-3 py-1.5 sm:px-4 sm:py-2 border border-gray-300 text-xs sm:text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
<i data-feather="target" class="h-3 w-3 sm:h-4 sm:w-4 mr-1 sm:mr-2"></i>
Set Goals
</a>
<a href="/leaderboard" class="inline-flex items-center justify-center px-3 py-1.5 sm:px-4 sm:py-2 border border-gray-300 text-xs sm:text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
<i data-feather="trending-up" class="h-3 w-3 sm:h-4 sm:w-4 mr-1 sm:mr-2"></i>
View Leaderboard
</a>
</div>
</div>
</div>
<script>
feather.replace();
// Mock data for dashboard
document.addEventListener('DOMContentLoaded', function() {
// Simulate API call to get user data
setTimeout(() => {
document.getElementById('userName').textContent = 'Sarah Chen';
document.getElementById('welcomeName').textContent = 'Sarah';
document.getElementById('activeCampaigns').textContent = '15';
document.getElementById('completedToday').textContent = '12';
document.getElementById('weeklyProgress').textContent = '85%';
document.getElementById('teamRank').textContent = '#1';
// Update progress bars
document.getElementById('dailyGoalProgress').textContent = '12/15';
document.getElementById('weeklyTargetProgress').textContent = '42/50';
document.getElementById('monthlyObjectiveProgress').textContent = '165/200';
}, 500);
});
</script>
</body>
</html>