File size: 7,222 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
146
147
148
149
150
151
152
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Campaigns - 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 Campaigns</h1>
                <a href="/campaigns/new" 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> New Campaign
                </a>
            </div>

            <div class="bg-white shadow rounded-lg overflow-hidden">
                <div class="divide-y divide-gray-200">
                    <!-- Campaign List - will be populated dynamically -->
                    <div id="campaignList" class="divide-y divide-gray-200"></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 campaigns (mock data)
            const campaigns = [
                { id: 1, name: 'Tech News Roundup', status: 'active', progress: 65, deadline: '2023-12-15' },
                { id: 2, name: 'Social Media Highlights', status: 'active', progress: 42, deadline: '2023-12-20' },
                { id: 3, name: 'Product Launches', status: 'completed', progress: 100, deadline: '2023-11-30' }
            ];

            const campaignList = document.getElementById('campaignList');
            campaigns.forEach(campaign => {
                const campaignItem = document.createElement('div');
                campaignItem.className = 'p-6 hover:bg-gray-50 transition-colors';
                campaignItem.innerHTML = `
                    <div class="flex items-center justify-between">
                        <div>
                            <h3 class="text-lg font-medium text-gray-900">${campaign.name}</h3>
                            <p class="mt-1 text-sm text-gray-500">Deadline: ${campaign.deadline}</p>
                        </div>
                        <div class="flex items-center space-x-4">
                            <span class="px-2 py-1 text-xs font-semibold rounded-full ${campaign.status === 'active' ? 'bg-green-100 text-green-800' : 'bg-gray-100 text-gray-800'}">
                                ${campaign.status}
                            </span>
                            <div class="w-32">
                                <div class="flex justify-between text-xs text-gray-600 mb-1">
                                    <span>Progress</span>
                                    <span>${campaign.progress}%</span>
                                </div>
                                <div class="w-full bg-gray-200 rounded-full h-2">
                                    <div class="bg-primary h-2 rounded-full" style="width: ${campaign.progress}%"></div>
                                </div>
                            </div>
                            <a href="/campaigns/${campaign.id}" class="text-primary hover:text-secondary">
                                <i data-feather="chevron-right" class="h-5 w-5"></i>
                            </a>
                        </div>
                    </div>
                `;
                campaignList.appendChild(campaignItem);
            });
            
            feather.replace();
        });

        function logout() {
            localStorage.removeItem('isLoggedIn');
            localStorage.removeItem('userData');
            window.location.href = '/login';
        }
    </script>
</body>
</html>