/** * Learning Kanban Native Integration for Homepage (v4 - Autonomous & Anchorless) */ function getApiBase() { return `https://learning.arch-services.mywire.org`; } const API_BASE = getApiBase(); let allCourses = []; async function fetchCourses() { try { const response = await fetch(`${API_BASE}/api/courses`); if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`); allCourses = await response.json(); return allCourses; } catch (e) { console.warn("Failed to fetch courses", e); return []; } } async function updateCourseStatus(courseId, newStatus) { try { const course = allCourses.find(c => c.id == courseId); if (!course) return; course.status = newStatus; await fetch(`${API_BASE}/api/courses/${courseId}`, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(course) }); } catch (e) { console.error("Failed to update course", e); } } function createKanbanCard(course) { return `
`; } async function renderKanban() { // Look for the main services grid - this is our insertion point const servicesGrid = document.getElementById('services'); if (!servicesGrid) return; // Check if we already created our section let section = document.getElementById('hp-learning-hub-section'); if (!section) { section = document.createElement('section'); section.id = 'hp-learning-hub-section'; section.className = 'hp-kanban-section'; // Insert after services grid servicesGrid.after(section); section.innerHTML = `