Skip to content

Conversation

@ronaldwen07
Copy link

@ronaldwen07 ronaldwen07 commented Jan 18, 2026

Summary

This PR standardizes mobile detection across the application by consolidating all mobile breakpoint logic to use the useIsMobile() hook, which uses the Material-UI theme's 'sm' breakpoint (768px).

Problem

Previously, there were ~50 instances of "isMobile" across 14 files with inconsistent implementations:

  • Some components used MOBILE_BREAKPOINT constant set to 960px
  • Others used theme.breakpoints.down('sm') which is 768px
  • This created inconsistent mobile behavior across the application

Solution

  • ✅ Removed the old MOBILE_BREAKPOINT constant (960px) from globals.ts
  • ✅ Added comprehensive JSDoc documentation to useIsMobile hook
  • ✅ Updated all components to use the standardized useIsMobile() hook
  • ✅ Removed redundant useMediaQuery and useTheme imports

Changes Made

Updated 11 files:

  1. CourseRenderPane.tsx - Recruitment banner positioning
  2. SectionTable.tsx - Table column widths
  3. GpaCell.tsx - GPA popup display
  4. EnrollmentHistoryPopup.tsx - Graph sizing (2 instances)
  5. CourseInfoButton.tsx - Button layout
  6. EnrollmentColumnHeader.tsx - Tooltip display
  7. Home.tsx - Desktop/Mobile layout switcher
  8. ScheduleManagement.tsx - Tab navigation logic
  9. ScheduleManagementTab.tsx - Tab positioning
  10. useIsMobile.tsx - Added documentation
  11. globals.ts - Removed old constant

Test Plan

  • Verify mobile layout switches at 768px breakpoint across all pages
  • Test recruitment banner positioning on search page
  • Check section table column widths on mobile
  • Verify GPA popups display correctly
  • Test enrollment history graph sizing
  • Confirm schedule management tabs work on mobile and desktop
  • Verify home page switches between mobile/desktop layouts correctly

Fixes

Closes #930

This change consolidates all mobile detection logic to use the standardized `useIsMobile()` hook,
which uses the Material-UI theme's 'sm' breakpoint (768px). Previously, the codebase had
inconsistent implementations with some components using 960px and others using 768px.

Changes:
- Removed old MOBILE_BREAKPOINT constant (960px) from globals.ts
- Updated useIsMobile hook with comprehensive documentation
- Converted all useMediaQuery calls with theme.breakpoints.down('sm') to use useIsMobile hook
- Standardized mobile detection in 11 component files

This resolves issue #9930 by establishing a single source of truth for mobile breakpoint detection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create global, standard "isMobile" utility

1 participant