import { useState, useEffect } from 'react'; import { createTheme, CssBaseline, ThemeProvider, Typography, Button, Box, CircularProgress, Select, MenuItem, FormControl, InputLabel, FormControlLabel, Checkbox, Alert } from '@mui/material'; import { GCDTable } from './components/GCDTable'; import { getNextInteger, getPreviousInteger, getInitialIntegerForViewport, INTEGERS } from './utils/integerUtils'; const theme = createTheme({ palette: { mode: 'light', primary: { main: '#1976d2', }, }, }); function App() { const [currentInteger, setCurrentInteger] = useState(() => getInitialIntegerForViewport()); const [isComputing, setIsComputing] = useState(true); const [showColorBar, setShowColorBar] = useState(false); const [isMobile, setIsMobile] = useState(false); // Detect mobile device useEffect(() => { const checkMobile = () => { const isMobileDevice = window.innerWidth < 768; // Standard tablet/mobile breakpoint setIsMobile(isMobileDevice); }; checkMobile(); window.addEventListener('resize', checkMobile); return () => window.removeEventListener('resize', checkMobile); }, []); const handleNextInteger = () => { setCurrentInteger(prev => getNextInteger(prev)); }; const handlePreviousInteger = () => { setCurrentInteger(prev => getPreviousInteger(prev)); }; return ( {/* Sidebar with controls */} GCD Table {isComputing && } Log GCD table for integers 1 to {currentInteger} Showing ({currentInteger} × {currentInteger}) grid Select Size Each cell (i, j) shows the value of log(gcd(i, j)) {isMobile ? ( This visualization is best viewed on a desktop. ) : ( setShowColorBar(e.target.checked)} /> } label="Show Color Bar" /> )} {/* Main content area */} ); } export default App;