From 5d81e6dfe6f7e6fd9579f2527f83b27c5494b887 Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Fri, 14 May 2021 18:02:48 +0530 Subject: Initial Report Sidebar Draft --- modern/src/reports/ReportLayoutPage.js | 107 +++++++++++++++++++++++++++------ 1 file changed, 88 insertions(+), 19 deletions(-) diff --git a/modern/src/reports/ReportLayoutPage.js b/modern/src/reports/ReportLayoutPage.js index e5eda05..c5e13fd 100644 --- a/modern/src/reports/ReportLayoutPage.js +++ b/modern/src/reports/ReportLayoutPage.js @@ -1,18 +1,41 @@ -import React from 'react'; -import { Grid, Paper, makeStyles } from '@material-ui/core'; -import MainToolbar from '../MainToolbar'; +import React, { useState } from 'react'; +import { AppBar, Toolbar, Typography, List, ListItem, ListItemText, ListItemIcon, Divider, Grid, Paper, Drawer, makeStyles, useMediaQuery, IconButton } from '@material-ui/core'; +import { useTheme } from "@material-ui/core/styles"; +import MenuIcon from '@material-ui/icons/Menu'; +import TimelineIcon from '@material-ui/icons/Timeline'; +import PauseCircleFilledIcon from '@material-ui/icons/PauseCircleFilled'; +import PlayCircleFilledIcon from '@material-ui/icons/PlayCircleFilled'; +import NotificationsActiveIcon from '@material-ui/icons/NotificationsActive'; +import FormatListBulletedIcon from '@material-ui/icons/FormatListBulleted'; +import TrendingUpIcon from '@material-ui/icons/TrendingUp'; +import ChevronLeftIcon from '@material-ui/icons/ChevronLeft'; + +import { Link } from "react-router-dom"; + +import t from '../common/localization'; const useStyles = makeStyles(theme => ({ root: { height: '100%', display: 'flex', - flexDirection: 'column', }, content: { flex: 1, overflow: 'auto', padding: theme.spacing(2), }, + drawer: { + width: 360, + [theme.breakpoints.down("md")]: { + width: 320, + } + }, + drawerHeader: { + ...theme.mixins.toolbar, + display: 'flex', + alignItems: 'center', + padding: theme.spacing(0, 1), + }, form: { padding: theme.spacing(1, 2, 2), }, @@ -20,23 +43,69 @@ const useStyles = makeStyles(theme => ({ const ReportLayoutPage = ({ children, filter }) => { const classes = useStyles(); + const theme = useTheme(); + const matchesMD = useMediaQuery(theme.breakpoints.down("md")); + const [openDrawer, setOpenDrawer] = useState(false); + + const routes = [ + { name: t('reportRoute'), link: '/reports/route', icon: , activeIndex: 0 }, + { name: t('reportEvents'), link: '/reports/event', icon: , activeIndex: 1 }, + { name: t('reportTrips'), link: '/reports/trip', icon: , activeIndex: 2 }, + { name: t('reportStops'), link: '/reports/stop', icon: , activeIndex: 3 }, + { name: t('reportSummary'), link: '/reports/summary', icon: , activeIndex: 4 }, + { name: t('reportChart'), link: '/reports/chart', icon: , activeIndex: 5 }, + ]; + return (
- -
- - - - {filter} - - - - - {children} - - - -
+ {matchesMD && + + setOpenDrawer(!openDrawer)} + className={classes.menuButton} + > + + + + Reports + + + + } + setOpenDrawer(!openDrawer)} + classes={{ paper: classes.drawer }} + > +
+ + + +
+ + + {routes.map(route => ( + setOpenDrawer(false)} + > + + {route.icon} + + + {route.name} + + + ))} + +
); } -- cgit v1.2.3 From 15db54a9e1ade16758eb0f716e7eb72c9847109a Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Sat, 15 May 2021 15:51:09 +0530 Subject: Adding ReportHeader --- modern/src/reports/ReportHeader.js | 0 modern/src/reports/ReportLayoutPage.js | 38 +++++++++++++++++++++------------- 2 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 modern/src/reports/ReportHeader.js diff --git a/modern/src/reports/ReportHeader.js b/modern/src/reports/ReportHeader.js new file mode 100644 index 0000000..e69de29 diff --git a/modern/src/reports/ReportLayoutPage.js b/modern/src/reports/ReportLayoutPage.js index c5e13fd..cdce2b3 100644 --- a/modern/src/reports/ReportLayoutPage.js +++ b/modern/src/reports/ReportLayoutPage.js @@ -8,9 +8,9 @@ import PlayCircleFilledIcon from '@material-ui/icons/PlayCircleFilled'; import NotificationsActiveIcon from '@material-ui/icons/NotificationsActive'; import FormatListBulletedIcon from '@material-ui/icons/FormatListBulleted'; import TrendingUpIcon from '@material-ui/icons/TrendingUp'; -import ChevronLeftIcon from '@material-ui/icons/ChevronLeft'; +import ArrowBackIcon from '@material-ui/icons/ArrowBack'; -import { Link } from "react-router-dom"; +import { useHistory } from 'react-router-dom'; import t from '../common/localization'; @@ -43,9 +43,11 @@ const useStyles = makeStyles(theme => ({ const ReportLayoutPage = ({ children, filter }) => { const classes = useStyles(); + const history = useHistory(); const theme = useTheme(); const matchesMD = useMediaQuery(theme.breakpoints.down("md")); const [openDrawer, setOpenDrawer] = useState(false); + const [value, setValue] = useState(0); const routes = [ { name: t('reportRoute'), link: '/reports/route', icon: , activeIndex: 0 }, @@ -56,6 +58,10 @@ const ReportLayoutPage = ({ children, filter }) => { { name: t('reportChart'), link: '/reports/chart', icon: , activeIndex: 5 }, ]; + const handleClick = (route) => { + history.push(route.link); + } + console.log('rendering Layout, ', value); return (
{matchesMD && @@ -81,27 +87,31 @@ const ReportLayoutPage = ({ children, filter }) => { onClose={() => setOpenDrawer(!openDrawer)} classes={{ paper: classes.drawer }} > -
- - - -
- + { !matchesMD && + <> +
+ + + + + Reports + +
+ + + } {routes.map(route => ( setOpenDrawer(false)} + selected={value === route.activeIndex} + onClick={() => { setValue(route.activeIndex); handleClick(route)}} > {route.icon} - - {route.name} - + ))} -- cgit v1.2.3 From 219019a3bd8a744a2cbf9dd16285a9ebfa5709cd Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Sat, 15 May 2021 18:47:16 +0530 Subject: Report Filter Design --- modern/src/reports/EventReportPage.js | 2 +- modern/src/reports/ReportFilter.js | 130 ++++++++++++++++++------------ modern/src/reports/ReportHeader.js | 0 modern/src/reports/ReportLayoutPage.js | 139 +++++++++++++++++++-------------- 4 files changed, 163 insertions(+), 108 deletions(-) delete mode 100644 modern/src/reports/ReportHeader.js diff --git a/modern/src/reports/EventReportPage.js b/modern/src/reports/EventReportPage.js index a14fc93..daa4ab8 100644 --- a/modern/src/reports/EventReportPage.js +++ b/modern/src/reports/EventReportPage.js @@ -30,7 +30,7 @@ const Filter = ({ setItems }) => { return ( - + {t('reportEventTypes')} setDeviceId(e.target.value)}> - {devices.map((device) => ( - {device.name} - ))} - - - - {t('reportPeriod')} - - - {period === 'custom' && ( - setFrom(moment(e.target.value, moment.HTML5_FMT.DATETIME_LOCAL))} - fullWidth /> - )} - {period === 'custom' && ( - setTo(moment(e.target.value, moment.HTML5_FMT.DATETIME_LOCAL))} - fullWidth /> - )} - {children} - - - - {!showOnly && } - {!showOnly && } - - + + + + + {t('reportDevice')} + + + + + + {t('reportPeriod')} + + + + {period === 'custom' && + setFrom(moment(e.target.value, moment.HTML5_FMT.DATETIME_LOCAL))} + fullWidth /> + } + {period === 'custom' && + setTo(moment(e.target.value, moment.HTML5_FMT.DATETIME_LOCAL))} + fullWidth /> + } + + + {children && + {children} + } + + + + + {!showOnly && + } + + + {!showOnly && + } + + + ); } diff --git a/modern/src/reports/ReportHeader.js b/modern/src/reports/ReportHeader.js deleted file mode 100644 index e69de29..0000000 diff --git a/modern/src/reports/ReportLayoutPage.js b/modern/src/reports/ReportLayoutPage.js index cdce2b3..ae7b3da 100644 --- a/modern/src/reports/ReportLayoutPage.js +++ b/modern/src/reports/ReportLayoutPage.js @@ -19,12 +19,17 @@ const useStyles = makeStyles(theme => ({ height: '100%', display: 'flex', }, + drawer: { + width: 360, + [theme.breakpoints.down("md")]: { + width: 0, + } + }, content: { flex: 1, - overflow: 'auto', - padding: theme.spacing(2), + padding: theme.spacing(3), }, - drawer: { + drawerPaper: { width: 360, [theme.breakpoints.down("md")]: { width: 320, @@ -36,6 +41,11 @@ const useStyles = makeStyles(theme => ({ alignItems: 'center', padding: theme.spacing(0, 1), }, + toolbar: { + [theme.breakpoints.down("md")]: { + ...theme.mixins.toolbar, + } + }, form: { padding: theme.spacing(1, 2, 2), }, @@ -47,7 +57,6 @@ const ReportLayoutPage = ({ children, filter }) => { const theme = useTheme(); const matchesMD = useMediaQuery(theme.breakpoints.down("md")); const [openDrawer, setOpenDrawer] = useState(false); - const [value, setValue] = useState(0); const routes = [ { name: t('reportRoute'), link: '/reports/route', icon: , activeIndex: 0 }, @@ -58,64 +67,78 @@ const ReportLayoutPage = ({ children, filter }) => { { name: t('reportChart'), link: '/reports/chart', icon: , activeIndex: 5 }, ]; - const handleClick = (route) => { + const navigationList = ( + + {routes.map(route => ( + handleListItemClick(route)} + > + + {route.icon} + + + + ))} + + ); + + const drawerHeader = ( + <> +
+ + + + + Reports + +
+ + + ); + + const appBar = ( + + + setOpenDrawer(!openDrawer)} + className={classes.menuButton} + > + + + + Reports + + + + ); + + const handleListItemClick = (route) => { history.push(route.link); } - console.log('rendering Layout, ', value); + return (
- {matchesMD && - - setOpenDrawer(!openDrawer)} - className={classes.menuButton} - > - - - - Reports - - - - } - setOpenDrawer(!openDrawer)} - classes={{ paper: classes.drawer }} - > - { !matchesMD && - <> -
- - - - - Reports - -
- - - } - - {routes.map(route => ( - { setValue(route.activeIndex); handleClick(route)}} - > - - {route.icon} - - - - ))} - -
+ { matchesMD && appBar } + +
+
+ {filter} +
); } -- cgit v1.2.3 From 589244b4a65813271440d11c09fa63dfb4d8ad78 Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Mon, 17 May 2021 13:09:25 +0530 Subject: Sidebar and Report Filter completed --- modern/src/reports/ChartReportPage.js | 22 +++-- modern/src/reports/EventReportPage.js | 50 +++++----- modern/src/reports/ReportFilter.js | 157 +++++++++++++++----------------- modern/src/reports/ReportLayoutPage.js | 61 +++++++------ modern/src/reports/SummaryReportPage.js | 10 +- modern/src/theme/dimensions.js | 4 +- 6 files changed, 154 insertions(+), 150 deletions(-) diff --git a/modern/src/reports/ChartReportPage.js b/modern/src/reports/ChartReportPage.js index 80424cc..c75c9b7 100644 --- a/modern/src/reports/ChartReportPage.js +++ b/modern/src/reports/ChartReportPage.js @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { FormControl, InputLabel, Select, MenuItem } from '@material-ui/core'; +import { Grid, FormControl, InputLabel, Select, MenuItem } from '@material-ui/core'; import ReportLayoutPage from './ReportLayoutPage'; import ReportFilter from './ReportFilter'; import Graph from './Graph'; @@ -39,14 +39,18 @@ const Filter = ({ children, setItems }) => { const ChartType = ({ type, setType }) => { return ( - - {t('reportChartType')} - - + + + + {t('reportChartType')} + + + + ) } diff --git a/modern/src/reports/EventReportPage.js b/modern/src/reports/EventReportPage.js index daa4ab8..b20984f 100644 --- a/modern/src/reports/EventReportPage.js +++ b/modern/src/reports/EventReportPage.js @@ -1,6 +1,6 @@ import React, { useState } from 'react'; import { DataGrid } from '@material-ui/data-grid'; -import { FormControl, InputLabel, Select, MenuItem } from '@material-ui/core'; +import { Grid, FormControl, InputLabel, Select, MenuItem } from '@material-ui/core'; import t from '../common/localization'; import { formatDate } from '../common/formatter'; import ReportFilter from './ReportFilter'; @@ -30,29 +30,31 @@ const Filter = ({ setItems }) => { return ( - - {t('reportEventTypes')} - - + + + {t('reportEventTypes')} + + + ); } diff --git a/modern/src/reports/ReportFilter.js b/modern/src/reports/ReportFilter.js index e6164e2..1d67691 100644 --- a/modern/src/reports/ReportFilter.js +++ b/modern/src/reports/ReportFilter.js @@ -1,10 +1,11 @@ import React, { useState } from 'react'; -import { FormControl, InputLabel, Select, MenuItem, Button, TextField, ButtonGroup, Grid } from '@material-ui/core'; +import { FormControl, InputLabel, Select, MenuItem, Button, TextField, Grid } from '@material-ui/core'; import t from '../common/localization'; import { useSelector } from 'react-redux'; import moment from 'moment'; const ReportFilter = ({ children, handleSubmit, showOnly }) => { + const devices = useSelector(state => Object.values(state.devices.items)); const [deviceId, setDeviceId] = useState(); const [period, setPeriod] = useState('today'); @@ -56,88 +57,80 @@ const ReportFilter = ({ children, handleSubmit, showOnly }) => { } return ( - <> - - - - - {t('reportDevice')} - - - - - - {t('reportPeriod')} - - - - {period === 'custom' && - setFrom(moment(e.target.value, moment.HTML5_FMT.DATETIME_LOCAL))} - fullWidth /> - } - {period === 'custom' && - setTo(moment(e.target.value, moment.HTML5_FMT.DATETIME_LOCAL))} - fullWidth /> - } - - - {children && - {children} - } - - - - - {!showOnly && - } - - - {!showOnly && - } - - + + + + {t('reportDevice')} + + + + + + {t('reportPeriod')} + + + + {period === 'custom' && + setFrom(moment(e.target.value, moment.HTML5_FMT.DATETIME_LOCAL))} + fullWidth /> + } + {period === 'custom' && + setTo(moment(e.target.value, moment.HTML5_FMT.DATETIME_LOCAL))} + fullWidth /> + } + {children} + + + + + {!showOnly && + } + + + {!showOnly && + } - + ); } diff --git a/modern/src/reports/ReportLayoutPage.js b/modern/src/reports/ReportLayoutPage.js index ae7b3da..e203b5a 100644 --- a/modern/src/reports/ReportLayoutPage.js +++ b/modern/src/reports/ReportLayoutPage.js @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { AppBar, Toolbar, Typography, List, ListItem, ListItemText, ListItemIcon, Divider, Grid, Paper, Drawer, makeStyles, useMediaQuery, IconButton } from '@material-ui/core'; +import { AppBar, Toolbar, Typography, List, ListItem, ListItemText, ListItemIcon, Divider, Drawer, makeStyles, useMediaQuery, IconButton } from '@material-ui/core'; import { useTheme } from "@material-ui/core/styles"; import MenuIcon from '@material-ui/icons/Menu'; import TimelineIcon from '@material-ui/icons/Timeline'; @@ -16,24 +16,24 @@ import t from '../common/localization'; const useStyles = makeStyles(theme => ({ root: { - height: '100%', display: 'flex', + height: '100%', }, - drawer: { - width: 360, + drawerContainer: { + width: theme.dimensions.drawerWidth, [theme.breakpoints.down("md")]: { width: 0, } - }, - content: { - flex: 1, - padding: theme.spacing(3), }, - drawerPaper: { - width: 360, + drawer: { + width: theme.dimensions.drawerWidth, [theme.breakpoints.down("md")]: { - width: 320, + width: theme.dimensions.tabletDrawerWidth, } + }, + content: { + flex: 1, + padding: theme.spacing(5, 3, 3, 3), }, drawerHeader: { ...theme.mixins.toolbar, @@ -41,14 +41,16 @@ const useStyles = makeStyles(theme => ({ alignItems: 'center', padding: theme.spacing(0, 1), }, + backArrowIconContainer: { + '&:hover': { + backgroundColor:"transparent" + } + }, toolbar: { [theme.breakpoints.down("md")]: { ...theme.mixins.toolbar, } }, - form: { - padding: theme.spacing(1, 2, 2), - }, })); const ReportLayoutPage = ({ children, filter }) => { @@ -73,8 +75,7 @@ const ReportLayoutPage = ({ children, filter }) => { handleListItemClick(route)} - > + onClick={() => handleListItemClick(route)}> {route.icon} @@ -87,11 +88,13 @@ const ReportLayoutPage = ({ children, filter }) => { const drawerHeader = ( <>
- + - - Reports + + {t('reportTitle')}
@@ -99,19 +102,18 @@ const ReportLayoutPage = ({ children, filter }) => { ); const appBar = ( - + setOpenDrawer(!openDrawer)} - className={classes.menuButton} - > + className={classes.menuButton}> - Reports + {t('reportTitle')} @@ -123,18 +125,17 @@ const ReportLayoutPage = ({ children, filter }) => { return (
- { matchesMD && appBar } - +
{filter} diff --git a/modern/src/reports/SummaryReportPage.js b/modern/src/reports/SummaryReportPage.js index 2af7d3b..f63f50b 100644 --- a/modern/src/reports/SummaryReportPage.js +++ b/modern/src/reports/SummaryReportPage.js @@ -1,6 +1,6 @@ import React, { useState } from 'react'; import { DataGrid } from '@material-ui/data-grid'; -import { FormControlLabel, Checkbox } from '@material-ui/core'; +import { Grid, FormControlLabel, Checkbox } from '@material-ui/core'; import t from '../common/localization'; import { formatDistance, formatHours, formatDate, formatSpeed, formatVolume } from '../common/formatter'; import ReportFilter from './ReportFilter'; @@ -28,9 +28,11 @@ const Filter = ({ setItems }) => { return ( - setDaily(e.target.checked)} />} - label={t('reportDaily')} /> + + setDaily(e.target.checked)} />} + label={t('reportDaily')} /> + ); } diff --git a/modern/src/theme/dimensions.js b/modern/src/theme/dimensions.js index e36fc23..59959d7 100644 --- a/modern/src/theme/dimensions.js +++ b/modern/src/theme/dimensions.js @@ -2,5 +2,7 @@ export default { inputHeight: '42px', borderRadius: '4px', sidebarWidth: '28%', - tabletSidebarWidth: '52px' + tabletSidebarWidth: '52px', + drawerWidth: 360, + tabletDrawerWidth: 320, }; -- cgit v1.2.3 From 0ab07c40f48889727b1503eaedb5daa8f344dd19 Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Mon, 17 May 2021 15:10:29 +0530 Subject: Initial draft of Reports Development --- modern/src/reports/ReportLayoutPage.js | 60 +++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/modern/src/reports/ReportLayoutPage.js b/modern/src/reports/ReportLayoutPage.js index e203b5a..4ffc881 100644 --- a/modern/src/reports/ReportLayoutPage.js +++ b/modern/src/reports/ReportLayoutPage.js @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { AppBar, Toolbar, Typography, List, ListItem, ListItemText, ListItemIcon, Divider, Drawer, makeStyles, useMediaQuery, IconButton } from '@material-ui/core'; +import { AppBar, Toolbar, Typography, List, ListItem, ListItemText, ListItemIcon, Divider, Drawer, makeStyles, IconButton, Hidden } from '@material-ui/core'; import { useTheme } from "@material-ui/core/styles"; import MenuIcon from '@material-ui/icons/Menu'; import TimelineIcon from '@material-ui/icons/Timeline'; @@ -10,7 +10,7 @@ import FormatListBulletedIcon from '@material-ui/icons/FormatListBulleted'; import TrendingUpIcon from '@material-ui/icons/TrendingUp'; import ArrowBackIcon from '@material-ui/icons/ArrowBack'; -import { useHistory } from 'react-router-dom'; +import { Link, useHistory, useLocation } from 'react-router-dom'; import t from '../common/localization'; @@ -21,9 +21,6 @@ const useStyles = makeStyles(theme => ({ }, drawerContainer: { width: theme.dimensions.drawerWidth, - [theme.breakpoints.down("md")]: { - width: 0, - } }, drawer: { width: theme.dimensions.drawerWidth, @@ -53,29 +50,32 @@ const useStyles = makeStyles(theme => ({ }, })); +const routes = [ + { name: t('reportRoute'), href: '/reports/route', icon: }, + { name: t('reportEvents'), href: '/reports/event', icon: }, + { name: t('reportTrips'), href: '/reports/trip', icon: }, + { name: t('reportStops'), href: '/reports/stop', icon: }, + { name: t('reportSummary'), href: '/reports/summary', icon: }, + { name: t('reportChart'), href: '/reports/chart', icon: }, +]; + const ReportLayoutPage = ({ children, filter }) => { const classes = useStyles(); const history = useHistory(); const theme = useTheme(); - const matchesMD = useMediaQuery(theme.breakpoints.down("md")); const [openDrawer, setOpenDrawer] = useState(false); - - const routes = [ - { name: t('reportRoute'), link: '/reports/route', icon: , activeIndex: 0 }, - { name: t('reportEvents'), link: '/reports/event', icon: , activeIndex: 1 }, - { name: t('reportTrips'), link: '/reports/trip', icon: , activeIndex: 2 }, - { name: t('reportStops'), link: '/reports/stop', icon: , activeIndex: 3 }, - { name: t('reportSummary'), link: '/reports/summary', icon: , activeIndex: 4 }, - { name: t('reportChart'), link: '/reports/chart', icon: , activeIndex: 5 }, - ]; + const location = useLocation(); const navigationList = ( - {routes.map(route => ( + {routes.map((route, index) => ( handleListItemClick(route)}> + to={route.href} + selected={route.href === location.pathname}> {route.icon} @@ -119,23 +119,29 @@ const ReportLayoutPage = ({ children, filter }) => { ); - const handleListItemClick = (route) => { - history.push(route.link); - } - return (
- {matchesMD && appBar} -
+ + {appBar} setOpenDrawer(!openDrawer)} classes={{paper: classes.drawer}}> - {!matchesMD && drawerHeader} + {drawerHeader} {navigationList} -
+ + +
+ + {drawerHeader} + {navigationList} + +
+
{filter} -- cgit v1.2.3 From f15034e5fe4e5c702975b8a0f583a9917c4b1b3b Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Sat, 22 May 2021 12:49:22 +0530 Subject: Resolving Comments and Observations --- modern/public/logo.svg | 170 +++++++++++++++++---- modern/public/logo_back.svg | 33 ++++ modern/src/LoginPage.js | 2 +- modern/src/SocketController.js | 5 +- modern/src/components/LoginForm.js | 125 --------------- modern/src/components/RegisterForm.js | 122 --------------- modern/src/components/ResetPasswordForm.js | 12 -- modern/src/components/registration/LoginForm.js | 125 +++++++++++++++ modern/src/components/registration/RegisterForm.js | 122 +++++++++++++++ .../components/registration/ResetPasswordForm.js | 12 ++ modern/src/components/reports/ReportNavbar.js | 34 +++++ modern/src/components/reports/ReportSidebar.js | 30 ++++ modern/src/reports/ReportFilter.js | 8 +- modern/src/reports/ReportLayoutPage.js | 87 +++-------- modern/src/theme/dimensions.js | 4 +- 15 files changed, 531 insertions(+), 360 deletions(-) create mode 100644 modern/public/logo_back.svg delete mode 100644 modern/src/components/LoginForm.js delete mode 100644 modern/src/components/RegisterForm.js delete mode 100644 modern/src/components/ResetPasswordForm.js create mode 100644 modern/src/components/registration/LoginForm.js create mode 100644 modern/src/components/registration/RegisterForm.js create mode 100644 modern/src/components/registration/ResetPasswordForm.js create mode 100644 modern/src/components/reports/ReportNavbar.js create mode 100644 modern/src/components/reports/ReportSidebar.js diff --git a/modern/public/logo.svg b/modern/public/logo.svg index 008b46d..c2ed83b 100644 --- a/modern/public/logo.svg +++ b/modern/public/logo.svg @@ -1,33 +1,145 @@ - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + GPSLABS + + + + + - diff --git a/modern/public/logo_back.svg b/modern/public/logo_back.svg new file mode 100644 index 0000000..008b46d --- /dev/null +++ b/modern/public/logo_back.svg @@ -0,0 +1,33 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modern/src/LoginPage.js b/modern/src/LoginPage.js index 3d4b17f..c16fd19 100644 --- a/modern/src/LoginPage.js +++ b/modern/src/LoginPage.js @@ -2,7 +2,7 @@ import React, { useState } from 'react'; import { useMediaQuery, makeStyles, Paper } from '@material-ui/core'; import { useTheme } from '@material-ui/core/styles'; -import LoginForm from './components/LoginForm'; +import LoginForm from './components/registration/LoginForm'; const useStyles = makeStyles(theme => ({ root: { diff --git a/modern/src/SocketController.js b/modern/src/SocketController.js index cda693a..9ce4ab2 100644 --- a/modern/src/SocketController.js +++ b/modern/src/SocketController.js @@ -27,15 +27,18 @@ const SocketController = () => { const authenticated = useSelector(state => !!state.session.user); const connectSocket = () => { + console.log('connect socket method invoked'); const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; const socket = new WebSocket(protocol + '//' + window.location.host + '/api/socket'); socket.onclose = () => { - setTimeout(() => connectSocket(), 60 * 1000); + console.log('socket closed'); + setTimeout(() => {console.log('socket reconnection try');connectSocket()}, 60 * 1000); }; socket.onmessage = (event) => { const data = JSON.parse(event.data); + console.log('socket message received ', data); if (data.devices) { dispatch(devicesActions.update(data.devices)); } diff --git a/modern/src/components/LoginForm.js b/modern/src/components/LoginForm.js deleted file mode 100644 index d52a51d..0000000 --- a/modern/src/components/LoginForm.js +++ /dev/null @@ -1,125 +0,0 @@ -import React, { useState } from 'react'; -import { Grid, useMediaQuery, makeStyles, InputLabel, Select, MenuItem, FormControl, Button, TextField, Link } from '@material-ui/core'; -import { useTheme } from '@material-ui/core/styles'; -import { useDispatch, useSelector } from 'react-redux'; -import { useHistory } from 'react-router-dom'; -import { sessionActions } from './../store'; -import t from './../common/localization'; -import RegisterForm from './RegisterForm'; -import ResetPasswordForm from './ResetPasswordForm'; - -const useStyles = makeStyles(theme => ({ - logoContainer: { - textAlign: 'center', - }, - resetPassword: { - cursor: 'pointer', - } -})); - -const forms = { - register: () => RegisterForm, - resetPassword: () => ResetPasswordForm, -}; - -const LoginForm = ({ setCurrentForm }) => { - - const classes = useStyles(); - const dispatch = useDispatch(); - const history = useHistory(); - const theme = useTheme(); - const matches = useMediaQuery(theme.breakpoints.down('md')); - - const [failed, setFailed] = useState(false); - const [email, setEmail] = useState(''); - const [password, setPassword] = useState(''); - const registrationEnabled = useSelector(state => state.session.server ? state.session.server['registration'] : false); - - const handleEmailChange = (event) => { - setEmail(event.target.value); - } - - const handlePasswordChange = (event) => { - setPassword(event.target.value); - } - - const handleLogin = async (event) => { - event.preventDefault(); - const response = await fetch('/api/session', { method: 'POST', body: new URLSearchParams(`email=${email}&password=${password}`) }); - if (response.ok) { - const user = await response.json(); - dispatch(sessionActions.updateUser(user)); - history.push('/'); - } else { - setFailed(true); - setPassword(''); - } - } - - return ( - - - {matches && Traccar} - - - - - - - - - - - - - - - - - {t('loginLanguage')} - - - - - - - setCurrentForm(forms.resetPassword)} className={classes.resetPassword} underline="none">{t('loginReset')} - - - - ) -} - -export default LoginForm; diff --git a/modern/src/components/RegisterForm.js b/modern/src/components/RegisterForm.js deleted file mode 100644 index 6d013f7..0000000 --- a/modern/src/components/RegisterForm.js +++ /dev/null @@ -1,122 +0,0 @@ -import React, { useState } from 'react'; -import { Grid, Button, TextField, Typography, Link, makeStyles, Snackbar } from '@material-ui/core'; -import ArrowBackIcon from '@material-ui/icons/ArrowBack'; -import LoginForm from './LoginForm'; -import t from './../common/localization'; - -const useStyles = makeStyles(theme => ({ - register: { - fontSize: theme.spacing(3), - fontWeight: 500 - }, - link: { - fontSize: theme.spacing(3), - fontWeight: 500, - marginTop: theme.spacing(0.5), - cursor: 'pointer' - } -})); - -const forms = { - login: () => LoginForm, -}; - -const RegisterForm = ({ setCurrentForm }) => { - - const classes = useStyles(); - const [name, setName] = useState(''); - const [email, setEmail] = useState(''); - const [password, setPassword] = useState(''); - const [snackbarOpen, setSnackbarOpen] = useState(false); - - const submitDisabled = () => { - return !name || !/(.+)@(.+)\.(.{2,})/.test(email) || !password; - } - - const handleRegister = async () => { - const response = await fetch('/api/users', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({name, email, password}) - }); - - if (response.ok) { - setSnackbarOpen(true); - } - } - - return ( - <> - setCurrentForm(forms.login)} - autoHideDuration={6000} - message={t('loginCreated')} /> - - - - - setCurrentForm(forms.login)}> - - - - - - - {t('loginRegister')} - - - - - setName(event.target.value)} - variant='filled' /> - - - setEmail(event.target.value)} - variant='filled' /> - - - setPassword(event.target.value)} - variant='filled' /> - - - - - - - ) -} - -export default RegisterForm; diff --git a/modern/src/components/ResetPasswordForm.js b/modern/src/components/ResetPasswordForm.js deleted file mode 100644 index c268f80..0000000 --- a/modern/src/components/ResetPasswordForm.js +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react'; - -const ResetPasswordForm = () => { - - return ( - <> -
Reset Password Comming Soon!!!
- - ) -} - -export default ResetPasswordForm; diff --git a/modern/src/components/registration/LoginForm.js b/modern/src/components/registration/LoginForm.js new file mode 100644 index 0000000..6469b31 --- /dev/null +++ b/modern/src/components/registration/LoginForm.js @@ -0,0 +1,125 @@ +import React, { useState } from 'react'; +import { Grid, useMediaQuery, makeStyles, InputLabel, Select, MenuItem, FormControl, Button, TextField, Link } from '@material-ui/core'; +import { useTheme } from '@material-ui/core/styles'; +import { useDispatch, useSelector } from 'react-redux'; +import { useHistory } from 'react-router-dom'; +import { sessionActions } from '../../store'; +import t from '../../common/localization'; +import RegisterForm from './RegisterForm'; +import ResetPasswordForm from './ResetPasswordForm'; + +const useStyles = makeStyles(theme => ({ + logoContainer: { + textAlign: 'center', + }, + resetPassword: { + cursor: 'pointer', + } +})); + +const forms = { + register: () => RegisterForm, + resetPassword: () => ResetPasswordForm, +}; + +const LoginForm = ({ setCurrentForm }) => { + + const classes = useStyles(); + const dispatch = useDispatch(); + const history = useHistory(); + const theme = useTheme(); + const matches = useMediaQuery(theme.breakpoints.down('md')); + + const [failed, setFailed] = useState(false); + const [email, setEmail] = useState(''); + const [password, setPassword] = useState(''); + const registrationEnabled = useSelector(state => state.session.server ? state.session.server['registration'] : false); + + const handleEmailChange = (event) => { + setEmail(event.target.value); + } + + const handlePasswordChange = (event) => { + setPassword(event.target.value); + } + + const handleLogin = async (event) => { + event.preventDefault(); + const response = await fetch('/api/session', { method: 'POST', body: new URLSearchParams(`email=${email}&password=${password}`) }); + if (response.ok) { + const user = await response.json(); + dispatch(sessionActions.updateUser(user)); + history.push('/'); + } else { + setFailed(true); + setPassword(''); + } + } + + return ( + + + {matches && Traccar} + + + + + + + + + + + + + + + + + {t('loginLanguage')} + + + + + + + setCurrentForm(forms.resetPassword)} className={classes.resetPassword} underline="none">{t('loginReset')} + + + + ) +} + +export default LoginForm; diff --git a/modern/src/components/registration/RegisterForm.js b/modern/src/components/registration/RegisterForm.js new file mode 100644 index 0000000..c2af04b --- /dev/null +++ b/modern/src/components/registration/RegisterForm.js @@ -0,0 +1,122 @@ +import React, { useState } from 'react'; +import { Grid, Button, TextField, Typography, Link, makeStyles, Snackbar } from '@material-ui/core'; +import ArrowBackIcon from '@material-ui/icons/ArrowBack'; +import LoginForm from './LoginForm'; +import t from './../../common/localization'; + +const useStyles = makeStyles(theme => ({ + register: { + fontSize: theme.spacing(3), + fontWeight: 500 + }, + link: { + fontSize: theme.spacing(3), + fontWeight: 500, + marginTop: theme.spacing(0.5), + cursor: 'pointer' + } +})); + +const forms = { + login: () => LoginForm, +}; + +const RegisterForm = ({ setCurrentForm }) => { + + const classes = useStyles(); + const [name, setName] = useState(''); + const [email, setEmail] = useState(''); + const [password, setPassword] = useState(''); + const [snackbarOpen, setSnackbarOpen] = useState(false); + + const submitDisabled = () => { + return !name || !/(.+)@(.+)\.(.{2,})/.test(email) || !password; + } + + const handleRegister = async () => { + const response = await fetch('/api/users', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({name, email, password}) + }); + + if (response.ok) { + setSnackbarOpen(true); + } + } + + return ( + <> + setCurrentForm(forms.login)} + autoHideDuration={6000} + message={t('loginCreated')} /> + + + + + setCurrentForm(forms.login)}> + + + + + + + {t('loginRegister')} + + + + + setName(event.target.value)} + variant='filled' /> + + + setEmail(event.target.value)} + variant='filled' /> + + + setPassword(event.target.value)} + variant='filled' /> + + + + + + + ) +} + +export default RegisterForm; diff --git a/modern/src/components/registration/ResetPasswordForm.js b/modern/src/components/registration/ResetPasswordForm.js new file mode 100644 index 0000000..c268f80 --- /dev/null +++ b/modern/src/components/registration/ResetPasswordForm.js @@ -0,0 +1,12 @@ +import React from 'react'; + +const ResetPasswordForm = () => { + + return ( + <> +
Reset Password Comming Soon!!!
+ + ) +} + +export default ResetPasswordForm; diff --git a/modern/src/components/reports/ReportNavbar.js b/modern/src/components/reports/ReportNavbar.js new file mode 100644 index 0000000..93c01a0 --- /dev/null +++ b/modern/src/components/reports/ReportNavbar.js @@ -0,0 +1,34 @@ +import React from 'react'; +import { AppBar, Toolbar, Typography, List, ListItem, ListItemText, ListItemIcon, Divider, Drawer, makeStyles, IconButton, Hidden } from '@material-ui/core'; + +import MenuIcon from '@material-ui/icons/Menu'; +import t from '../../common/localization'; + +const useStyles = makeStyles(theme => ({ + menuButton: { + } +})); +const ReportNavbar = ({ openDrawer, setOpenDrawer, reportName }) => { + + const classes = useStyles(); + + return ( + + + setOpenDrawer(!openDrawer)} + className={classes.menuButton}> + + + + {t('reportTitle')} / {reportName} + + + + ) +} + +export default ReportNavbar; diff --git a/modern/src/components/reports/ReportSidebar.js b/modern/src/components/reports/ReportSidebar.js new file mode 100644 index 0000000..e42c36e --- /dev/null +++ b/modern/src/components/reports/ReportSidebar.js @@ -0,0 +1,30 @@ +import React from 'react'; +import { AppBar, Toolbar, Typography, List, ListItem, ListItemText, ListItemIcon, Divider, Drawer, makeStyles, IconButton, Hidden } from '@material-ui/core'; +import { Link, useHistory, useLocation } from 'react-router-dom'; + +const ReportNavbar = ({ routes, setReportName }) => { + + const location = useLocation(); + + return ( + + {routes.map((route, index) => ( + setReportName(route.name)}> + + {route.icon} + + + + ))} + + ) +} + +export default ReportNavbar; diff --git a/modern/src/reports/ReportFilter.js b/modern/src/reports/ReportFilter.js index 1d67691..0e5ab69 100644 --- a/modern/src/reports/ReportFilter.js +++ b/modern/src/reports/ReportFilter.js @@ -1,8 +1,8 @@ import React, { useState } from 'react'; -import { FormControl, InputLabel, Select, MenuItem, Button, TextField, Grid } from '@material-ui/core'; -import t from '../common/localization'; +import { FormControl, InputLabel, Select, MenuItem, Button, TextField, Grid, Typography } from '@material-ui/core'; import { useSelector } from 'react-redux'; import moment from 'moment'; +import t from '../common/localization'; const ReportFilter = ({ children, handleSubmit, showOnly }) => { @@ -101,7 +101,7 @@ const ReportFilter = ({ children, handleSubmit, showOnly }) => { fullWidth /> } {children} - + } diff --git a/modern/src/reports/ReportLayoutPage.js b/modern/src/reports/ReportLayoutPage.js index 4ffc881..fbb8a30 100644 --- a/modern/src/reports/ReportLayoutPage.js +++ b/modern/src/reports/ReportLayoutPage.js @@ -10,6 +10,9 @@ import FormatListBulletedIcon from '@material-ui/icons/FormatListBulleted'; import TrendingUpIcon from '@material-ui/icons/TrendingUp'; import ArrowBackIcon from '@material-ui/icons/ArrowBack'; +import ReportSidebar from '../components/reports/ReportSidebar' +import ReportNavbar from '../components/reports/ReportNavbar' + import { Link, useHistory, useLocation } from 'react-router-dom'; import t from '../common/localization'; @@ -20,10 +23,10 @@ const useStyles = makeStyles(theme => ({ height: '100%', }, drawerContainer: { - width: theme.dimensions.drawerWidth, + width: theme.dimensions.desktopDrawerWidth, }, drawer: { - width: theme.dimensions.drawerWidth, + width: theme.dimensions.desktopDrawerWidth, [theme.breakpoints.down("md")]: { width: theme.dimensions.tabletDrawerWidth, } @@ -62,89 +65,45 @@ const routes = [ const ReportLayoutPage = ({ children, filter }) => { const classes = useStyles(); const history = useHistory(); - const theme = useTheme(); const [openDrawer, setOpenDrawer] = useState(false); - const location = useLocation(); - - const navigationList = ( - - {routes.map((route, index) => ( - - - {route.icon} - - - - ))} - - ); - - const drawerHeader = ( - <> -
- - - - - {t('reportTitle')} - -
- - - ); - - const appBar = ( - - - setOpenDrawer(!openDrawer)} - className={classes.menuButton}> - - - - {t('reportTitle')} - - - - ); return (
- - {appBar} + + setOpenDrawer(!openDrawer)} classes={{paper: classes.drawer}}> - {drawerHeader} - {navigationList} + - +
- {drawerHeader} - {navigationList} +
+ history.push('/')} + className={classes.backArrowIconContainer} + disableRipple> + + + + {t('reportTitle')} + +
+ +
{filter} + {children}
); diff --git a/modern/src/theme/dimensions.js b/modern/src/theme/dimensions.js index 59959d7..16e6aad 100644 --- a/modern/src/theme/dimensions.js +++ b/modern/src/theme/dimensions.js @@ -3,6 +3,6 @@ export default { borderRadius: '4px', sidebarWidth: '28%', tabletSidebarWidth: '52px', - drawerWidth: 360, - tabletDrawerWidth: 320, + desktopDrawerWidth: '360px', + tabletDrawerWidth: '320px', }; -- cgit v1.2.3 From 10b8e1d6f4ed63c43da2cd71bf21f34b31071cd1 Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Mon, 24 May 2021 11:25:48 +0530 Subject: Revert to last commit --- modern/package.json | 1 + modern/src/reports/ReportLayoutPage.js | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/modern/package.json b/modern/package.json index b796e17..8e5edc6 100644 --- a/modern/package.json +++ b/modern/package.json @@ -18,6 +18,7 @@ "react": "^16.13.1", "react-container-dimensions": "^1.4.1", "react-dom": "^16.13.1", + "react-perfect-scrollbar": "^1.5.8", "react-redux": "^7.2.1", "react-router-dom": "^5.2.0", "react-scripts": "^3.4.3", diff --git a/modern/src/reports/ReportLayoutPage.js b/modern/src/reports/ReportLayoutPage.js index fbb8a30..23ac6d7 100644 --- a/modern/src/reports/ReportLayoutPage.js +++ b/modern/src/reports/ReportLayoutPage.js @@ -1,7 +1,5 @@ import React, { useState } from 'react'; -import { AppBar, Toolbar, Typography, List, ListItem, ListItemText, ListItemIcon, Divider, Drawer, makeStyles, IconButton, Hidden } from '@material-ui/core'; -import { useTheme } from "@material-ui/core/styles"; -import MenuIcon from '@material-ui/icons/Menu'; +import { Grid, Box, Typography, Divider, Drawer, makeStyles, IconButton, Hidden } from '@material-ui/core'; import TimelineIcon from '@material-ui/icons/Timeline'; import PauseCircleFilledIcon from '@material-ui/icons/PauseCircleFilled'; import PlayCircleFilledIcon from '@material-ui/icons/PlayCircleFilled'; @@ -102,8 +100,14 @@ const ReportLayoutPage = ({ children, filter }) => {
- {filter} - {children} + + {filter} + + + {children} + + +
); -- cgit v1.2.3 From 81ad6a0e5c8ed4f35ccac0cd271b8923e686c060 Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Mon, 24 May 2021 14:47:57 +0530 Subject: Resolved some comments on the reports --- modern/package.json | 3 +- modern/public/logo.svg | 170 +++++-------------------- modern/public/logo_back.svg | 33 ----- modern/src/MainToolbar.js | 51 +------- modern/src/components/reports/ReportNavbar.js | 16 +-- modern/src/components/reports/ReportSidebar.js | 9 +- modern/src/reports/ChartReportPage.js | 16 +-- modern/src/reports/Graph.js | 28 ++-- modern/src/reports/ReportLayoutPage.js | 14 +- 9 files changed, 67 insertions(+), 273 deletions(-) delete mode 100644 modern/public/logo_back.svg diff --git a/modern/package.json b/modern/package.json index 8e5edc6..6902d37 100644 --- a/modern/package.json +++ b/modern/package.json @@ -18,11 +18,10 @@ "react": "^16.13.1", "react-container-dimensions": "^1.4.1", "react-dom": "^16.13.1", - "react-perfect-scrollbar": "^1.5.8", "react-redux": "^7.2.1", "react-router-dom": "^5.2.0", "react-scripts": "^3.4.3", - "recharts": "^1.8.5", + "recharts": "^2.0.9", "redux": "^4.0.5", "typeface-roboto": "0.0.75", "wellknown": "^0.5.0" diff --git a/modern/public/logo.svg b/modern/public/logo.svg index c2ed83b..008b46d 100644 --- a/modern/public/logo.svg +++ b/modern/public/logo.svg @@ -1,145 +1,33 @@ - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - GPSLABS - - - - - + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modern/public/logo_back.svg b/modern/public/logo_back.svg deleted file mode 100644 index 008b46d..0000000 --- a/modern/public/logo_back.svg +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modern/src/MainToolbar.js b/modern/src/MainToolbar.js index 702a7e5..63d8efe 100644 --- a/modern/src/MainToolbar.js +++ b/modern/src/MainToolbar.js @@ -22,12 +22,7 @@ import PeopleIcon from '@material-ui/icons/People'; import StorageIcon from '@material-ui/icons/Storage'; import PersonIcon from '@material-ui/icons/Person'; import NotificationsIcon from '@material-ui/icons/Notifications'; -import TimelineIcon from '@material-ui/icons/Timeline'; -import PauseCircleFilledIcon from '@material-ui/icons/PauseCircleFilled'; -import PlayCircleFilledIcon from '@material-ui/icons/PlayCircleFilled'; -import NotificationsActiveIcon from '@material-ui/icons/NotificationsActive'; -import FormatListBulletedIcon from '@material-ui/icons/FormatListBulleted'; -import TrendingUpIcon from '@material-ui/icons/TrendingUp'; +import DescriptionIcon from '@material-ui/icons/Description'; import FolderIcon from '@material-ui/icons/Folder'; import ReplayIcon from '@material-ui/icons/Replay'; import BuildIcon from '@material-ui/icons/Build'; @@ -104,50 +99,12 @@ const MainToolbar = () => { - - - - {t('reportTitle')} - - }> history.push('/reports/route')}> - - - - - history.push('/reports/event')}> - - + - - - history.push('/reports/trip')}> - - - - - - history.push('/reports/stop')}> - - - - - - history.push('/reports/summary')}> - - - - - - history.push('/reports/chart')}> - - - - - + +
{filter} - - - {children} - - + {children}
-- cgit v1.2.3 From 402b30df63f6dfafda32ae37aa2d4df9ef638fd2 Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Tue, 25 May 2021 10:54:25 +0530 Subject: Added Report Title For Mobile and Tablet view --- modern/src/components/reports/ReportNavbar.js | 4 ++-- modern/src/reports/ReportLayoutPage.js | 20 +++++++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/modern/src/components/reports/ReportNavbar.js b/modern/src/components/reports/ReportNavbar.js index 674db3a..3167c75 100644 --- a/modern/src/components/reports/ReportNavbar.js +++ b/modern/src/components/reports/ReportNavbar.js @@ -3,7 +3,7 @@ import { AppBar, Toolbar, Typography, IconButton } from '@material-ui/core'; import MenuIcon from '@material-ui/icons/Menu'; import t from '../../common/localization'; -const ReportNavbar = ({ openDrawer, setOpenDrawer }) => { +const ReportNavbar = ({ openDrawer, setOpenDrawer, reportTitle }) => { return ( @@ -16,7 +16,7 @@ const ReportNavbar = ({ openDrawer, setOpenDrawer }) => { - {t('reportTitle')} + {t('reportTitle')} {reportTitle ? `/ ${reportTitle}` : ''} diff --git a/modern/src/reports/ReportLayoutPage.js b/modern/src/reports/ReportLayoutPage.js index ed7fe54..4280400 100644 --- a/modern/src/reports/ReportLayoutPage.js +++ b/modern/src/reports/ReportLayoutPage.js @@ -1,5 +1,5 @@ -import React, { useState } from 'react'; -import { useHistory } from 'react-router-dom'; +import React, { useState, useEffect } from 'react'; +import { useHistory, useLocation } from 'react-router-dom'; import { Grid, Typography, Divider, Drawer, makeStyles, IconButton, Hidden } from '@material-ui/core'; import TimelineIcon from '@material-ui/icons/Timeline'; import PauseCircleFilledIcon from '@material-ui/icons/PauseCircleFilled'; @@ -61,12 +61,26 @@ const routes = [ const ReportLayoutPage = ({ children, filter, }) => { const classes = useStyles(); const history = useHistory(); + const location = useLocation(); const [openDrawer, setOpenDrawer] = useState(false); + const [reportTitle, setReportTitle] = useState(); + + useEffect(() => { + routes.forEach(route => { + switch (location.pathname) { + case `${route.href}`: + setReportTitle(route.name); + break; + default: + break; + } + }); + }, []); return (
- + Date: Mon, 31 May 2021 14:17:13 +0530 Subject: Finalizing reports implemetations --- modern/src/components/reports/ReportSidebar.js | 2 +- modern/src/reports/EventReportPage.js | 14 +++++++------ modern/src/reports/Graph.js | 7 +++---- modern/src/reports/ReportFilter.js | 15 +++++++++++-- modern/src/reports/RouteReportPage.js | 20 ++++++++++-------- modern/src/reports/StopReportPage.js | 19 ++++++++++------- modern/src/reports/SummaryReportPage.js | 21 +++++++++++-------- modern/src/reports/TripReportPage.js | 29 ++++++++++++++------------ modern/src/theme/dimensions.js | 4 ++++ 9 files changed, 79 insertions(+), 52 deletions(-) diff --git a/modern/src/components/reports/ReportSidebar.js b/modern/src/components/reports/ReportSidebar.js index a71ac4b..2d4c47c 100644 --- a/modern/src/components/reports/ReportSidebar.js +++ b/modern/src/components/reports/ReportSidebar.js @@ -7,7 +7,7 @@ const ReportNavbar = ({ routes }) => { const location = useLocation(); return ( - + {routes.map((route, index) => ( { @@ -61,6 +62,7 @@ const Filter = ({ setItems }) => { const EventReportPage = () => { + const theme = useTheme(); const geofences = useSelector(state => state.geofences.items); const [items, setItems] = useState([]); @@ -76,24 +78,24 @@ const EventReportPage = () => { headerName: t('positionFixTime'), field: 'serverTime', type: 'dateTime', - flex: 1, + width: theme.dimensions.dateColumnWidth, valueFormatter: ({ value }) => formatDate(value), }, { headerName: t('sharedType'), field: 'type', type: 'string', - flex:1, + width: theme.dimensions.stringColumnWidth, valueFormatter: ({ value }) => t(prefixString('event', value)), }, { headerName: t('sharedGeofence'), field: 'geofenceId', - flex: 1, + width: theme.dimensions.stringColumnWidth, valueFormatter: ({ value }) => formatGeofence(value), }, { headerName: t('sharedMaintenance'), field: 'maintenanceId', type: 'number', - flex: 1 + width: theme.dimensions.stringColumnWidth, }]; return ( diff --git a/modern/src/reports/Graph.js b/modern/src/reports/Graph.js index b785e06..990eb5d 100644 --- a/modern/src/reports/Graph.js +++ b/modern/src/reports/Graph.js @@ -1,9 +1,8 @@ import React from 'react'; -import { Box, Paper } from '@material-ui/core'; +import { withWidth } from '@material-ui/core'; import {LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts'; const CustomizedAxisTick = ({ x, y, payload }) =>{ - console.log('inside customized tick ', payload.value) if(!payload.value) { return payload.value; } @@ -19,7 +18,7 @@ const CustomizedAxisTick = ({ x, y, payload }) =>{ const Graph = ({ type, items }) => { return ( - + } height={60} /> @@ -32,4 +31,4 @@ const Graph = ({ type, items }) => { ); } -export default Graph; +export default withWidth()(Graph); diff --git a/modern/src/reports/ReportFilter.js b/modern/src/reports/ReportFilter.js index 0e5ab69..c7835e7 100644 --- a/modern/src/reports/ReportFilter.js +++ b/modern/src/reports/ReportFilter.js @@ -1,11 +1,22 @@ import React, { useState } from 'react'; -import { FormControl, InputLabel, Select, MenuItem, Button, TextField, Grid, Typography } from '@material-ui/core'; +import { FormControl, InputLabel, Select, MenuItem, Button, TextField, Grid, Typography, makeStyles } from '@material-ui/core'; import { useSelector } from 'react-redux'; import moment from 'moment'; import t from '../common/localization'; +const useStyles = makeStyles(theme => ({ + gridContainer: { + margin: theme.spacing(0, -1), + '& > .MuiGrid-item': { + padding: theme.spacing(1.5, 1) + } + } +})); + const ReportFilter = ({ children, handleSubmit, showOnly }) => { + const classes = useStyles(); + const devices = useSelector(state => Object.values(state.devices.items)); const [deviceId, setDeviceId] = useState(); const [period, setPeriod] = useState('today'); @@ -57,7 +68,7 @@ const ReportFilter = ({ children, handleSubmit, showOnly }) => { } return ( - + {t('reportDevice')} diff --git a/modern/src/reports/RouteReportPage.js b/modern/src/reports/RouteReportPage.js index 02d41a2..6befa47 100644 --- a/modern/src/reports/RouteReportPage.js +++ b/modern/src/reports/RouteReportPage.js @@ -1,11 +1,12 @@ import React, { useState } from 'react'; +import { Paper } from '@material-ui/core'; import { DataGrid } from '@material-ui/data-grid'; -import t from '../common/localization'; +import { useTheme } from "@material-ui/core/styles"; import { formatDistance, formatSpeed, formatBoolean, formatDate, formatCoordinate } from '../common/formatter'; import ReportFilter from './ReportFilter'; import ReportLayoutPage from './ReportLayoutPage'; import { useAttributePreference, usePreference } from '../common/preferences'; -import { Paper } from '@material-ui/core'; +import t from '../common/localization'; const Filter = ({ setItems }) => { @@ -31,41 +32,42 @@ const RouteReportPage = () => { const distanceUnit = useAttributePreference('distanceUnit'); const speedUnit = useAttributePreference('speedUnit'); const coordinateFormat = usePreference('coordinateFormat'); + const theme = useTheme(); const columns = [{ headerName: t('positionFixTime'), field: 'fixTime', type: 'dateTime', - flex: 1, + width: theme.dimensions.dateColumnWidth, valueFormatter: ({ value }) => formatDate(value), }, { headerName: t('positionLatitude'), field: 'latitude', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, valueFormatter: ({ value }) => formatCoordinate('latitude', value, coordinateFormat), }, { headerName: t('positionLongitude'), field: 'longitude', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, valueFormatter: ({ value }) => formatCoordinate('longitude', value, coordinateFormat), }, { headerName: t('positionSpeed'), field: 'speed', type: 'number', - flex: 1, + width: theme.dimensions.stringColumnWidth, valueFormatter: ({ value }) => formatSpeed(value, speedUnit), }, { headerName: t('positionAddress'), field: 'address', type: 'string', - flex: 1, + width: theme.dimensions.stringColumnWidth, }, { headerName: t('positionIgnition'), field: 'ignition', type: 'boolean', - flex: 1, + width: theme.dimensions.booleanColumnWidth, valueGetter: ({ row }) => row.attributes.ignition, valueFormatter: ({ value }) => formatBoolean(value), }, { @@ -73,7 +75,7 @@ const RouteReportPage = () => { field: 'totalDistance', type: 'number', hide: true, - flex: 1, + width: theme.dimensions.numberColumnWidth, valueGetter: ({ row }) => row.attributes.totalDistance, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }] diff --git a/modern/src/reports/StopReportPage.js b/modern/src/reports/StopReportPage.js index 7873151..d572742 100644 --- a/modern/src/reports/StopReportPage.js +++ b/modern/src/reports/StopReportPage.js @@ -1,10 +1,11 @@ import React, { useState } from 'react'; import { DataGrid } from '@material-ui/data-grid'; -import t from '../common/localization'; +import { useTheme } from "@material-ui/core/styles"; import { formatDistance, formatHours, formatDate, formatVolume } from '../common/formatter'; import ReportFilter from './ReportFilter'; import ReportLayoutPage from './ReportLayoutPage'; import { useAttributePreference } from '../common/preferences'; +import t from '../common/localization'; const Filter = ({ setItems }) => { @@ -28,6 +29,8 @@ const Filter = ({ setItems }) => { const StopReportPage = () => { + const theme = useTheme(); + const distanceUnit = useAttributePreference('distanceUnit'); const volumeUnit = useAttributePreference('volumeUnit'); @@ -37,43 +40,43 @@ const StopReportPage = () => { headerName: t('reportStartTime'), field: 'startTime', type: 'dateTime', - flex: 1, + width: theme.dimensions.dateColumnWidth, valueFormatter: ({ value }) => formatDate(value), }, { headerName: t('positionOdometer'), field: 'startOdometer', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }, { headerName: t('positionAddress'), field: 'address', type: 'string', hide: true, - flex: 1, + width: theme.dimensions.stringColumnWidth, }, { headerName: t('reportEndTime'), field: 'endTime', type: 'dateTime', - flex: 1, + width: theme.dimensions.dateColumnWidth, valueFormatter: ({ value }) => formatDate(value), }, { headerName: t('reportDuration'), field: 'duration', type: 'string', - flex: 1, + width: theme.dimensions.stringColumnWidth, valueFormatter: ({ value }) => formatHours(value), }, { headerName: t('reportEngineHours'), field: 'engineHours', type: 'string', - flex: 1, + width: theme.dimensions.stringColumnWidth, valueFormatter: ({ value }) => formatHours(value), }, { headerName: t('reportSpentFuel'), field: 'spentFuel', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, hide: true, valueFormatter: ({ value }) => formatVolume(value, volumeUnit), }] diff --git a/modern/src/reports/SummaryReportPage.js b/modern/src/reports/SummaryReportPage.js index f63f50b..a2392f2 100644 --- a/modern/src/reports/SummaryReportPage.js +++ b/modern/src/reports/SummaryReportPage.js @@ -1,11 +1,12 @@ import React, { useState } from 'react'; import { DataGrid } from '@material-ui/data-grid'; import { Grid, FormControlLabel, Checkbox } from '@material-ui/core'; -import t from '../common/localization'; +import { useTheme } from "@material-ui/core/styles"; import { formatDistance, formatHours, formatDate, formatSpeed, formatVolume } from '../common/formatter'; import ReportFilter from './ReportFilter'; import ReportLayoutPage from './ReportLayoutPage'; import { useAttributePreference } from '../common/preferences'; +import t from '../common/localization'; const Filter = ({ setItems }) => { @@ -39,6 +40,8 @@ const Filter = ({ setItems }) => { const SummaryReportPage = () => { + const theme = useTheme(); + const distanceUnit = useAttributePreference('distanceUnit'); const speedUnit = useAttributePreference('speedUnit'); const volumeUnit = useAttributePreference('volumeUnit'); @@ -49,49 +52,49 @@ const SummaryReportPage = () => { headerName: t('reportStartDate'), field: 'startTime', type: 'dateTime', - flex: 1, + width: theme.dimensions.dateColumnWidth, valueFormatter: ({ value }) => formatDate(value, 'YYYY-MM-DD'), }, { headerName: t('sharedDistance'), field: 'distance', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }, { headerName: t('reportStartOdometer'), field: 'startOdometer', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }, { headerName: t('reportEndOdometer'), field: 'endOdometer', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }, { headerName: t('reportAverageSpeed'), field: 'averageSpeed', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, valueFormatter: ({ value }) => formatSpeed(value, speedUnit), }, { headerName: t('reportMaximumSpeed'), field: 'maxSpeed', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, valueFormatter: ({ value }) => formatSpeed(value, speedUnit), }, { headerName: t('reportEngineHours'), field: 'engineHours', type: 'string', - flex: 1, + width: theme.dimensions.numberColumnWidth, valueFormatter: ({ value }) => formatHours(value), }, { headerName: t('reportSpentFuel'), field: 'spentFuel', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, hide: true, valueFormatter: ({ value }) => formatVolume(value, volumeUnit), }] diff --git a/modern/src/reports/TripReportPage.js b/modern/src/reports/TripReportPage.js index 45a7786..ab5f449 100644 --- a/modern/src/reports/TripReportPage.js +++ b/modern/src/reports/TripReportPage.js @@ -1,10 +1,11 @@ import React, { useState } from 'react'; import { DataGrid } from '@material-ui/data-grid'; -import t from '../common/localization'; +import { useTheme } from "@material-ui/core/styles"; import { formatDistance, formatSpeed, formatHours, formatDate, formatVolume } from '../common/formatter'; import ReportFilter from './ReportFilter'; import ReportLayoutPage from './ReportLayoutPage'; import { useAttributePreference } from '../common/preferences'; +import t from '../common/localization'; const Filter = ({ setItems }) => { @@ -27,6 +28,8 @@ const Filter = ({ setItems }) => { } const TripReportPage = () => { + + const theme = useTheme(); const distanceUnit = useAttributePreference('distanceUnit'); const speedUnit = useAttributePreference('speedUnit'); @@ -38,74 +41,74 @@ const TripReportPage = () => { headerName: t('reportStartTime'), field: 'startTime', type: 'dateTime', - flex: 1, + width: theme.dimensions.dateColumnWidth, valueFormatter: ({ value }) => formatDate(value), }, { headerName: t('reportStartOdometer'), field: 'startOdometer', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }, { headerName: t('reportStartAddress'), field: 'startAddress', type: 'string', hide: true, - flex: 1, + width: theme.dimensions.stringColumnWidth, }, { headerName: t('reportEndTime'), field: 'endTime', type: 'dateTime', - flex: 1, + width: theme.dimensions.dateColumnWidth, valueFormatter: ({ value }) => formatDate(value), }, { headerName: t('reportEndOdometer'), field: 'endOdometer', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }, { headerName: t('reportEndAddress'), field: 'endAddress', type: 'string', hide: true, - flex: 1, + width: theme.dimensions.stringColumnWidth, }, { headerName: t('sharedDistance'), field: 'distance', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }, { headerName: t('reportAverageSpeed'), field: 'averageSpeed', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, valueFormatter: ({ value }) => formatSpeed(value, speedUnit), }, { headerName: t('reportMaximumSpeed'), field: 'maxSpeed', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, valueFormatter: ({ value }) => formatSpeed(value, speedUnit), }, { headerName: t('reportDuration'), field: 'duration', type: 'string', - flex: 1, + width: theme.dimensions.stringColumnWidth, valueFormatter: ({ value }) => formatHours(value), }, { headerName: t('reportSpentFuel'), field: 'spentFuel', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, hide: true, valueFormatter: ({ value }) => formatVolume(value, volumeUnit), }, { headerName: t('sharedDriver'), field: 'driverName', type: 'string', - flex: 1, + width: theme.dimensions.stringColumnWidth, hide: true }] diff --git a/modern/src/theme/dimensions.js b/modern/src/theme/dimensions.js index 16e6aad..ebb393b 100644 --- a/modern/src/theme/dimensions.js +++ b/modern/src/theme/dimensions.js @@ -5,4 +5,8 @@ export default { tabletSidebarWidth: '52px', desktopDrawerWidth: '360px', tabletDrawerWidth: '320px', + dateColumnWidth: 160, + numberColumnWidth: 130, + stringColumnWidth: 160, + booleanColumnWidth: 130 }; -- cgit v1.2.3 From b897b8027613ca1fc65d87c70a55860cfd339583 Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Fri, 11 Jun 2021 11:51:26 +0530 Subject: Fixing issues in report implementations --- modern/src/SocketController.js | 1 - modern/src/components/reports/ReportNavbar.js | 6 ++-- modern/src/components/reports/ReportSidebar.js | 4 +-- modern/src/reports/EventReportPage.js | 8 +++--- modern/src/reports/ReportFilter.js | 40 +++++++++++++------------- modern/src/reports/ReportLayoutPage.js | 8 +++--- modern/src/reports/RouteReportPage.js | 14 ++++----- modern/src/reports/StopReportPage.js | 14 ++++----- modern/src/reports/SummaryReportPage.js | 16 +++++------ modern/src/reports/TripReportPage.js | 24 ++++++++-------- modern/src/theme/dimensions.js | 14 ++++----- 11 files changed, 74 insertions(+), 75 deletions(-) diff --git a/modern/src/SocketController.js b/modern/src/SocketController.js index 9ce4ab2..c100df1 100644 --- a/modern/src/SocketController.js +++ b/modern/src/SocketController.js @@ -38,7 +38,6 @@ const SocketController = () => { socket.onmessage = (event) => { const data = JSON.parse(event.data); - console.log('socket message received ', data); if (data.devices) { dispatch(devicesActions.update(data.devices)); } diff --git a/modern/src/components/reports/ReportNavbar.js b/modern/src/components/reports/ReportNavbar.js index 3167c75..ac01fad 100644 --- a/modern/src/components/reports/ReportNavbar.js +++ b/modern/src/components/reports/ReportNavbar.js @@ -3,7 +3,7 @@ import { AppBar, Toolbar, Typography, IconButton } from '@material-ui/core'; import MenuIcon from '@material-ui/icons/Menu'; import t from '../../common/localization'; -const ReportNavbar = ({ openDrawer, setOpenDrawer, reportTitle }) => { +const ReportNavbar = ({ setOpenDrawer, reportTitle }) => { return ( @@ -12,11 +12,11 @@ const ReportNavbar = ({ openDrawer, setOpenDrawer, reportTitle }) => { color="inherit" aria-label="open drawer" edge="start" - onClick={() => setOpenDrawer(!openDrawer)}> + onClick={() => setOpenDrawer(true)}> - {t('reportTitle')} {reportTitle ? `/ ${reportTitle}` : ''} + {t('reportTitle')} {` / ${reportTitle}`} diff --git a/modern/src/components/reports/ReportSidebar.js b/modern/src/components/reports/ReportSidebar.js index 2d4c47c..90e20c0 100644 --- a/modern/src/components/reports/ReportSidebar.js +++ b/modern/src/components/reports/ReportSidebar.js @@ -2,7 +2,7 @@ import React from 'react'; import { List, ListItem, ListItemText, ListItemIcon } from '@material-ui/core'; import { Link, useLocation } from 'react-router-dom'; -const ReportNavbar = ({ routes }) => { +const ReportSidebar = ({ routes }) => { const location = useLocation(); @@ -26,4 +26,4 @@ const ReportNavbar = ({ routes }) => { ) } -export default ReportNavbar; +export default ReportSidebar; diff --git a/modern/src/reports/EventReportPage.js b/modern/src/reports/EventReportPage.js index 8b21769..6d80860 100644 --- a/modern/src/reports/EventReportPage.js +++ b/modern/src/reports/EventReportPage.js @@ -78,24 +78,24 @@ const EventReportPage = () => { headerName: t('positionFixTime'), field: 'serverTime', type: 'dateTime', - width: theme.dimensions.dateColumnWidth, + width: theme.dimensions.columnWidthDate, valueFormatter: ({ value }) => formatDate(value), }, { headerName: t('sharedType'), field: 'type', type: 'string', - width: theme.dimensions.stringColumnWidth, + width: theme.dimensions.columnWidthString, valueFormatter: ({ value }) => t(prefixString('event', value)), }, { headerName: t('sharedGeofence'), field: 'geofenceId', - width: theme.dimensions.stringColumnWidth, + width: theme.dimensions.columnWidthString, valueFormatter: ({ value }) => formatGeofence(value), }, { headerName: t('sharedMaintenance'), field: 'maintenanceId', type: 'number', - width: theme.dimensions.stringColumnWidth, + width: theme.dimensions.columnWidthString, }]; return ( diff --git a/modern/src/reports/ReportFilter.js b/modern/src/reports/ReportFilter.js index c7835e7..8055d30 100644 --- a/modern/src/reports/ReportFilter.js +++ b/modern/src/reports/ReportFilter.js @@ -121,26 +121,26 @@ const ReportFilter = ({ children, handleSubmit, showOnly }) => { {t('reportShow')} - - {!showOnly && - } - - - {!showOnly && - } - + {!showOnly && + + + } + {!showOnly && + + + } ); } diff --git a/modern/src/reports/ReportLayoutPage.js b/modern/src/reports/ReportLayoutPage.js index 4280400..fafffc7 100644 --- a/modern/src/reports/ReportLayoutPage.js +++ b/modern/src/reports/ReportLayoutPage.js @@ -19,12 +19,12 @@ const useStyles = makeStyles(theme => ({ height: '100%', }, drawerContainer: { - width: theme.dimensions.desktopDrawerWidth, + width: theme.dimensions.drawerWidthDesktop, }, drawer: { - width: theme.dimensions.desktopDrawerWidth, + width: theme.dimensions.drawerWidthDesktop, [theme.breakpoints.down("md")]: { - width: theme.dimensions.tabletDrawerWidth, + width: theme.dimensions.drawerWidthTablet, } }, content: { @@ -80,7 +80,7 @@ const ReportLayoutPage = ({ children, filter, }) => { return (
- + { headerName: t('positionFixTime'), field: 'fixTime', type: 'dateTime', - width: theme.dimensions.dateColumnWidth, + width: theme.dimensions.columnWidthDate, valueFormatter: ({ value }) => formatDate(value), }, { headerName: t('positionLatitude'), field: 'latitude', type: 'number', - width: theme.dimensions.numberColumnWidth, + width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatCoordinate('latitude', value, coordinateFormat), }, { headerName: t('positionLongitude'), field: 'longitude', type: 'number', - width: theme.dimensions.numberColumnWidth, + width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatCoordinate('longitude', value, coordinateFormat), }, { headerName: t('positionSpeed'), field: 'speed', type: 'number', - width: theme.dimensions.stringColumnWidth, + width: theme.dimensions.columnWidthString, valueFormatter: ({ value }) => formatSpeed(value, speedUnit), }, { headerName: t('positionAddress'), field: 'address', type: 'string', - width: theme.dimensions.stringColumnWidth, + width: theme.dimensions.columnWidthString, }, { headerName: t('positionIgnition'), field: 'ignition', type: 'boolean', - width: theme.dimensions.booleanColumnWidth, + width: theme.dimensions.columnWidthBoolean, valueGetter: ({ row }) => row.attributes.ignition, valueFormatter: ({ value }) => formatBoolean(value), }, { @@ -75,7 +75,7 @@ const RouteReportPage = () => { field: 'totalDistance', type: 'number', hide: true, - width: theme.dimensions.numberColumnWidth, + width: theme.dimensions.columnWidthNumber, valueGetter: ({ row }) => row.attributes.totalDistance, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }] diff --git a/modern/src/reports/StopReportPage.js b/modern/src/reports/StopReportPage.js index d572742..6953c46 100644 --- a/modern/src/reports/StopReportPage.js +++ b/modern/src/reports/StopReportPage.js @@ -40,43 +40,43 @@ const StopReportPage = () => { headerName: t('reportStartTime'), field: 'startTime', type: 'dateTime', - width: theme.dimensions.dateColumnWidth, + width: theme.dimensions.columnWidthDate, valueFormatter: ({ value }) => formatDate(value), }, { headerName: t('positionOdometer'), field: 'startOdometer', type: 'number', - width: theme.dimensions.numberColumnWidth, + width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }, { headerName: t('positionAddress'), field: 'address', type: 'string', hide: true, - width: theme.dimensions.stringColumnWidth, + width: theme.dimensions.columnWidthString, }, { headerName: t('reportEndTime'), field: 'endTime', type: 'dateTime', - width: theme.dimensions.dateColumnWidth, + width: theme.dimensions.columnWidthDate, valueFormatter: ({ value }) => formatDate(value), }, { headerName: t('reportDuration'), field: 'duration', type: 'string', - width: theme.dimensions.stringColumnWidth, + width: theme.dimensions.columnWidthString, valueFormatter: ({ value }) => formatHours(value), }, { headerName: t('reportEngineHours'), field: 'engineHours', type: 'string', - width: theme.dimensions.stringColumnWidth, + width: theme.dimensions.columnWidthString, valueFormatter: ({ value }) => formatHours(value), }, { headerName: t('reportSpentFuel'), field: 'spentFuel', type: 'number', - width: theme.dimensions.numberColumnWidth, + width: theme.dimensions.columnWidthNumber, hide: true, valueFormatter: ({ value }) => formatVolume(value, volumeUnit), }] diff --git a/modern/src/reports/SummaryReportPage.js b/modern/src/reports/SummaryReportPage.js index a2392f2..e3819a5 100644 --- a/modern/src/reports/SummaryReportPage.js +++ b/modern/src/reports/SummaryReportPage.js @@ -52,49 +52,49 @@ const SummaryReportPage = () => { headerName: t('reportStartDate'), field: 'startTime', type: 'dateTime', - width: theme.dimensions.dateColumnWidth, + width: theme.dimensions.columnWidthDate, valueFormatter: ({ value }) => formatDate(value, 'YYYY-MM-DD'), }, { headerName: t('sharedDistance'), field: 'distance', type: 'number', - width: theme.dimensions.numberColumnWidth, + width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }, { headerName: t('reportStartOdometer'), field: 'startOdometer', type: 'number', - width: theme.dimensions.numberColumnWidth, + width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }, { headerName: t('reportEndOdometer'), field: 'endOdometer', type: 'number', - width: theme.dimensions.numberColumnWidth, + width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }, { headerName: t('reportAverageSpeed'), field: 'averageSpeed', type: 'number', - width: theme.dimensions.numberColumnWidth, + width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatSpeed(value, speedUnit), }, { headerName: t('reportMaximumSpeed'), field: 'maxSpeed', type: 'number', - width: theme.dimensions.numberColumnWidth, + width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatSpeed(value, speedUnit), }, { headerName: t('reportEngineHours'), field: 'engineHours', type: 'string', - width: theme.dimensions.numberColumnWidth, + width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatHours(value), }, { headerName: t('reportSpentFuel'), field: 'spentFuel', type: 'number', - width: theme.dimensions.numberColumnWidth, + width: theme.dimensions.columnWidthNumber, hide: true, valueFormatter: ({ value }) => formatVolume(value, volumeUnit), }] diff --git a/modern/src/reports/TripReportPage.js b/modern/src/reports/TripReportPage.js index ab5f449..5f414f4 100644 --- a/modern/src/reports/TripReportPage.js +++ b/modern/src/reports/TripReportPage.js @@ -41,74 +41,74 @@ const TripReportPage = () => { headerName: t('reportStartTime'), field: 'startTime', type: 'dateTime', - width: theme.dimensions.dateColumnWidth, + width: theme.dimensions.columnWidthDate, valueFormatter: ({ value }) => formatDate(value), }, { headerName: t('reportStartOdometer'), field: 'startOdometer', type: 'number', - width: theme.dimensions.numberColumnWidth, + width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }, { headerName: t('reportStartAddress'), field: 'startAddress', type: 'string', hide: true, - width: theme.dimensions.stringColumnWidth, + width: theme.dimensions.columnWidthString, }, { headerName: t('reportEndTime'), field: 'endTime', type: 'dateTime', - width: theme.dimensions.dateColumnWidth, + width: theme.dimensions.columnWidthDate, valueFormatter: ({ value }) => formatDate(value), }, { headerName: t('reportEndOdometer'), field: 'endOdometer', type: 'number', - width: theme.dimensions.numberColumnWidth, + width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }, { headerName: t('reportEndAddress'), field: 'endAddress', type: 'string', hide: true, - width: theme.dimensions.stringColumnWidth, + width: theme.dimensions.columnWidthString, }, { headerName: t('sharedDistance'), field: 'distance', type: 'number', - width: theme.dimensions.numberColumnWidth, + width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }, { headerName: t('reportAverageSpeed'), field: 'averageSpeed', type: 'number', - width: theme.dimensions.numberColumnWidth, + width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatSpeed(value, speedUnit), }, { headerName: t('reportMaximumSpeed'), field: 'maxSpeed', type: 'number', - width: theme.dimensions.numberColumnWidth, + width: theme.dimensions.columnWidthNumber, valueFormatter: ({ value }) => formatSpeed(value, speedUnit), }, { headerName: t('reportDuration'), field: 'duration', type: 'string', - width: theme.dimensions.stringColumnWidth, + width: theme.dimensions.columnWidthString, valueFormatter: ({ value }) => formatHours(value), }, { headerName: t('reportSpentFuel'), field: 'spentFuel', type: 'number', - width: theme.dimensions.numberColumnWidth, + width: theme.dimensions.columnWidthNumber, hide: true, valueFormatter: ({ value }) => formatVolume(value, volumeUnit), }, { headerName: t('sharedDriver'), field: 'driverName', type: 'string', - width: theme.dimensions.stringColumnWidth, + width: theme.dimensions.columnWidthString, hide: true }] diff --git a/modern/src/theme/dimensions.js b/modern/src/theme/dimensions.js index ebb393b..a2403ab 100644 --- a/modern/src/theme/dimensions.js +++ b/modern/src/theme/dimensions.js @@ -2,11 +2,11 @@ export default { inputHeight: '42px', borderRadius: '4px', sidebarWidth: '28%', - tabletSidebarWidth: '52px', - desktopDrawerWidth: '360px', - tabletDrawerWidth: '320px', - dateColumnWidth: 160, - numberColumnWidth: 130, - stringColumnWidth: 160, - booleanColumnWidth: 130 + sidebarWidthTablet: '52px', + drawerWidthDesktop: '360px', + drawerWidthTablet: '320px', + columnWidthDate: 160, + columnWidthNumber: 130, + columnWidthString: 160, + columnWidthBoolean: 130 }; -- cgit v1.2.3