Spaces:
Running
for the course calendar section, could you create an actual cakendar view object with some courses as example:
Browse files[
{
"Course": "OFA400: Atlas Admin",
"Confirmed?": "Yes",
"Start Date": "25-Nov-25",
"End Date": "25-Nov-25",
"Time Zone": "MX CST",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "LATAM",
"Language": "Spanish",
"Instructor": "Virgilio De la Cruz Jard贸n",
"Event": "MX CST | 2025 Nov 25 | Spanish (OFA400)",
"ID": "c0caf703-35d5-4a9d-a561-5db9cb7d40ee"
},
{
"Course": "OFA500: Atlas API",
"Confirmed?": "Yes",
"Start Date": "26-Nov-25",
"End Date": "26-Nov-25",
"Time Zone": "MX CST",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "LATAM",
"Language": "Spanish",
"Instructor": "Virgilio De la Cruz Jard贸n",
"Event": "MX CST | 2025 Nov 26 | Spanish (OFA500)",
"ID": "4e805e95-4818-4b11-8dcb-7d77a9bfb016"
},
{
"Course": "DEV400: MongoDB Developer Extension",
"Confirmed?": "Yes",
"Start Date": "27-Nov-25",
"End Date": "27-Nov-25",
"Time Zone": "MX CST",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "LATAM",
"Language": "Spanish",
"Instructor": "Virgilio De la Cruz Jard贸n",
"Event": "MX CST | 2025 Nov 27 | Spanish (DEV400)",
"ID": "f9a7be49-8f08-48c6-8b17-227ac788fd68"
},
{
"Course": "OA620: Ops Manager Sizing Installation and Configuration (1-day)",
"Confirmed?": "Yes",
"Start Date": "1-Dec-25",
"End Date": "1-Dec-25",
"Time Zone": "FR CET",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "EMEA",
"Language": "French",
"Instructor": "Elie Yaacoub",
"Event": "FR CET | 2025 Dec 01 | French (OA620)",
"ID": "b400dc3c-65ed-4e37-89b4-de67b66f13f0"
},
{
"Course": "OA630: Self-Hosted Security",
"Confirmed?": "Yes",
"Start Date": "01-Dec-25",
"End Date": "01-Dec-25",
"Time Zone": "UK GMT",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "NEUR",
"Language": "English",
"Instructor": "Joe Nyirenda",
"Event": "UK GMT | 2025 Dec 01 | English (OA630)",
"ID": "c5eb9db7-8715-40ad-8615-b76b0785b2be"
},
{
"Course": "OFS400: Ops Manager Admin",
"Confirmed?": "Yes",
"Start Date": "2-Dec-25",
"End Date": "2-Dec-25",
"Time Zone": "FR CET",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "EMEA",
"Language": "French",
"Instructor": "Elie Yaacoub",
"Event": "FR CET | 2025 Dec 02 | French (OFS400)",
"ID": "a107c610-fbdc-404e-b95b-497556b3e295"
},
{
"Course": "MDB100: MongoDB Database and Security",
"Confirmed?": "Pending",
"Start Date": "8-Dec-25",
"End Date": "8-Dec-25",
"Time Zone": "US CST",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "AMER",
"Language": "English",
"Instructor": "Ann Duong",
"Event": "US CST | 2025 Dec 08 | English (MDB100)",
"ID": "ca5d29d0-1924-44b2-bf0d-ee6eb2ed631f"
},
{
"Course": "MDB100: MongoDB Database and Security",
"Confirmed?": "Pending",
"Start Date": "8-Dec-25",
"End Date": "8-Dec-25",
"Time Zone": "SG SGT",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "APAC",
"Language": "English",
"Instructor": "Jirachai Chansivanon",
"Event": "SG SGT | 2025 Dec 08 | English (MDB100)",
"ID": "56f03773-aa3f-4246-bc38-e0e50d9b67ec"
},
{
"Course": "MDB100: MongoDB Database and Security",
"Confirmed?": "Pending",
"Start Date": "8-Dec-25",
"End Date": "8-Dec-25",
"Time Zone": "UK GMT",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "EMEA",
"Language": "English",
"Instructor": "Joe Nyirenda",
"Event": "UK GMT | 2025 Dec 08 | English (MDB100)",
"ID": "915b651a-fd73-4b6c-8b20-f8a815c85006"
},
{
"Course": "MDB200: MongoDB Optimization and Performance",
"Confirmed?": "Pending",
"Start Date": "9-Dec-25",
"End Date": "9-Dec-25",
"Time Zone": "US CST",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "AMER",
"Language": "English",
"Instructor": "Ann Duong",
"Event": "US CST | 2025 Dec 09 | English (MDB200)",
"ID": "1d098b3b-229c-47c3-a22c-68dfd5f1ad2b"
},
{
"Course": "MDB200: MongoDB Optimization and Performance",
"Confirmed?": "Pending",
"Start Date": "9-Dec-25",
"End Date": "9-Dec-25",
"Time Zone": "SG SGT",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "APAC",
"Language": "English",
"Instructor": "Jirachai Chansivanon",
"Event": "SG SGT | 2025 Dec 09 | English (MDB200)",
"ID": "1df5cf37-e329-434f-a955-cd7866d40fbe"
},
{
"Course": "MDB200: MongoDB Optimization and Performance",
"Confirmed?": "Pending",
"Start Date": "9-Dec-25",
"End Date": "9-Dec-25",
"Time Zone": "UK GMT",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "EMEA",
"Language": "English",
"Instructor": "Joe Nyirenda",
"Event": "UK GMT | 2025 Dec 09 | English (MDB200)",
"ID": "87d323f0-d3cc-4e20-966d-f27deea2e0c6"
},
{
"Course": "MDB300: MongoDB Production Readiness",
"Confirmed?": "Pending",
"Start Date": "10-Dec-25",
"End Date": "10-Dec-25",
"Time Zone": "US CST",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "AMER",
"Language": "English",
"Instructor": "Ann Duong",
"Event": "US CST | 2025 Dec 10 | English (MDB300)",
"ID": "08ad6f17-7a2c-409f-ae45-6b850a2d3e53"
},
{
"Course": "MDB300: MongoDB Production Readiness",
"Confirmed?": "Pending",
"Start Date": "10-Dec-25",
"End Date": "10-Dec-25",
"Time Zone": "SG SGT",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "APAC",
"Language": "English",
"Instructor": "Jirachai Chansivanon",
"Event": "SG SGT | 2025 Dec 10 | English (MDB300)",
"ID": "bdc00053-9c45-4d0f-b932-60dfbd42dd86"
},
{
"Course": "MDB300: MongoDB Production Readiness",
"Confirmed?": "Pending",
"Start Date": "10-Dec-25",
"End Date": "10-Dec-25",
"Time Zone": "UK GMT",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "EMEA",
"Language": "English",
"Instructor": "Joe Nyirenda",
"Event": "UK GMT | 2025 Dec 10 | English (MDB300)",
"ID": "0280090c-3643-450d-a2a0-e72198edb9ed"
},
{
"Course": "DA630: Distributed Systems and Transactions (1-day)",
"Confirmed?": "Yes",
"Start Date": "10-Dec-25",
"End Date": "10-Dec-25",
"Time Zone": "MX CST",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "AMER",
"Language": "Spanish",
"Instructor": "Virgilio De la Cruz Jard贸n",
"Event": "MX CST | 2025 Dec 10 | Spanish (DA630)",
"ID": "8acc6ecf-86f8-40e2-816e-abc3b2bd11ee"
},
{
"Course": "DEV400: MongoDB Developer Extension",
"Confirmed?": "Pending",
"Start Date": "11-Dec-25",
"End Date": "11-Dec-25",
"Time Zone": "US CST",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "AMER",
"Language": "English",
"Instructor": "Ann Duong",
"Event": "US CST | 2025 Dec 11 | English (DEV400)",
"ID": "21a4a4e3-6415-4c54-8257-8139347e2bb0"
},
{
"Course": "DEV400: MongoDB Developer Extension",
"Confirmed?": "Pending",
"Start Date": "11-Dec-25",
"End Date": "11-Dec-25",
"Time Zone": "SG SGT",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "APAC",
"Language": "English",
"Instructor": "Jirachai Chansivanon",
"Event": "SG SGT | 2025 Dec 11 | English (DEV400)",
"ID": "af733e7c-8c45-49c9-a543-98539207cf8a"
},
{
"Course": "DEV400: MongoDB Developer Extension",
"Confirmed?": "Pending",
"Start Date": "11-Dec-25",
"End Date": "11-Dec-25",
"Time Zone": "UK GMT",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "EMEA",
"Language": "English",
"Instructor": "Joe Nyirenda",
"Event": "UK GMT | 2025 Dec 11 | English (DEV400)",
"ID": "1e40ed5b-a77c-49bd-9545-af956930d4fb"
},
{
"Course": "OA640: Atlas Security",
"Confirmed?": "Yes",
"Start Date": "11-Dec-25",
"End Date": "11-Dec-25",
"Time Zone": "MX CST",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "AMER",
"Language": "Spanish",
"Instructor": "Virgilio De la Cruz Jard贸n",
"Event": "MX CST | 2025 Dec 11 | Spanish (OA640)",
"ID": "a0eb02fe-bb35-4be8-b1fe-86a1db14c3f9"
},
{
"Course": "OFA400: Atlas Admin",
"Confirmed?": "Pending",
"Start Date": "12-Dec-25",
"End Date": "12-Dec-25",
"Time Zone": "US CST",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "AMER",
"Language": "English",
"Instructor": "Ann Duong",
"Event": "US CST | 2025 Dec 12 | English (OFA400)",
"ID": "b318921e-9991-4423-942f-16883397221d"
},
{
"Course": "OFA400: Atlas Admin",
"Confirmed?": "Pending",
"Start Date": "12-Dec-25",
"End Date": "12-Dec-25",
"Time Zone": "SG SGT",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "APAC",
"Language": "English",
"Instructor": "Jirachai Chansivanon",
"Event": "SG SGT | 2025 Dec 12 | English (OFA400)",
"ID": "566c2101-a91f-43db-9496-bfa671458d6e"
},
{
"Course": "OFA400: Atlas Admin",
"Confirmed?": "Pending",
"Start Date": "12-Dec-25",
"End Date": "12-Dec-25",
"Time Zone": "UK GMT",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "EMEA",
"Language": "English",
"Instructor": "Joe Nyirenda",
"Event": "UK GMT | 2025 Dec 12 | English (OFA400)",
"ID": "8cb8d36f-918c-45bb-830a-097e8c44c0b8"
},
{
"Course": "OA610: Benchmarking and Capacity Planning (1-day)",
"Confirmed?": "Pending",
"Start Date": "15-Dec-25",
"End Date": "15-Dec-25",
"Time Zone": "US CST",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "AMER",
"Language": "English",
"Instructor": "Ann Duong",
"Event": "US CST | 2025 Dec 15 | English (OA610)",
"ID": "c8c13309-2a64-4d30-bcb3-5d60db4b53ca"
},
{
"Course": "OA610: Benchmarking and Capacity Planning (1-day)",
"Confirmed?": "Pending",
"Start Date": "15-Dec-25",
"End Date": "15-Dec-25",
"Time Zone": "UK GMT",
"Time": "All Day (9:00 AM - 5:00 PM)",
"Region": "EMEA",
"Language": "English",
"Ins
- index.html +24 -22
- script.js +110 -59
- style.css +12 -7
|
@@ -183,35 +183,37 @@
|
|
| 183 |
</div>
|
| 184 |
</div>
|
| 185 |
</section>
|
| 186 |
-
|
| 187 |
<!-- Calendar View Section -->
|
| 188 |
<section class="mb-20">
|
| 189 |
<h2 class="text-3xl font-bold text-gray-800 mb-8 text-center">Course Calendar</h2>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
<div class="bg-white rounded-lg shadow overflow-hidden">
|
| 191 |
-
<div class="
|
| 192 |
-
<
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Time Zone</th>
|
| 200 |
-
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Time</th>
|
| 201 |
-
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Region</th>
|
| 202 |
-
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Language</th>
|
| 203 |
-
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Instructor</th>
|
| 204 |
-
</tr>
|
| 205 |
-
</thead>
|
| 206 |
-
<tbody class="bg-white divide-y divide-gray-200" id="course-calendar">
|
| 207 |
-
<!-- Courses will be loaded dynamically -->
|
| 208 |
-
</tbody>
|
| 209 |
-
</table>
|
| 210 |
</div>
|
|
|
|
| 211 |
</div>
|
| 212 |
</section>
|
| 213 |
-
|
| 214 |
-
<!-- Upcoming Courses Section -->
|
| 215 |
<section id="upcoming-courses" class="mb-20">
|
| 216 |
<h2 class="text-3xl font-bold text-gray-800 mb-8 text-center">Upcoming Courses</h2>
|
| 217 |
|
|
|
|
| 183 |
</div>
|
| 184 |
</div>
|
| 185 |
</section>
|
|
|
|
| 186 |
<!-- Calendar View Section -->
|
| 187 |
<section class="mb-20">
|
| 188 |
<h2 class="text-3xl font-bold text-gray-800 mb-8 text-center">Course Calendar</h2>
|
| 189 |
+
<div class="flex justify-center mb-6">
|
| 190 |
+
<div class="inline-flex rounded-md shadow-sm">
|
| 191 |
+
<button id="prev-month" class="px-4 py-2 text-sm font-medium rounded-l-lg border border-gray-300 hover:bg-gray-50">
|
| 192 |
+
<i data-feather="chevron-left"></i>
|
| 193 |
+
</button>
|
| 194 |
+
<div id="current-month-display" class="px-4 py-2 text-sm font-medium border-t border-b border-gray-300 bg-gray-100">
|
| 195 |
+
November 2025
|
| 196 |
+
</div>
|
| 197 |
+
<button id="next-month" class="px-4 py-2 text-sm font-medium rounded-r-lg border border-gray-300 hover:bg-gray-50">
|
| 198 |
+
<i data-feather="chevron-right"></i>
|
| 199 |
+
</button>
|
| 200 |
+
</div>
|
| 201 |
+
</div>
|
| 202 |
+
|
| 203 |
<div class="bg-white rounded-lg shadow overflow-hidden">
|
| 204 |
+
<div class="grid grid-cols-7 gap-px bg-gray-200">
|
| 205 |
+
<div class="bg-gray-100 p-2 text-center font-medium text-gray-700">Sun</div>
|
| 206 |
+
<div class="bg-gray-100 p-2 text-center font-medium text-gray-700">Mon</div>
|
| 207 |
+
<div class="bg-gray-100 p-2 text-center font-medium text-gray-700">Tue</div>
|
| 208 |
+
<div class="bg-gray-100 p-2 text-center font-medium text-gray-700">Wed</div>
|
| 209 |
+
<div class="bg-gray-100 p-2 text-center font-medium text-gray-700">Thu</div>
|
| 210 |
+
<div class="bg-gray-100 p-2 text-center font-medium text-gray-700">Fri</div>
|
| 211 |
+
<div class="bg-gray-100 p-2 text-center font-medium text-gray-700">Sat</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
</div>
|
| 213 |
+
<div id="calendar-days" class="grid grid-cols-7 gap-px bg-gray-200"></div>
|
| 214 |
</div>
|
| 215 |
</section>
|
| 216 |
+
<!-- Upcoming Courses Section -->
|
|
|
|
| 217 |
<section id="upcoming-courses" class="mb-20">
|
| 218 |
<h2 class="text-3xl font-bold text-gray-800 mb-8 text-center">Upcoming Courses</h2>
|
| 219 |
|
|
@@ -1,70 +1,121 @@
|
|
| 1 |
|
| 2 |
-
// Course data
|
| 3 |
const coursesData = [
|
| 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 |
-
id: "4e805e95-4818-4b11-8dcb-7d77a9bfb016"
|
| 32 |
-
},
|
| 33 |
-
// Add remaining courses...
|
| 34 |
];
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
-
|
| 44 |
-
const
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
</td>
|
| 50 |
-
<td class="px-6 py-4 whitespace-nowrap">
|
| 51 |
-
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${course.confirmed === 'Yes' ? 'bg-green-100 text-green-800' : 'bg-yellow-100 text-yellow-800'}">
|
| 52 |
-
${course.confirmed}
|
| 53 |
-
</span>
|
| 54 |
-
</td>
|
| 55 |
-
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${course.startDate}</td>
|
| 56 |
-
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${course.endDate}</td>
|
| 57 |
-
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${course.timeZone}</td>
|
| 58 |
-
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${course.time}</td>
|
| 59 |
-
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${course.region}</td>
|
| 60 |
-
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${course.language}</td>
|
| 61 |
-
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${course.instructor}</td>
|
| 62 |
-
`;
|
| 63 |
-
calendarBody.appendChild(row);
|
| 64 |
});
|
|
|
|
|
|
|
| 65 |
}
|
|
|
|
| 66 |
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
async function fetchCourses() {
|
| 69 |
try {
|
| 70 |
const response = await fetch('https://learn.mongodb.com/api/v1/instructor-led-training-schedule');
|
|
|
|
| 1 |
|
| 2 |
+
// Course data - using the provided JSON
|
| 3 |
const coursesData = [
|
| 4 |
+
{
|
| 5 |
+
"Course": "OFA400: Atlas Admin",
|
| 6 |
+
"Confirmed?": "Yes",
|
| 7 |
+
"Start Date": "25-Nov-25",
|
| 8 |
+
"End Date": "25-Nov-25",
|
| 9 |
+
"Time Zone": "MX CST",
|
| 10 |
+
"Time": "All Day (9:00 AM - 5:00 PM)",
|
| 11 |
+
"Region": "LATAM",
|
| 12 |
+
"Language": "Spanish",
|
| 13 |
+
"Instructor": "Virgilio De la Cruz Jard贸n",
|
| 14 |
+
"Event": "MX CST | 2025 Nov 25 | Spanish (OFA400)",
|
| 15 |
+
"ID": "c0caf703-35d5-4a9d-a561-5db9cb7d40ee"
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"Course": "OFA500: Atlas API",
|
| 19 |
+
"Confirmed?": "Yes",
|
| 20 |
+
"Start Date": "26-Nov-25",
|
| 21 |
+
"End Date": "26-Nov-25",
|
| 22 |
+
"Time Zone": "MX CST",
|
| 23 |
+
"Time": "All Day (9:00 AM - 5:00 PM)",
|
| 24 |
+
"Region": "LATAM",
|
| 25 |
+
"Language": "Spanish",
|
| 26 |
+
"Instructor": "Virgilio De la Cruz Jard贸n",
|
| 27 |
+
"Event": "MX CST | 2025 Nov 26 | Spanish (OFA500)",
|
| 28 |
+
"ID": "4e805e95-4818-4b11-8dcb-7d77a9bfb016"
|
| 29 |
+
},
|
| 30 |
+
// ... (all other courses from the provided JSON)
|
|
|
|
|
|
|
|
|
|
| 31 |
];
|
| 32 |
+
// Calendar functionality
|
| 33 |
+
let currentMonth = new Date().getMonth();
|
| 34 |
+
let currentYear = new Date().getFullYear();
|
| 35 |
|
| 36 |
+
function renderCalendar() {
|
| 37 |
+
const firstDay = new Date(currentYear, currentMonth, 1);
|
| 38 |
+
const lastDay = new Date(currentYear, currentMonth + 1, 0);
|
| 39 |
+
const daysInMonth = lastDay.getDate();
|
| 40 |
+
const startingDay = firstDay.getDay();
|
| 41 |
+
|
| 42 |
+
// Update month display
|
| 43 |
+
const monthNames = ['January', 'February', 'March', 'April', 'May', 'June',
|
| 44 |
+
'July', 'August', 'September', 'October', 'November', 'December'];
|
| 45 |
+
document.getElementById('current-month-display').textContent =
|
| 46 |
+
`${monthNames[currentMonth]} ${currentYear}`;
|
| 47 |
+
|
| 48 |
+
// Clear previous calendar
|
| 49 |
+
const calendarDays = document.getElementById('calendar-days');
|
| 50 |
+
calendarDays.innerHTML = '';
|
| 51 |
+
|
| 52 |
+
// Add empty cells for days before the first day of month
|
| 53 |
+
for (let i = 0; i < startingDay; i++) {
|
| 54 |
+
const cell = document.createElement('div');
|
| 55 |
+
cell.className = 'bg-white h-24 p-1';
|
| 56 |
+
calendarDays.appendChild(cell);
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
// Add days of month
|
| 60 |
+
for (let day = 1; day <= daysInMonth; day++) {
|
| 61 |
+
const cell = document.createElement('div');
|
| 62 |
+
cell.className = 'bg-white h-24 p-1 overflow-auto';
|
| 63 |
+
|
| 64 |
+
const date = new Date(currentYear, currentMonth, day);
|
| 65 |
+
const dateStr = date.toLocaleDateString('en-US', { day: '2-digit', month: 'short', year: 'numeric' });
|
| 66 |
+
|
| 67 |
+
// Add day number
|
| 68 |
+
const dayNumber = document.createElement('div');
|
| 69 |
+
dayNumber.className = 'font-semibold text-sm mb-1';
|
| 70 |
+
dayNumber.textContent = day;
|
| 71 |
+
cell.appendChild(dayNumber);
|
| 72 |
+
|
| 73 |
+
// Add courses for this day
|
| 74 |
+
const coursesToday = coursesData.filter(course => {
|
| 75 |
+
const courseDate = new Date(course['Start Date']);
|
| 76 |
+
return courseDate.getDate() === day &&
|
| 77 |
+
courseDate.getMonth() === currentMonth &&
|
| 78 |
+
courseDate.getFullYear() === currentYear;
|
| 79 |
+
});
|
| 80 |
|
| 81 |
+
coursesToday.forEach(course => {
|
| 82 |
+
const courseEl = document.createElement('div');
|
| 83 |
+
courseEl.className = 'text-xs p-1 mb-1 rounded bg-blue-50 border-l-4 border-blue-500 truncate';
|
| 84 |
+
courseEl.title = `${course.Course}\n${course.Time}\n${course.Instructor}`;
|
| 85 |
+
courseEl.textContent = course.Course;
|
| 86 |
+
cell.appendChild(courseEl);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
});
|
| 88 |
+
|
| 89 |
+
calendarDays.appendChild(cell);
|
| 90 |
}
|
| 91 |
+
}
|
| 92 |
|
| 93 |
+
// Initialize the page
|
| 94 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 95 |
+
renderCalendar();
|
| 96 |
+
|
| 97 |
+
// Month navigation
|
| 98 |
+
document.getElementById('prev-month').addEventListener('click', () => {
|
| 99 |
+
currentMonth--;
|
| 100 |
+
if (currentMonth < 0) {
|
| 101 |
+
currentMonth = 11;
|
| 102 |
+
currentYear--;
|
| 103 |
+
}
|
| 104 |
+
renderCalendar();
|
| 105 |
+
feather.replace();
|
| 106 |
+
});
|
| 107 |
+
|
| 108 |
+
document.getElementById('next-month').addEventListener('click', () => {
|
| 109 |
+
currentMonth++;
|
| 110 |
+
if (currentMonth > 11) {
|
| 111 |
+
currentMonth = 0;
|
| 112 |
+
currentYear++;
|
| 113 |
+
}
|
| 114 |
+
renderCalendar();
|
| 115 |
+
feather.replace();
|
| 116 |
+
});
|
| 117 |
+
});
|
| 118 |
+
// Fetch courses from MongoDB API
|
| 119 |
async function fetchCourses() {
|
| 120 |
try {
|
| 121 |
const response = await fetch('https://learn.mongodb.com/api/v1/instructor-led-training-schedule');
|
|
@@ -9,18 +9,23 @@ body {
|
|
| 9 |
.course-path-card:hover {
|
| 10 |
transform: translateY(-2px);
|
| 11 |
}
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
min-width: 1000px;
|
| 16 |
}
|
| 17 |
-
|
|
|
|
| 18 |
background-color: #f8fafc;
|
| 19 |
}
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
| 22 |
}
|
| 23 |
|
|
|
|
|
|
|
|
|
|
| 24 |
/* Animation for course cards */
|
| 25 |
@keyframes fadeIn {
|
| 26 |
from { opacity: 0; transform: translateY(20px); }
|
|
|
|
| 9 |
.course-path-card:hover {
|
| 10 |
transform: translateY(-2px);
|
| 11 |
}
|
| 12 |
+
/* Calendar styling */
|
| 13 |
+
#calendar-days > div {
|
| 14 |
+
min-height: 6rem;
|
|
|
|
| 15 |
}
|
| 16 |
+
|
| 17 |
+
#calendar-days > div:hover {
|
| 18 |
background-color: #f8fafc;
|
| 19 |
}
|
| 20 |
+
|
| 21 |
+
.calendar-course {
|
| 22 |
+
cursor: pointer;
|
| 23 |
+
transition: all 0.2s;
|
| 24 |
}
|
| 25 |
|
| 26 |
+
.calendar-course:hover {
|
| 27 |
+
background-color: #dbeafe;
|
| 28 |
+
}
|
| 29 |
/* Animation for course cards */
|
| 30 |
@keyframes fadeIn {
|
| 31 |
from { opacity: 0; transform: translateY(20px); }
|