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 (limited to 'modern/src') diff --git a/modern/src/reports/EventReportPage.js b/modern/src/reports/EventReportPage.js index a14fc930..daa4ab8b 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 e69de29b..00000000 diff --git a/modern/src/reports/ReportLayoutPage.js b/modern/src/reports/ReportLayoutPage.js index cdce2b3c..ae7b3daf 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