Adds a tiered discount progress bar to the EnrollmentCTA component. As users
select pricing plans, the bar updates in real-time to show how close they are
to unlocking spending-based rewards.
Completion Status: ✅ COMPLETE
| File | Type | Description |
|---|---|---|
src/app/components/courses/DiscountProgressBar.tsx |
New | Core discount progress bar component |
src/app/components/courses/EnrollmentCTA.tsx |
Modified | Wired spend tracking + renders DiscountProgressBar |
src/app/components/courses/__tests__/DiscountProgressBar.test.tsx |
New | Unit + boundary tests |
- User views the enrollment sidebar on any course page
- Clicking a pricing plan card toggles it as "selected"
- Selected plan prices are summed into
currentSpend DiscountProgressBarreceivescurrentSpendand computes progress toward tiers
| Threshold | Reward | Icon |
|---|---|---|
| $49.99 | Free Support Upgrade | Truck |
| $99.99 | 10% Off Your Order | Tag |
| $149.99 | Free Bonus Course | Gift |
- Progress Indicators properly implements Discount Management
- All related tests pass
- No regression in existing functionality (PurchaseModal, onEnroll, enrolledPlanId all preserved)
- Code follows project coding standards (Tailwind, lucide-react, dark mode tokens)
- Documentation updated (this file)
- Performance impact is minimal (pure client-side useState, zero API calls)
- Accessibility guidelines followed (role="progressbar", aria-valuenow/min/max, aria-label, role="region")
- Security considerations addressed (no user input accepted, no external calls, no data exfiltration)
| Test | What it checks |
|---|---|
| No spend state | Shows "away from" next tier message |
| First tier unlock | $49.99 shows ✓ Unlocked |
| All tiers unlocked | $200 shows 🎉 All rewards unlocked |
| Aria attributes | progressbar role has correct min/max |
| Float boundary | $49.99 + $50.00 correctly hits tier 2 |
Run tests:
pnpm vitest run src/app/components/courses/__tests__/DiscountProgressBar.test.tsxLast Updated: May 2026
Status: ✅ COMPLETE
Tests: ✅ PASSING
Accessibility: ✅ WCAG 2.1 AA
Performance: ✅ No overhead