Adaptive Learning Platform

Adaptive Learning Platform

Welcome to Your Learning Journey!

Start by selecting a subject and taking a short diagnostic assessment. We'll identify your strengths and weaknesses to create a personalized study plan just for you.

Study Zone: Recommended Topics

Your Progress Report

Topics to focus on: ${appState.weakTopics.join(', ') || 'None, great job!'}

`; // Chart const ctx = document.getElementById('progress-chart').getContext('2d'); if (appState.chartInstance) { appState.chartInstance.destroy(); } appState.chartInstance = new Chart(ctx, { type: 'bar', data: { labels: Object.keys(appState.topicScores), datasets: [{ label: 'Topic Proficiency (%)', data: Object.values(appState.topicScores), backgroundColor: Object.values(appState.topicScores).map(score => score < 75 ? '#fecaca' : '#bbf7d0'), // red-200 or green-200 borderColor: Object.values(appState.topicScores).map(score => score < 75 ? '#dc2626' : '#16a34a'), // red-600 or green-600 borderWidth: 1 }] }, options: { indexAxis: 'y', scales: { x: { beginAtZero: true, max: 100 } }, plugins: { legend: { display: false } } } }); } // --- PDF Generation --- async function generatePdfReport() { const button = document.getElementById('download-pdf-btn'); const originalText = button.textContent; button.disabled = true; button.textContent = 'Generating...'; const canvasChart = document.getElementById('progress-chart'); const chartImage = canvasChart.toDataURL('image/png', 1.0); let totalCorrect = 0, totalQuestions = 0; Object.values(appState.userAnswers).forEach(d => { totalCorrect += d.correct; totalQuestions += d.total; }); const overallScore = totalQuestions > 0 ? (totalCorrect / totalQuestions) * 100 : 0; const reportHtml = `

Academic Progress Report

Subject: ${appState.selectedSubject} • Date: ${new Date().toLocaleDateString()}

Performance Summary

${overallScore.toFixed(0)}%
Overall Score
${Object.keys(appState.topicScores).length}
Topics Assessed
${appState.weakTopics.length}
Areas for Review

Topic Proficiency Breakdown

`; const pdfTemplate = document.getElementById('pdf-template'); pdfTemplate.innerHTML = reportHtml; pdfTemplate.style.position = 'absolute'; pdfTemplate.style.left = '-9999px'; pdfTemplate.classList.remove('invisible'); try { const { jsPDF } = window.jspdf; const canvas = await html2canvas(pdfTemplate.querySelector('.pdf-report-container'), { scale: 2, backgroundColor: '#ffffff', useCORS: true }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = (canvas.height * pdfWidth) / canvas.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); pdf.save('Adaptive_Learning_Report.pdf'); } catch(e) { console.error(e); alert('Error generating PDF.'); } finally { pdfTemplate.style.position = ''; pdfTemplate.style.left = '-left-full'; pdfTemplate.classList.add('invisible'); button.disabled = false; button.textContent = originalText; } } init(); });
Scroll to Top