File size: 19,404 Bytes
a1db777
fd1b73f
 
 
 
 
 
a1db777
 
fd1b73f
a1db777
fd1b73f
 
 
 
 
 
 
 
 
a1db777
 
 
 
 
 
 
 
fd1b73f
a1db777
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
874a8e2
 
 
 
 
 
 
a1db777
 
 
 
874a8e2
fd1b73f
a1db777
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fd1b73f
a1db777
 
 
 
 
 
 
 
 
 
 
 
fd1b73f
 
a1db777
 
 
 
 
 
 
4125a93
 
 
 
a1db777
 
 
 
 
 
4125a93
a1db777
4125a93
 
a1db777
 
4125a93
 
 
 
 
 
 
 
 
 
a1db777
4125a93
 
a1db777
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fd1b73f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a1db777
1c185a3
 
 
 
 
a1db777
 
 
 
 
 
 
1c185a3
fd1b73f
1c185a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fd1b73f
 
1c185a3
 
 
 
 
fd1b73f
1c185a3
 
 
 
 
 
 
 
 
a1db777
1c185a3
 
 
 
 
 
 
 
 
 
 
 
 
a1db777
fd1b73f
a1db777
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406

<!DOCTYPE html>
<html lang="en" class="dark">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>All Activities | DevPulse Radar</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></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>
    <style>
        .card-glass {
            backdrop-filter: blur(10px);
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.1);
        }
    </style>
</head>
<body class="bg-gray-900 text-gray-100 min-h-screen">
    <div class="flex h-screen">
        <!-- Sidebar -->
        <nav class="w-64 bg-gray-800 border-r border-gray-700 hidden md:block">
            <div class="p-4 border-b border-gray-700">
                <div class="flex items-center space-x-2">
                    <i data-feather="activity" class="text-primary w-6 h-6"></i>
                    <span class="text-xl font-bold">DevPulse Radar</span>
                </div>
            </div>
            <div class="p-4">
                <ul class="space-y-2">
                    <li>
                        <a href="dashboard.html" class="flex items-center space-x-3 px-3 py-2 hover:bg-gray-700 rounded-lg transition">
                            <i data-feather="home" class="w-5 h-5"></i>
                            <span>Dashboard</span>
                        </a>
                    </li>
                    <li>
                        <a href="approval.html" class="flex items-center space-x-3 px-3 py-2 hover:bg-gray-700 rounded-lg transition">
                            <i data-feather="check-circle" class="w-5 h-5"></i>
                            <span>Task Approval</span>
                        </a>
                    </li>
                    <li>
                        <a href="manual.html" class="flex items-center space-x-3 px-3 py-2 hover:bg-gray-700 rounded-lg transition">
                            <i data-feather="plus-circle" class="w-5 h-5"></i>
                            <span>Manual Add</span>
                        </a>
                    </li>
                    <li>
                        <a href="allactivities.html" class="flex items-center space-x-3 px-3 py-2 bg-gray-700 rounded-lg text-primary">
                            <i data-feather="list" class="w-5 h-5"></i>
                            <span>All Activities</span>
                        </a>
                    </li>
                    <li>
                        <a href="export.html" class="flex items-center space-x-3 px-3 py-2 hover:bg-gray-700 rounded-lg transition">
                            <i data-feather="download" class="w-5 h-5"></i>
                            <span>Export</span>
                        </a>
                    </li>
                    <li>
                        <a href="settings.html" class="flex items-center space-x-3 px-3 py-2 hover:bg-gray-700 rounded-lg transition">
                            <i data-feather="settings" class="w-5 h-5"></i>
                            <span>Settings</span>
                        </a>
                    </li>
