diff --git a/apps/homepage/config/custom.css b/apps/homepage/config/custom.css index 826bac0..e36f34a 100644 --- a/apps/homepage/config/custom.css +++ b/apps/homepage/config/custom.css @@ -1,3 +1,24 @@ +.hp-kanban-section { + width: 100% !important; + flex-basis: 100% !important; + margin-top: 2rem !important; + display: block !important; +} + +.hp-section-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 1.5rem; + padding-bottom: 0.5rem; + border-bottom: 1px solid rgba(51, 65, 85, 0.5); +} + +.hp-section-header h2 { + margin: 0 !important; + font-size: 1.5rem !important; +} + .hp-kanban-board { display: flex; gap: 20px; @@ -10,35 +31,39 @@ background: rgba(15, 23, 42, 0.4); border: 1px solid rgba(51, 65, 85, 0.3); border-radius: 12px; - padding: 15px; - min-height: 220px; + padding: 20px; + min-height: 600px; /* Enforce min height for 3-4 courses */ backdrop-filter: blur(4px); + display: flex; + flex-direction: column; } .hp-kanban-col h3 { - font-size: 0.7rem; - margin: 0 0 12px 0; + font-size: 0.9rem !important; + margin: 0 0 1.5rem 0 !important; text-transform: uppercase; - color: #94a3b8; + color: #f1f5f9; text-align: center; letter-spacing: 0.1em; - font-weight: 800; - opacity: 0.8; + font-weight: 700; + padding-bottom: 0.5rem; + border-bottom: 2px solid rgba(56, 189, 248, 0.3); } .hp-kanban-list { display: flex; flex-direction: column; - gap: 10px; - min-height: 150px; + gap: 12px; + flex: 1; } .hp-kanban-card { background: rgba(30, 41, 59, 0.8); border: 1px solid rgba(51, 65, 85, 0.5); border-radius: 8px; - padding: 12px; + padding: 15px; cursor: grab; + position: relative; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); } @@ -50,44 +75,137 @@ } .hp-kanban-card-title { - font-size: 0.85rem; + font-size: 0.95rem; font-weight: 700; - margin-bottom: 4px; + margin-bottom: 6px; color: #f8fafc; + padding-right: 40px; } .hp-kanban-card-desc { - font-size: 0.75rem; + font-size: 0.8rem; color: #94a3b8; - margin-bottom: 10px; - line-height: 1.3; + margin-bottom: 12px; + line-height: 1.4; } .hp-kanban-card-links { display: flex; - gap: 12px; + flex-direction: column; + gap: 8px; border-top: 1px solid rgba(51, 65, 85, 0.3); - padding-top: 8px; - font-size: 0.7rem; + padding-top: 10px; } .hp-kanban-card-links a { - color: #60a5fa; text-decoration: none; font-weight: 600; + font-size: 0.75rem; + padding: 4px 8px; + border-radius: 4px; + text-align: center; } -.hp-kanban-card-links a:hover { - text-decoration: underline; +.milestone-link { + background: #3b82f6; + color: white !important; } +.hub-link { + background: rgba(51, 65, 85, 0.5); + color: #94a3b8 !important; +} + +.milestone-link:hover { background: #2563eb; } +.hub-link:hover { background: rgba(51, 65, 85, 0.8); color: white !important; } + .hp-kanban-card.dragging { opacity: 0.1; transform: scale(0.9); } -/* Hide the placeholder card that we use to spawn the section */ -section h2[title="Learning Hub"] + ul, -section h2[title="Learning Hub"] + .grid { +.hp-kanban-card-actions { + position: absolute; + top: 10px; + right: 10px; + display: flex; + gap: 6px; + opacity: 0; + transition: opacity 0.2s; +} + +.hp-kanban-card:hover .hp-kanban-card-actions { + opacity: 1; +} + +.hp-kanban-card-actions button { + background: none; + border: none; + cursor: pointer; + font-size: 0.8rem; +} + +.hp-add-btn { + background: #3b82f6; + color: white; + border: none; + padding: 6px 16px; + border-radius: 6px; + font-size: 0.85rem; + font-weight: 600; + cursor: pointer; + transition: background 0.2s; +} + +.hp-add-btn:hover { background: #2563eb; } + +/* Modal Styles */ +.hp-modal { + display: none; + position: fixed; + z-index: 10000; + inset: 0; + background: rgba(0,0,0,0.8); + backdrop-filter: blur(4px); + align-items: center; + justify-content: center; +} + +.hp-modal-content { + background: #1e293b; + padding: 2rem; + border-radius: 12px; + width: 90%; + max-width: 450px; + border: 1px solid #334155; +} + +.hp-form-group { margin-bottom: 1rem; } +.hp-form-group label { display: block; font-size: 0.8rem; color: #94a3b8; margin-bottom: 4px; } +.hp-form-group input, .hp-form-group textarea, .hp-form-group select { + width: 100%; + background: #0f172a; + border: 1px solid #334155; + color: white; + padding: 8px; + border-radius: 6px; +} + +.hp-modal-actions { + display: flex; + justify-content: flex-end; + gap: 12px; + margin-top: 1.5rem; +} + +.hp-modal-actions button { + padding: 8px 18px; + border-radius: 6px; + cursor: pointer; + font-weight: 600; +} + +.hp-kanban-board ~ ul, +.hp-kanban-board ~ .grid { display: none !important; } diff --git a/apps/homepage/config/custom.js b/apps/homepage/config/custom.js index 96094cf..d778508 100644 --- a/apps/homepage/config/custom.js +++ b/apps/homepage/config/custom.js @@ -1,5 +1,5 @@ /** - * Learning Kanban Native Integration for Homepage + * Learning Kanban Native Integration for Homepage (v4 - Autonomous & Anchorless) */ function getApiBase() { @@ -11,27 +11,25 @@ function getApiBase() { } const API_BASE = getApiBase(); +let allCourses = []; async function fetchCourses() { try { const response = await fetch(`${API_BASE}/api/courses`); - if (!response.ok) return []; - return await response.json(); + if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`); + allCourses = await response.json(); + return allCourses; } catch (e) { - console.error("Failed to fetch courses", e); + console.warn("Failed to fetch courses", e); return []; } } async function updateCourseStatus(courseId, newStatus) { try { - const res = await fetch(`${API_BASE}/api/courses`); - const courses = await res.json(); - const course = courses.find(c => c.id == courseId); + 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' }, @@ -45,64 +43,74 @@ async function updateCourseStatus(courseId, newStatus) { function createKanbanCard(course) { return `