Skip to content

Latest commit

 

History

History
75 lines (54 loc) · 2.84 KB

File metadata and controls

75 lines (54 loc) · 2.84 KB

Discount Progress Indicator - Implementation Summary

Overview

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


Files Changed

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

How It Works

  1. User views the enrollment sidebar on any course page
  2. Clicking a pricing plan card toggles it as "selected"
  3. Selected plan prices are summed into currentSpend
  4. DiscountProgressBar receives currentSpend and computes progress toward tiers

Discount Tiers

Threshold Reward Icon
$49.99 Free Support Upgrade Truck
$99.99 10% Off Your Order Tag
$149.99 Free Bonus Course Gift

Acceptance Criteria

  • 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 Coverage

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.tsx

Last Updated: May 2026
Status: ✅ COMPLETE
Tests: ✅ PASSING
Accessibility: ✅ WCAG 2.1 AA
Performance: ✅ No overhead