The Course Comparison feature enables students to make informed decisions by directly evaluating multiple courses side by side. This feature provides visual metrics, detailed comparisons, and review highlights to help students choose the right courses.
- Compare up to 4 courses simultaneously
- Comprehensive comparison table showing:
- Course code and title
- Department
- Credits
- Overall rating with star visualization
- Difficulty rating with visual badge
- Workload rating with progress bar
- Number of reviews
Interactive charts powered by Recharts:
- Ratings Comparison Bar Chart: Compare overall rating, difficulty, and workload across all selected courses
- Multi-Metric Radar Chart: Visual overview of all metrics in a spider/radar chart format
- Course Credits Bar Chart: Compare credit hours across courses
Automated analysis of student reviews:
- Positive Feedback: Top 3 positive reviews (rating ≥ 4) for each course
- Areas for Improvement: Top 3 critical reviews (rating ≤ 2) for each course
- Recent Reviews: Latest student reviews with ratings and timestamps
- Tabbed Interface: Switch between courses to view their specific review highlights
- Navigate to
/courses/comparefrom the navbar - Click "Add course to compare" button
- Search and select courses from the dropdown (up to 4)
- View comparison tables, charts, and review highlights
- Use "Clear All" to reset selections
- Browse courses at
/courses - Click "Compare" button on any course card
- Course is added to comparison list (shown in floating button)
- Add more courses (up to 4)
- Click the floating "Compare Courses" button
- Automatically redirected to comparison page with selected courses
Navigate to /courses/compare?courses=courseId1,courseId2,courseId3
Main comparison page with:
- URL parameter support for preselecting courses
- Course selection UI
- Conditional rendering based on number of selected courses
- Integration of all comparison components
Searchable course selector:
- Command palette-style dropdown
- Real-time search filtering
- Badge display for selected courses
- Remove course functionality
- Maximum 4 courses limit enforcement
Side-by-side comparison table:
- Responsive table with horizontal scroll
- Sticky first column for metric labels
- Color-coded department badges
- Star ratings, difficulty badges, and progress bars
- Hover effects and modern styling
Visual charts component featuring:
- Bar chart for ratings comparison (recharts)
- Radar chart for multi-metric overview
- Credits comparison bar chart
- Responsive design
- Theme-aware styling
Review analysis component:
- Fetches reviews from Supabase
- Analyzes sentiment based on ratings
- Categorizes into pros/cons
- Tabbed interface for multiple courses
- Loading states and error handling
Two subcomponents:
- CompareButton: Add/remove course from comparison (on course cards)
- ComparisonFloatingButton: Floating action button with sheet/drawer
- Uses localStorage for persistence across page navigation
- Custom event system for state synchronization
- Local Storage: Persists comparison list across page navigation
- Custom Events:
comparison-list-updatedevent for cross-component synchronization - URL Parameters: Support for shareable comparison links
- Consistent with existing design system
- Uses shadcn/ui components
- Tailwind CSS for styling
- Backdrop blur effects and gradient accents
- Responsive design for mobile, tablet, and desktop
/src/app/courses/compare/page.tsx- Created comparison page/src/components/courses/compare/CourseSelector.tsx- Created course selector/src/components/courses/compare/ComparisonTable.tsx- Created comparison table/src/components/courses/compare/ComparisonCharts.tsx- Created charts component/src/components/courses/compare/ReviewHighlights.tsx- Created review highlights/src/components/courses/CompareButton.tsx- Created compare buttons/src/components/courses/ItemCard.tsx- Added compare button to course cards/src/app/courses/page.tsx- Added floating comparison button/src/components/layout/Navbar.tsx- Added "Compare" link to navbar
- recharts: For data visualization (bar charts, radar charts)
- @radix-ui components: For UI primitives (dropdown, sheet, tabs, etc.)
- lucide-react: For icons
- next/navigation: For routing and URL parameters
Potential improvements for the feature:
- Export Comparison: Allow users to export comparison as PDF or image
- Save Comparisons: Save comparison sets to user profile
- Share Comparisons: Generate shareable links with better formatting
- More Metrics: Add GPA distribution, professor ratings, prerequisites
- Smart Recommendations: Suggest similar courses based on selection
- Comparison History: Track previously compared courses
- Print Optimization: Better print styling for comparison tables
/courses/compare?courses=MAL401,MAL402
- Go to /courses
- Click "Compare" on CS101
- Click "Compare" on CS201
- Click floating "Compare Courses" button
- View detailed comparison
- Lazy Loading: Reviews are fetched only when comparison page is opened
- Optimistic Updates: UI updates immediately when adding/removing courses
- Memoization: Charts data is memoized to prevent unnecessary recalculations
- Pagination: Review highlights limited to top 10 reviews per course
- Semantic HTML structure
- ARIA labels on interactive elements
- Keyboard navigation support (via Radix UI)
- Color contrast compliance
- Screen reader friendly
- Modern browsers (Chrome, Firefox, Safari, Edge)
- Mobile browsers (iOS Safari, Chrome Mobile)
- Requires JavaScript enabled
- LocalStorage support required for comparison persistence
Created: January 2026 Version: 1.0.0 Author: GitHub Copilot