File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import Snackbar from '@mui/material/Snackbar';
77import { createTheme , ThemeProvider } from '@mui/material/styles' ;
88import Toolbar from '@mui/material/Toolbar' ;
99import Typography from '@mui/material/Typography' ;
10+ import useMediaQuery from '@mui/material/useMediaQuery' ;
1011import { platform } from '@tauri-apps/plugin-os' ;
1112import { BrowserRouter , Routes , Route } from 'react-router-dom' ;
1213import packageJson from '../../../package.json' ;
@@ -47,20 +48,18 @@ const App = () => {
4748 checkedForUpdates,
4849 } = state ;
4950
50- const [ drawerOpen , setDrawerOpen ] = useState ( false ) ;
51- const [ snackOpen , setSnackOpen ] = useState (
52- ! window . __TAURI__ && window . innerWidth > 600 ,
53- ) ;
54- const language = state . languages [ languageIndex ] ;
55-
5651 const color = ThemeSelector ( themeIndex ) ;
57-
5852 const theme = createTheme ( {
5953 palette : {
6054 primary : color ,
6155 mode : themeType ,
6256 } ,
6357 } ) ;
58+ const isMobile = useMediaQuery ( theme . breakpoints . down ( 'sm' ) ) ;
59+
60+ const [ drawerOpen , setDrawerOpen ] = useState ( false ) ;
61+ const [ snackOpen , setSnackOpen ] = useState ( ! window . __TAURI__ && ! isMobile ) ;
62+ const language = state . languages [ languageIndex ] ;
6463
6564 /**
6665 * Check for updates
Original file line number Diff line number Diff line change @@ -10,13 +10,17 @@ import Alert from '@mui/material/Alert';
1010import AlertTitle from '@mui/material/AlertTitle' ;
1111import Collapse from '@mui/material/Collapse' ;
1212import IconButton from '@mui/material/IconButton' ;
13+ import { useTheme } from '@mui/material/styles' ;
14+ import useMediaQuery from '@mui/material/useMediaQuery' ;
1315import { MainContext } from '../../contexts/MainContextProvider' ;
1416
1517const getRandomTipIndex = ( length ) =>
1618 length > 0 ? Math . floor ( Math . random ( ) * length ) : 0 ;
1719
1820const PasswordTips = ( ) => {
1921 const [ state ] = useContext ( MainContext ) ;
22+ const theme = useTheme ( ) ;
23+ const isMobile = useMediaQuery ( theme . breakpoints . down ( 'sm' ) ) ;
2024
2125 const { languageIndex, tips } = state ;
2226 const language = state . languages [ languageIndex ] ;
@@ -75,7 +79,7 @@ const PasswordTips = () => {
7579 } ;
7680
7781 return (
78- < Collapse in = { tips && tipsOpen } >
82+ < Collapse in = { tips && tipsOpen && ! isMobile } >
7983 < Alert
8084 severity = "info"
8185 action = {
Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ import MenuItem from '@mui/material/MenuItem';
88import Paper from '@mui/material/Paper' ;
99import Select from '@mui/material/Select' ;
1010import Snackbar from '@mui/material/Snackbar' ;
11+ import { useTheme } from '@mui/material/styles' ;
12+ import useMediaQuery from '@mui/material/useMediaQuery' ;
1113import { DataGrid } from '@mui/x-data-grid' ;
1214import { invoke } from '@tauri-apps/api/core' ;
1315import { save } from '@tauri-apps/plugin-dialog' ;
@@ -61,6 +63,8 @@ const Generate = () => {
6163
6264 const { languageIndex, loading, sortByStrength } = state1 ;
6365 const language = state1 . languages [ languageIndex ] ;
66+ const theme = useTheme ( ) ;
67+ const isMobile = useMediaQuery ( theme . breakpoints . down ( 'sm' ) ) ;
6468
6569 const [ exportType , setExportType ] = useState ( 'application/json' ) ;
6670 const [ snackOpen , setSnackOpen ] = useState ( false ) ;
@@ -307,6 +311,14 @@ const Generate = () => {
307311 < Container maxWidth = "xl" >
308312 < Paper style = { { height : '70vh' , width : '100%' } } >
309313 < DataGrid
314+ initialState = { {
315+ columns : {
316+ columnVisibilityModel : {
317+ length : ! isMobile ,
318+ strength : ! isMobile ,
319+ } ,
320+ } ,
321+ } }
310322 rows = { passwordRows }
311323 columns = { columns }
312324 pageSize = { 50 }
Original file line number Diff line number Diff line change @@ -11,8 +11,10 @@ import Container from '@mui/material/Container';
1111import FormControlLabel from '@mui/material/FormControlLabel' ;
1212import FormGroup from '@mui/material/FormGroup' ;
1313import Grid from '@mui/material/Grid' ;
14+ import { useTheme } from '@mui/material/styles' ;
1415import TextField from '@mui/material/TextField' ;
1516import Typography from '@mui/material/Typography' ;
17+ import useMediaQuery from '@mui/material/useMediaQuery' ;
1618import { useNavigate } from 'react-router-dom' ;
1719import LoadingBar from '../../components/LoadingBar' ;
1820import PasswordTips from '../../components/PasswordTips' ;
@@ -89,6 +91,9 @@ const Home = () => {
8991 min > max ||
9092 max < min ;
9193
94+ const theme = useTheme ( ) ;
95+ const isMobile = useMediaQuery ( theme . breakpoints . down ( 'sm' ) ) ;
96+
9297 /**
9398 * Generate passwords
9499 */
@@ -307,7 +312,7 @@ const Home = () => {
307312 </ Card >
308313 < Accordion
309314 sx = { { mt : 2 } }
310- defaultExpanded = { ! window . __TAURI__ && window . innerWidth > 600 }
315+ defaultExpanded = { ! window . __TAURI__ && ! isMobile }
311316 >
312317 < AccordionSummary
313318 expandIcon = { < ExpandMoreIcon /> }
You can’t perform that action at this time.
0 commit comments