Learning Progress Tracker
The Progress Tracker component helps learners monitor their progress through a series of tutorials or lessons. It provides visual feedback with progress percentages, estimated completion time, and persistent progress storage.
Featuresβ
β¨ Visual Progress Display: Circular progress indicator with percentage
π Statistics: Completed lessons, remaining lessons, and estimated time
πΎ Persistent Storage: Progress is saved to browser localStorage
β Lesson Management: Toggle completion status for each lesson
β±οΈ Time Estimation: Automatically calculates remaining study time
π Achievement Celebrations: Special message when all lessons are complete
π± Responsive Design: Works on mobile and desktop
Basic Usageβ
import ProgressTracker from '@site/src/components/ProgressTracker';
const lessons = [
{ id: 'lesson-1', title: 'Getting Started' },
{ id: 'lesson-2', title: 'Core Concepts' },
{ id: 'lesson-3', title: 'Advanced Topics' },
];
export default function Course() {
return <ProgressTracker seriesId="my-course" lessons={lessons} />;
}
With Durations and Descriptionsβ
const lessons = [
{
id: 'intro',
title: 'Course Introduction',
duration: 5,
description: 'Learn what you\'ll accomplish in this course'
},
{
id: 'setup',
title: 'Environment Setup',
duration: 15,
description: 'Install and configure necessary tools'
},
{
id: 'basics',
title: 'Fundamentals',
duration: 30,
description: 'Understand core concepts and principles'
},
];
export default function JavaScriptCourse() {
return (
<ProgressTracker
seriesId="javascript-course"
lessons={lessons}
/>
);
}
Example Progress Trackerβ
Learning Progress
Propsβ
| Prop | Type | Description |
|---|---|---|
seriesId | string | Unique ID for the course (used for localStorage key) |
lessons | array | Array of lesson objects |
onProgress | function | Callback when progress changes |
Lesson Object Structureβ
{
id: string, // Unique lesson identifier (required)
title: string, // Lesson title (required)
duration: number, // Duration in minutes (optional)
description: string // Lesson description (optional)
}
Featuresβ
Progress Visualizationβ
- Circular progress indicator showing completion percentage
- Progress bar showing visual completion status
- Statistics: completed/total lessons and estimated remaining time
Lesson Managementβ
- Click checkboxes to mark lessons complete/incomplete
- "Complete All" button to quickly finish remaining lessons
- "Reset" button to clear all progress (with confirmation)
- Collapsible lesson list for clean interface
Persistent Storageβ
- Progress automatically saved to localStorage
- Each course has separate storage using
seriesId - Progress persists across browser sessions
User Feedbackβ
- Completion count and percentage display
- Time estimate based on lesson duration
- Celebration message when course is complete
- Encouragement messages based on progress level
Time Estimationβ
Time estimates are calculated based on lesson duration values:
- Each lesson's individual duration (in minutes) is considered
- If duration is not provided, defaults to 0.5 hours per lesson
- Total estimated time = sum of uncompleted lesson durations
Callbacksβ
function handleProgress(completedLessons) {
console.log('Progress updated:', completedLessons);
// Optionally sync progress to backend
}
<ProgressTracker
seriesId="course"
lessons={lessons}
onProgress={handleProgress}
/>
Customizationβ
The component uses CSS variables for theming. Override these in your custom CSS:
:root {
--ifm-color-primary: #2e93e2;
--ifm-color-success: #22c55e;
--ifm-color-info: #3b82f6;
}
Accessibilityβ
- ARIA labels on all interactive elements
- Semantic HTML structure
- Keyboard navigation support
- Clear visual indicators for completed/incomplete lessons
- Collapsible sections with proper
aria-expandedattributes
Tipsβ
- Use consistent lesson IDs - they're used for localStorage keys
- Include duration estimates for accurate time calculations
- Add descriptions to help learners understand lesson content
- Use the
seriesIdto track different courses separately - Reset progress only when explicitly requested by the user
Storage Managementβ
Progress is stored in localStorage with key: tutorial_progress_{seriesId}
To manually clear progress:
localStorage.removeItem('tutorial_progress_my-course');
To export progress:
const progress = localStorage.getItem('tutorial_progress_my-course');
console.log(JSON.parse(progress));
Browser Compatibilityβ
Works on all modern browsers supporting:
- localStorage API
- CSS Grid and Flexbox
- ES6 JavaScript
Supported: Chrome 60+, Firefox 55+, Safari 11+, Edge 79+