From 3ac9c66869c18ab1ccbdbe0cc90b142cd18d23a0 Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Wed, 30 Jun 2021 15:32:49 +0530 Subject: Work in progress work in progress Desktop version completed Mobile version in progress Rebase PR Improvement in map device screen Minor improvement --- modern/src/MainPage.js | 223 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 188 insertions(+), 35 deletions(-) (limited to 'modern/src/MainPage.js') diff --git a/modern/src/MainPage.js b/modern/src/MainPage.js index 88608df..9740227 100644 --- a/modern/src/MainPage.js +++ b/modern/src/MainPage.js @@ -1,7 +1,19 @@ -import React from 'react'; -import { isWidthUp, makeStyles, withWidth } from '@material-ui/core'; -import Drawer from '@material-ui/core/Drawer'; -import ContainerDimensions from 'react-container-dimensions'; +import React, { useState } from 'react'; +import { useHistory } from 'react-router-dom'; +import classnames from 'classnames'; +import { makeStyles, withWidth, Paper, Toolbar, Grid, TextField, IconButton, Button } from '@material-ui/core'; + +import { useTheme } from '@material-ui/core/styles'; +import useMediaQuery from '@material-ui/core/useMediaQuery'; +import AddIcon from '@material-ui/icons/Add'; +import CloseIcon from '@material-ui/icons/Close'; +import ArrowBackIcon from '@material-ui/icons/ArrowBack'; +import ListIcon from '@material-ui/icons/List'; +import ReplayIcon from '@material-ui/icons/Replay'; +import DescriptionIcon from '@material-ui/icons/Description'; +import ShuffleIcon from '@material-ui/icons/Shuffle'; +import PersonIcon from '@material-ui/icons/Person'; + import DevicesList from './DevicesList'; import MainToolbar from './MainToolbar'; import Map from './map/Map'; @@ -10,22 +22,14 @@ import AccuracyMap from './map/AccuracyMap'; import GeofenceMap from './map/GeofenceMap'; import CurrentPositionsMap from './map/CurrentPositionsMap'; import CurrentLocationMap from './map/CurrentLocationMap'; +import t from './common/localization'; const useStyles = makeStyles((theme) => ({ root: { - height: '100%', + height: '100vh', display: 'flex', flexDirection: 'column', }, - content: { - flexGrow: 1, - overflow: 'hidden', - display: 'flex', - flexDirection: 'row', - [theme.breakpoints.down('xs')]: { - flexDirection: 'column-reverse', - }, - }, drawerPaper: { position: 'relative', [theme.breakpoints.up('sm')]: { @@ -36,36 +40,185 @@ const useStyles = makeStyles((theme) => ({ }, overflow: 'hidden', }, - mapContainer: { - flexGrow: 1, + listContainer: { + position: 'absolute', + left: theme.spacing(1.5), + top: theme.spacing(10.5), + width: theme.dimensions.drawerWidthDesktop, + zIndex: 1301, + height: '100%', + maxHeight: `calc(100vh - ${theme.spacing(20)}px)`, + [theme.breakpoints.down("md")]: { + top: theme.spacing(7), + left: '0px', + width: '100%', + maxHeight: `calc(100vh - ${theme.spacing(14)}px)`, + } + }, + paper: { + borderRadius: '0px', + }, + toolbar: { + paddingLeft: theme.spacing(2), + paddingRight: theme.spacing(2), + }, + deviceList: { + height: '100%', + }, + collapsed: { + transform: `translateX(-${360 + 16}px)`, + transition: 'transform .5s ease', + [theme.breakpoints.down("md")]: { + transform: `translateX(-100vw)`, + } + }, + uncollapsed: { + transform: `translateX(${theme.spacing(1.5)})`, + transition: 'transform .5s ease', + [theme.breakpoints.down("md")]: { + transform: `translateX(0)`, + } + }, + deviceButton: { + position: 'absolute', + left: theme.spacing(1), + top: theme.spacing(10.5), + borderRadius: '0px', + [theme.breakpoints.down("md")]: { + top: theme.spacing(7), + } + }, + bottomMenuContainer: { + position: 'absolute', + left: theme.spacing(1.5), + bottom: theme.spacing(1.5), + width: theme.dimensions.drawerWidthDesktop, + zIndex: 1301, + [theme.breakpoints.down("md")]: { + bottom: theme.spacing(0), + left: '0px', + width: '100%' + } + }, + menuButton: { + display: 'flex', + flexDirection: 'column', }, + iconText: { + fontSize: '0.75rem', + fontWeight: 'normal', + color: '#222222', + } })); const MainPage = ({ width }) => { const classes = useStyles(); + const history = useHistory(); + const theme = useTheme(); + + const [deviceName, setDeviceName] = useState(); + const [collapsed, setCollapsed] = useState(false); + + const matchesMD = useMediaQuery(theme.breakpoints.down('md')); + + const handleClose = () => { + setCollapsed(!collapsed); + } return (
-
- - - -
- - - - - - - - - -
+ + + + + + + + {collapsed && + + } +
+ + + + + + {matchesMD && + + + + } + + setDeviceName(event.target.value)} + placeholder="Search Devices" + variant='filled' /> + + + history.push('/device')}> + + + + {!matchesMD && + + + + } + + + + + + + + + + +
+
+ + + + + + + {t('reportReplay')} + + + + + + {t('reportTitle')} + + + + + + Options + + + + + + {t('settingsUser')} + + + + +
); -- cgit v1.2.3