-
Notifications
You must be signed in to change notification settings - Fork 1
/
script.js
482 lines (456 loc) · 12.4 KB
/
script.js
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
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
// ====================================================
// Name: Coding Journey Dashboard
// Author: JohnDev19
// Last Update: December 2024
// License: MIT
// ====================================================
///////////////////////////////////////////////////////
// AOS
AOS.init({
duration: 1000,
once: true
});
document.addEventListener('DOMContentLoaded', () => {
// Learning progress chart
const ctx1 = document.getElementById('learningChart').getContext('2d');
new Chart(ctx1, {
type: 'line',
data: {
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
datasets: [{
label: 'Learning Hours',
data: [12, 19, 3, 5, 2, 3],
backgroundColor: 'rgba(59, 130, 246, 0.5)',
borderColor: '#3b82f6',
tension: 0.4,
fill: true,
pointBackgroundColor: '#3b82f6',
pointBorderColor: '#94a3b8',
pointHoverBackgroundColor: '#8b5cf6',
pointHoverRadius: 7
}]
},
options: {
responsive: true,
scales: {
x: {
grid: {
color: 'rgba(255,255,255,0.1)'
},
ticks: {
color: '#94a3b8'
}
},
y: {
grid: {
color: 'rgba(255,255,255,0.1)'
},
ticks: {
color: '#94a3b8',
callback: function(value) {
return `${value} hrs`;
}
},
beginAtZero: true
}
},
plugins: {
legend: {
position: 'top',
labels: {
color: '#94a3b8',
font: {
size: 12
}
}
},
title: {
display: true,
text: 'Monthly Learning Progress',
color: '#94a3b8',
font: {
size: 16,
weight: 'bold'
}
},
tooltip: {
backgroundColor: 'rgba(26,41,66,0.8)',
titleColor: '#94a3b8',
bodyColor: '#94a3b8',
borderColor: '#94a3b8',
borderWidth: 1
}
},
animation: {
duration: 2000,
easing: 'easeInOutQuart'
},
interaction: {
mode: 'nearest',
intersect: false
},
elements: {
point: {
radius: 5,
hoverRadius: 8
}
}
}
});
// Code progression line chart
const ctx4 = document.getElementById('codeProgressionChart').getContext('2d');
const codeProgressionChart = new Chart(ctx4, {
type: 'line',
data: {
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
datasets: [{
label: 'Lines of Code',
data: [500, 1200, 2500, 4000, 6000, 8500],
borderColor: '#40d675',
backgroundColor: 'rgba(64, 214, 117, 0.2)',
tension: 0.4,
fill: true,
pointBackgroundColor: '#40d675',
pointBorderColor: '#40d675',
pointHoverBackgroundColor: '#3b82f6',
pointHoverBorderColor: '#3b82f6'
},
{
label: 'Complexity Score',
data: [30, 45, 60, 75, 85, 95],
borderColor: '#8b5cf6',
backgroundColor: 'rgba(139, 92, 246, 0.2)',
tension: 0.4,
fill: true,
pointBackgroundColor: '#8b5cf6',
pointBorderColor: '#8b5cf6',
pointHoverBackgroundColor: '#3b82f6',
pointHoverBorderColor: '#3b82f6'
}]
},
options: {
responsive: true,
animation: {
duration: 2000,
easing: 'easeInOutQuart'
},
scales: {
y: {
beginAtZero: true,
ticks: {
color: '#94a3b8'
},
grid: {
color: 'rgba(255,255,255,0.1)'
}
},
x: {
ticks: {
color: '#94a3b8'
},
grid: {
display: false
}
}
},
plugins: {
legend: {
labels: {
color: '#94a3b8'
}
},
tooltip: {
backgroundColor: 'rgba(26,41,66,0.8)',
titleColor: '#94a3b8',
bodyColor: '#94a3b8'
}
}
}
});
// Skill metrics radar chart
const ctx2 = document.getElementById('skillChart').getContext('2d');
new Chart(ctx2, {
type: 'radar',
data: {
labels: ['JavaScript', 'Python', 'React', 'Node.js', 'SQL', 'Git'],
datasets: [{
label: 'Current Skill Level',
data: [4, 3, 5, 4, 2, 4],
backgroundColor: 'rgba(59, 130, 246, 0.5)',
borderColor: '#3b82f6',
borderWidth: 2
},
{
label: 'Target Skill Level',
data: [5, 4, 5, 5, 4, 5],
backgroundColor: 'rgba(139, 92, 246, 0.5)',
borderColor: '#8b5cf6',
borderWidth: 2
}]
},
options: {
responsive: true,
elements: {
line: {
borderWidth: 3
}
},
scales: {
r: {
angleLines: {
display: false
},
suggestedMin: 0,
suggestedMax: 5,
grid: {
color: 'rgba(255,255,255,0.1)'
},
pointLabels: {
color: '#94a3b8',
font: {
size: 12,
weight: 'bold'
}
},
ticks: {
color: '#94a3b8',
backdropColor: 'transparent'
}
}
},
plugins: {
legend: {
labels: {
color: '#94a3b8',
font: {
size: 12
}
}
},
tooltip: {
backgroundColor: 'rgba(26,41,66,0.8)',
titleColor: '#94a3b8',
bodyColor: '#94a3b8',
borderColor: '#94a3b8',
borderWidth: 1
}
},
animation: {
duration: 1500,
easing: 'easeInOutQuart'
}
}
});
// Active projects
const projectList = document.getElementById('project-list');
const projects = [{
name: 'E-commerce Website', status: 'In Progress'
},
{
name: 'Mobile App', status: 'Completed'
},
{
name: 'API Integration', status: 'Not Started'
},
{
name: 'Machine Learning Model', status: 'In Progress'
},
{
name: 'Database Optimization', status: 'In Progress'
}];
projects.forEach(project => {
const listItem = document.createElement('li');
listItem.className = 'task-item';
listItem.innerHTML = `
<span>${project.name}</span>
<span class="task-status status-${project.status.toLowerCase().replace(' ', '-')}">${project.status}</span>
`;
projectList.appendChild(listItem);
});
// Upcoming deadlines
const deadlineList = document.getElementById('deadline-list');
const deadlines = [{
task: 'Project Proposal', date: '2024-07-15'
},
{
task: 'Code Review', date: '2024-07-20'
},
{
task: 'Final Submission', date: '2024-07-31'
},
{
task: 'Team Presentation', date: '2024-08-05'
},
{
task: 'Client Meeting', date: '2024-08-10'
}];
deadlines.forEach(deadline => {
const listItem = document.createElement('li');
listItem.className = 'task-item';
listItem.innerHTML = `
<span>${deadline.task}</span>
<span>${deadline.date}</span>
`;
deadlineList.appendChild(listItem);
});
// Learning recommendations
const recommendationList = document.getElementById('recommendation-list');
const recommendations = [{
course: 'Advanced React Patterns', difficulty: 'Intermediate'
},
{
course: 'Machine Learning Fundamentals', difficulty: 'Advanced'
},
{
course: 'GraphQL API Design', difficulty: 'Intermediate'
},
{
course: 'Blockchain Development', difficulty: 'Advanced'
},
{
course: 'Cybersecurity Basics', difficulty: 'Beginner'
}];
recommendations.forEach(recommendation => {
const listItem = document.createElement('li');
listItem.className = 'task-item';
listItem.innerHTML = `
<span>${recommendation.course}</span>
<span class="task-status">${recommendation.difficulty}</span>
`;
recommendationList.appendChild(listItem);
});
// Notification system (optional)
// function showNotification(message, icon = 'fa-info-circle') {
// const notification = document.createElement('div');
// notification.className = 'notification';
// notification.innerHTML = `
// <i class="fas ${icon}"></i>
// <span>${message}</span>
// `;
// document.getElementById('notificationCenter').appendChild(notification);
// notification.offsetHeight;
// notification.classList.add('show');
//
// setTimeout(() => {
// notification.classList.remove('show');
// setTimeout(() => {
// notification.remove();
// }, 300);
// }, 3000);
// }
// Single notification
// setTimeout(() => showNotification('New course recommendation available!', 'fa-graduation-cap'), 2000);
// Sidebar
document.querySelectorAll('.sidebar-nav-item').forEach(item => {
item.addEventListener('click', function() {
document.querySelector('.sidebar-nav-item.active').classList.remove('active');
this.classList.add('active');
});
});
// Progress bar
function updateProgressBar() {
const progressBar = document.querySelector('.progress-bar-fill');
let width = 0;
const interval = setInterval(() => {
if (width >= 75) {
clearInterval(interval);
} else {
width++;
progressBar.style.width = width + '%';
}
},
20);
}
updateProgressBar();
// Mobile menu toggle
const menuToggle = document.getElementById('menuToggle');
const sidebar = document.getElementById('sidebar');
const sidebarClose = document.getElementById('sidebarClose');
menuToggle.addEventListener('click',
() => {
sidebar.classList.add('active');
menuToggle.style.display = 'none';
});
sidebarClose.addEventListener('click',
() => {
sidebar.classList.remove('active');
menuToggle.style.display = 'flex';
});
document.addEventListener('click',
(e) => {
if (window.innerWidth <= 768 && !sidebar.contains(e.target) && e.target !== menuToggle) {
sidebar.classList.remove('active');
menuToggle.style.display = 'flex';
}
});
// Resize handler
function handleResize() {
if (window.innerWidth > 768) {
sidebar.classList.remove('active');
menuToggle.style.display = 'none';
} else {
menuToggle.style.display = 'flex';
}
}
window.addEventListener('resize', handleResize);
handleResize();
// Coding activity calendar
const calendarContainer = document.getElementById('coding-calendar');
const days = 35; // 5 weeks
for (let i = 0; i < days; i++) {
const day = document.createElement('div');
day.className = 'calendar-day';
const activity = Math.random();
if (activity > 0.7) {
day.classList.add('activity-activity-high');
} else if (activity > 0.4) {
day.classList.add('activity-medium');
} else if (activity > 0.1) {
day.classList.add('activity-low');
}
calendarContainer.appendChild(day);
}
// Leaderboard
const leaderboardList = document.getElementById('leaderboard-list');
const leaderboardData = [{
rank: 1,
name: 'Ethan',
score: 2500,
avatar: 'assets/images/message_avatar5.jpg'
},
{
rank: 2,
name: 'Charlie',
score: 2350,
avatar: 'assets/images/message_avatar3.jpg'
},
{
rank: 3,
name: 'Alice',
score: 2200,
avatar: 'assets/images/message_avatar1.jpg'
},
{
rank: 4,
name: 'Fiona',
score: 2100,
avatar: 'assets/images/message_avatar6.jpg'
},
{
rank: 5,
name: 'Diana',
score: 2000,
avatar: 'assets/images/message_avatar4.jpg'
}];
leaderboardData.forEach(user => {
const listItem = document.createElement('li');
listItem.className = 'leaderboard-item';
listItem.innerHTML = `
<span class="leaderboard-rank">${user.rank}</span>
<img src="${user.avatar}" alt="${user.name}" class="leaderboard-avatar">
<span class="leaderboard-name">${user.name}</span>
<span class="leaderboard-score">${user.score}</span>
`;
leaderboardList.appendChild(listItem);
});
});