|
| 1 | +--- |
| 2 | +import lessonsData from '../data/lessons.yml'; |
| 3 | +
|
| 4 | +const lessons = (lessonsData as any).lessons.filter((l: any) => l.type !== 'external'); |
| 5 | +
|
| 6 | +// Helper to determine status |
| 7 | +const getStatus = (lesson: any, milestone: string) => { |
| 8 | + // 1. CAC Review |
| 9 | + if (milestone === 'cac') { |
| 10 | + const cacRec = lesson.recognition?.find((r: any) => |
| 11 | + r.title.includes('CAC') || |
| 12 | + r.desc.includes('Curriculum Advisory Committee') || |
| 13 | + r.title.includes('Governance Roadmap') |
| 14 | + ); |
| 15 | + |
| 16 | + if (cacRec) { |
| 17 | + if (cacRec.desc.toLowerCase().includes('scheduled')) { |
| 18 | + return { status: 'scheduled', label: 'Scheduled' }; |
| 19 | + } |
| 20 | + return { status: 'completed', label: 'Presented', title: cacRec.desc }; |
| 21 | + } |
| 22 | + return { status: 'pending', label: '' }; |
| 23 | + } |
| 24 | +
|
| 25 | + // 2. Alpha Pilot |
| 26 | + if (milestone === 'alpha') { |
| 27 | + if (lesson.status === 'Beta' || lesson.status === 'Stable' || lesson.library_carpentry_adopted) return { status: 'completed', label: 'Completed' }; |
| 28 | + |
| 29 | + const alphaPilot = lesson.pilots?.find((p: any) => p.type.toLowerCase().includes('alpha') || p.note?.toLowerCase().includes('alpha')); |
| 30 | + if (alphaPilot) return { status: 'completed', label: 'Completed' }; |
| 31 | + |
| 32 | + if (lesson.status.toLowerCase() === 'alpha') return { status: 'in-progress', label: 'In Progress' }; |
| 33 | + |
| 34 | + return { status: 'pending', label: '' }; |
| 35 | + } |
| 36 | +
|
| 37 | + // 3. Beta Pilot |
| 38 | + if (milestone === 'beta') { |
| 39 | + if (lesson.status === 'Stable' || lesson.library_carpentry_adopted) return { status: 'completed', label: 'Completed' }; |
| 40 | + |
| 41 | + const betaPilot = lesson.pilots?.find((p: any) => p.type.toLowerCase().includes('beta')); |
| 42 | + if (betaPilot) return { status: 'completed', label: 'Completed' }; |
| 43 | +
|
| 44 | + if (lesson.status === 'Beta') return { status: 'in-progress', label: 'In Progress' }; |
| 45 | + |
| 46 | + return { status: 'pending', label: '' }; |
| 47 | + } |
| 48 | +
|
| 49 | + // 4. Impact / Recognition (Actual outcomes: Pubs, Grants, etc) |
| 50 | + if (milestone === 'impact') { |
| 51 | + const impactKeywords = ['JeSLIB', 'Article', 'Publication', 'Grant', 'International', 'Proposal', 'Conference']; |
| 52 | + const achievement = lesson.recognition?.find((r: any) => |
| 53 | + impactKeywords.some(key => r.title.includes(key)) && |
| 54 | + !r.desc.toLowerCase().includes('scheduled') && |
| 55 | + !r.title.includes('CAC') |
| 56 | + ); |
| 57 | + |
| 58 | + if (achievement) { |
| 59 | + let label = 'Recognized'; |
| 60 | + if (achievement.title.includes('JeSLIB') || achievement.title.includes('Article')) label = 'Published'; |
| 61 | + if (achievement.title.includes('Grant')) label = 'Grant/Award'; |
| 62 | + return { status: 'completed', label: label, title: achievement.title }; |
| 63 | + } |
| 64 | +
|
| 65 | + return { status: 'pending', label: '' }; |
| 66 | + } |
| 67 | +
|
| 68 | + // 5. Adoption |
| 69 | + if (milestone === 'adoption') { |
| 70 | + if (lesson.library_carpentry_adopted) return { status: 'completed', label: 'Adopted' }; |
| 71 | + |
| 72 | + const incubator = lesson.recognition?.find((r: any) => r.title.includes('Incubator') || r.desc.includes('Incubator')); |
| 73 | + if (incubator) return { status: 'in-progress', label: 'Incubator' }; |
| 74 | + |
| 75 | + return { status: 'pending', label: '' }; |
| 76 | + } |
| 77 | +
|
| 78 | + return { status: 'pending', label: '' }; |
| 79 | +}; |
| 80 | +
|
| 81 | +const getIcon = (state: any) => { |
| 82 | + if (state.status === 'completed') return '<i class="fas fa-check-circle text-success"></i>'; |
| 83 | + if (state.status === 'in-progress') return '<i class="fas fa-spinner fa-spin text-primary"></i>'; |
| 84 | + if (state.status === 'scheduled') return '<i class="far fa-calendar-alt text-warning"></i>'; |
| 85 | + return '<i class="far fa-circle text-muted" style="opacity: 0.3;"></i>'; |
| 86 | +}; |
| 87 | +--- |
| 88 | + |
| 89 | +<section class="page-section bg-white" id="milestones"> |
| 90 | + <div class="container"> |
| 91 | + <div class="row mb-4"> |
| 92 | + <div class="col-lg-12 text-center"> |
| 93 | + <h2 class="section-heading text-uppercase">Lesson Status Dashboard</h2> |
| 94 | + <h3 class="section-subheading text-muted">Tracking the lifecycle of our curriculum from development to adoption.</h3> |
| 95 | + </div> |
| 96 | + </div> |
| 97 | + |
| 98 | + <div class="table-responsive shadow-sm"> |
| 99 | + <table class="table table-hover table-bordered mb-0"> |
| 100 | + <thead class="thead-light"> |
| 101 | + <tr> |
| 102 | + <th style="width: 35%;">Lesson</th> |
| 103 | + <th class="text-center">CAC Review</th> |
| 104 | + <th class="text-center">Alpha Pilot</th> |
| 105 | + <th class="text-center">Beta Pilot</th> |
| 106 | + <th class="text-center">Impact / Recognition</th> |
| 107 | + <th class="text-center">Adoption</th> |
| 108 | + </tr> |
| 109 | + </thead> |
| 110 | + <tbody> |
| 111 | + {lessons.map((lesson: any) => { |
| 112 | + const cac = getStatus(lesson, 'cac'); |
| 113 | + const alpha = getStatus(lesson, 'alpha'); |
| 114 | + const beta = getStatus(lesson, 'beta'); |
| 115 | + const impact = getStatus(lesson, 'impact'); |
| 116 | + const adoption = getStatus(lesson, 'adoption'); |
| 117 | + |
| 118 | + return ( |
| 119 | + <tr> |
| 120 | + <td class="align-middle"> |
| 121 | + <a href={`/lessons/${lesson.name.toLowerCase().replace(/[^a-z0-9]+/g, '-')}`} class="font-weight-bold text-dark"> |
| 122 | + {lesson.name} |
| 123 | + </a> |
| 124 | + </td> |
| 125 | + <td class="text-center align-middle" title={cac.title || cac.label}> |
| 126 | + <span set:html={getIcon(cac)} /> |
| 127 | + {cac.label && <div class="small text-muted mt-1">{cac.label}</div>} |
| 128 | + </td> |
| 129 | + <td class="text-center align-middle"> |
| 130 | + <span set:html={getIcon(alpha)} /> |
| 131 | + {alpha.label && <div class="small text-muted mt-1">{alpha.label}</div>} |
| 132 | + </td> |
| 133 | + <td class="text-center align-middle"> |
| 134 | + <span set:html={getIcon(beta)} /> |
| 135 | + {beta.label && <div class="small text-muted mt-1">{beta.label}</div>} |
| 136 | + </td> |
| 137 | + <td class="text-center align-middle" title={impact.title}> |
| 138 | + <span set:html={getIcon(impact)} /> |
| 139 | + {impact.label && <div class="small text-muted mt-1">{impact.label}</div>} |
| 140 | + </td> |
| 141 | + <td class="text-center align-middle"> |
| 142 | + <span set:html={getIcon(adoption)} /> |
| 143 | + {adoption.label && <div class="small text-muted mt-1">{adoption.label}</div>} |
| 144 | + </td> |
| 145 | + </tr> |
| 146 | + ); |
| 147 | + })} |
| 148 | + </tbody> |
| 149 | + </table> |
| 150 | + </div> |
| 151 | + |
| 152 | + <div class="row mt-3"> |
| 153 | + <div class="col-lg-12 text-center small text-muted"> |
| 154 | + <ul class="list-inline"> |
| 155 | + <li class="list-inline-item"><i class="fas fa-check-circle text-success"></i> Completed / Published</li> |
| 156 | + <li class="list-inline-item"><i class="fas fa-spinner text-primary"></i> In Progress</li> |
| 157 | + <li class="list-inline-item"><i class="far fa-calendar-alt text-warning"></i> Scheduled</li> |
| 158 | + <li class="list-inline-item"><i class="far fa-circle text-muted"></i> Pending</li> |
| 159 | + </ul> |
| 160 | + </div> |
| 161 | + </div> |
| 162 | + </div> |
| 163 | +</section> |
0 commit comments