</ul>
            </div>
        </nav>

        <!-- Main Content -->
        <div class="flex-1 overflow-auto">
            <!-- Top Navigation -->
            <header class="sticky top-0 z-10 bg-gray-800 border-b border-gray-700 p-4">
                <div class="flex justify-between items-center">
                    <div class="flex items-center space-x-4">
                        <button class="md:hidden">
                            <i data-feather="menu" class="w-5 h-5"></i>
                        </button>
                        <div class="relative w-full max-w-md">
                            <i data-feather="search" class="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-500 w-5 h-5"></i>
                            <input type="text" placeholder="Search activities..." class="w-full bg-gray-700 border-none pl-10 pr-4 py-2 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent">
                        </div>
                    </div>
                    <div class="flex items-center space-x-4">
                        <button class="relative">
                            <i data-feather="bell" class="w-5 h-5"></i>
                            <span class="absolute top-0 right-0 w-2 h-2 bg-primary rounded-full"></span>
                        </button>
                        <div class="flex items-center space-x-2">
                            <div class="w-8 h-8 rounded-full bg-primary flex items-center justify-center">
                                <span class="text-sm font-medium">JD</span>
                            </div>
                            <span class="hidden md:inline">John Developer</span>
                            <i data-feather="chevron-down" class="w-4 h-4 hidden md:inline"></i>
                        </div>
                    </div>
                </div>
            </header>
            <!-- All Activities Content -->
            <main class="p-6">
                <div class="mb-8">
                    <h2 class="text-2xl font-bold mb-2">All Activities</h2>
                    <p class="text-gray-400">Comprehensive view of all your developer activities</p>
                </div>
                <div class="mb-8">
                    <div class="grid grid-cols-1 sm:grid-cols-2 gap-4 mb-4">
                        <div class="relative">
                            <label for="filter-type" class="block text-xs text-gray-400 mb-1">Type</label>
                            <select id="filter-type" class="w-full bg-gray-800 border border-gray-700 rounded-lg px-4 py-2 appearance-none">
                                <option value="all">All Types</option>
                                <option value="commit">Commits</option>
                                <option value="pr">Pull Requests</option>
                                <option value="task">Tasks</option>
                            </select>
                            <i data-feather="chevron-down" class="absolute right-3 top-7 w-4 h-4 pointer-events-none"></i>
                        </div>
                        <button id="apply-filter" class="bg-primary hover:bg-primary/90 px-4 py-2 rounded-lg font-medium transition sm:mt-6">
                            Apply Filters
                        </button>
                    </div>
                    <div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
                        <div class="relative">
                            <label for="date-from" class="block text-xs text-gray-400 mb-1">Date From</label>
                            <input type="date" id="date-from" class="w-full bg-gray-800 border border-gray-700 rounded-lg px-4 py-2">
                        </div>
                        <div class="relative">
                            <label for="date-to" class="block text-xs text-gray-400 mb-1">Date To</label>
                            <input type="date" id="date-to" class="w-full bg-gray-800 border border-gray-700 rounded-lg px-4 py-2">
                        </div>
                    </div>
                </div>
                <div class="grid grid-cols-1 gap-2 sm:gap-4 mt-4" id="activities-container">
<!-- Activities will be loaded here via JavaScript -->
                </div>

                <!-- Pagination -->
                <div class="flex justify-center mt-8">
                    <div class="flex items-center space-x-2" id="pagination">
                        <button id="prevPage" class="px-4 py-2 rounded-md hover:bg-gray-800 transition disabled:opacity-50" disabled>
                            <i data-feather="chevron-left" class="w-4 h-4"></i>
                        </button>
                        <div class="flex space-x-1" id="pageNumbers"></div>
                        <button id="nextPage" class="px-4 py-2 rounded-md hover:bg-gray-800 transition">
                            <i data-feather="chevron-right" class="w-4 h-4"></i>
                        </button>
                    </div>
                </div>
            </main>
        </div>
    </div>
    <!-- Activity Detail Modal -->
    <div id="activityModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
        <div class="bg-gray-800 rounded-xl border border-gray-700 p-6 max-w-2xl w-full mx-4">
            <div class="flex justify-between items-start mb-6">
                <h3 class="text-xl font-bold" id="modalTitle">Activity Details</h3>
                <button onclick="closeModal()">
                    <i data-feather="x" class="w-6 h-6"></i>
                </button>
            </div>
            
            <div class="space-y-4" id="modalContent">
                <!-- Content will be dynamically loaded here -->
            </div>
        </div>
    </div>

    <script>
        feather.replace();

        function showActivityDetail(activityId) {
            const modal = document.getElementById('activityModal');
            const modalTitle = document.getElementById('modalTitle');
            const modalContent = document.getElementById('modalContent');
            
            const activities = {
                1: {
                    title: "Fixed login bug",
                    type: "commit",
                    description: "Fixed issue with login form validation not handling empty fields correctly",
                    date: "2 hours ago",
                    from: "GitHub",
                    repo: "main-repo",
                    commit: "#a1b2c3d"
                },
                2: {
                    title: "Feature/new-dashboard",
                    type: "pr",
                    description: "Implemented new dashboard UI components with responsive design",
                    date: "1 day ago",
                    from: "GitLab",
                    pr: "#42",
                    branch: "feature/new-dashboard"
                },
                3: {
                    title: "Complete auth flow",
                    type: "task",
                    description: "Finished implementing authentication flow including JWT validation",
                    date: "3 days ago",
                    from: "Jira",
                    task: "PROJ-123",
                    time: "4 hours"
                }
            };

            const activity = activities[activityId];
            modalTitle.textContent = activity.title;
            
            let content = `
                <div class="flex items-center space-x-2">
                    <span class="px-2 py-1 bg-gray-700 rounded text-sm">${activity.from}</span>
                    <span class="text-sm text-gray-400">${activity.date}</span>
                </div>
                <div class="bg-gray-700 rounded-lg p-4">
                    <p>${activity.description}</p>
                </div>
            `;

            if (activity.type === 'commit') {
                content += `
                    <div class="grid grid-cols-2 gap-4">
                        <div>
                            <p class="text-sm text-gray-400">Repository</p>
                            <p>${activity.repo}</p>
                        </div>
                        <div>
                            <p class="text-sm text-gray-400">Commit</p>
                            <p>${activity.commit}</p>
                        </div>
                    </div>
                `;
            } else if (activity.type === 'pr') {
                content += `
                    <div class="grid grid-cols-2 gap-4">
                        <div>
                            <p class="text-sm text-gray-400">Pull Request</p>
                            <p>${activity.pr}</p>
                        </div>
                        <div>
                            <p class="text-sm text-gray-400">Branch</p>
                            <p>${activity.branch}</p>
                        </div>
                    </div>
                `;
            } else if (activity.type === 'task') {
                content += `
                    <div class="grid grid-cols-2 gap-4">
                        <div>
                            <p class="text-sm text-gray-400">Task ID</p>
                            <p>${activity.task}</p>
                        </div>
                        <div>
                            <p class="text-sm text-gray-400">Time Spent</p>
                            <p>${activity.time}</p>
                        </div>
                    </div>
                `;
            }

            modalContent.innerHTML = content;
            modal.classList.remove('hidden');
        }

        function closeModal() {
            document.getElementById('activityModal').classList.add('hidden');
        }

        // Sample data - in a real app this would come from an API
        const sampleActivities = [
            { id: 1, title: "Fixed login bug", type: "commit", date: new Date(Date.now() - 2 * 60 * 60 * 1000) },
            { id: 2, title: "Feature/new-dashboard", type: "pr", date: new Date(Date.now() - 24 * 60 * 60 * 1000) },
            { id: 3, title: "Complete auth flow", type: "task", date: new Date(Date.now() - 3 * 24 * 60 * 60 * 1000) },
            { id: 4, title: "Updated documentation", type: "task", date: new Date(Date.now() - 1 * 24 * 60 * 60 * 1000) },
            { id: 5, title: "Refactored API endpoints", type: "commit", date: new Date(Date.now() - 5 * 60 * 60 * 1000) },
            { id: 6, title: "Fixed CSS issues", type: "commit", date: new Date(Date.now() - 8 * 60 * 60 * 1000) },
            { id: 7, title: "PR #45: Database migration", type: "pr", date: new Date(Date.now() - 2 * 24 * 60 * 60 * 1000) },
            { id: 8, title: "BUG-77: Fix login redirect", type: "task", date: new Date(Date.now() - 4 * 24 * 60 * 60 * 1000) },
            { id: 9, title: "Added unit tests", type: "commit", date: new Date(Date.now() - 6 * 60 * 60 * 1000) },
            { id: 10, title: "PR #38: Update dependencies", type: "pr", date: new Date(Date.now() - 3 * 24 * 60 * 60 * 1000) }
        ];

        let currentPage = 1;
        const activitiesPerPage = 10;
        let filteredActivities = [...sampleActivities];

        function renderActivities() {
            const container = document.getElementById('activities-container');
            container.innerHTML = '';

            const startIndex = (currentPage - 1) * activitiesPerPage;
            const endIndex = startIndex + activitiesPerPage;
            const paginatedActivities = filteredActivities.slice(startIndex, endIndex);

            paginatedActivities.forEach(activity => {
                const activityElement = document.createElement('div');
                activityElement.className = 'card-glass p-4 rounded-lg hover:bg-gray-800/50 transition cursor-pointer';
                activityElement.onclick = () => showActivityDetail(activity.id);

                let icon, iconClass;
                if (activity.type === 'commit') {
                    icon = 'git-commit';
                    iconClass = 'text-primary';
                } else if (activity.type === 'pr') {
                    icon = 'git-pull-request';
                    iconClass = 'text-purple-500';
                } else {
                    icon = 'check-circle';
                    iconClass = 'text-green-500';
                }

                activityElement.innerHTML = `
                    <div class="flex items-start space-x-3">
                        <div class="${iconClass}/10 p-2 rounded-lg flex-shrink-0">
                            <i data-feather="${icon}" class="${iconClass} w-5 h-5"></i>
                        </div>
                        <div class="flex-1">
                            <div class="flex justify-between">
                                <h3 class="font-medium">${activity.title}</h3>
                                <span class="text-sm text-gray-400">${formatDate(activity.date)}</span>
                            </div>
                            <p class="text-sm text-gray-400 mt-1">From ${getSource(activity.type)}</p>
                        </div>
                    </div>
                `;
                container.appendChild(activityElement);
            });

            renderPagination();
            feather.replace();
        }

        function formatDate(date) {
            const diff = Date.now() - date.getTime();
            const hours = Math.floor(diff / (1000 * 60 * 60));
            const days = Math.floor(diff / (1000 * 60 * 60 * 24));

            if (hours < 24) return `${hours} hours ago`;
            return `${days} days ago`;
        }

        function getSource(type) {
            return type === 'commit' ? 'GitHub' : 
                   type === 'pr' ? 'GitLab' : 'Jira';
        }

        function renderPagination() {
            const pageCount = Math.ceil(filteredActivities.length / activitiesPerPage);
            const pageNumbers = document.getElementById('pageNumbers');
            pageNumbers.innerHTML = '';

            for (let i = 1; i <= pageCount; i++) {
                const pageBtn = document.createElement('button');
                pageBtn.className = `px-4 py-2 rounded-md ${i === currentPage ? 'bg-primary' : 'hover:bg-gray-800'}`;
                pageBtn.textContent = i;
                pageBtn.onclick = () => {
                    currentPage = i;
                    renderActivities();
                };
                pageNumbers.appendChild(pageBtn);
            }

            document.getElementById('prevPage').disabled = currentPage === 1;
            document.getElementById('nextPage').disabled = currentPage === pageCount;
        }

        document.getElementById('prevPage').addEventListener('click', () => {
            if (currentPage > 1) {
                currentPage--;
                renderActivities();
            }
        });

        document.getElementById('nextPage').addEventListener('click', () => {
            if (currentPage * activitiesPerPage < filteredActivities.length) {
                currentPage++;
                renderActivities();
            }
        });

        // Filter functionality
        document.getElementById('apply-filter').addEventListener('click', () => {
            const typeFilter = document.getElementById('filter-type').value;
            const dateFrom = document.getElementById('date-from').value;
            const dateTo = document.getElementById('date-to').value;

            filteredActivities = sampleActivities.filter(activity => {
                if (typeFilter !== 'all' && activity.type !== typeFilter) return false;
                
                const activityDate = activity.date.toISOString().split('T')[0];
                if (dateFrom && activityDate < dateFrom) return false;
                if (dateTo && activityDate > dateTo) return false;

                return true;
            });

            currentPage = 1;
            renderActivities();
        });

        // Initial render
        renderActivities();
    </script>
</body>
</html>