From 98f2dd952e35e41045c7c9f925e229000bbe4797 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 8 May 2022 18:11:23 -0700 Subject: Migrate reports to page layout --- modern/src/reports/components/ReportLayout.js | 124 -------------------------- 1 file changed, 124 deletions(-) delete mode 100644 modern/src/reports/components/ReportLayout.js (limited to 'modern/src/reports/components/ReportLayout.js') diff --git a/modern/src/reports/components/ReportLayout.js b/modern/src/reports/components/ReportLayout.js deleted file mode 100644 index c028530b..00000000 --- a/modern/src/reports/components/ReportLayout.js +++ /dev/null @@ -1,124 +0,0 @@ -import React, { useState, useEffect, useMemo } 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'; -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 ArrowBackIcon from '@material-ui/icons/ArrowBack'; - -import SideNav from '../../common/components/SideNav'; -import NavBar from '../../common/components/NavBar'; -import { useTranslation } from '../../common/components/LocalizationProvider'; - -const useStyles = makeStyles((theme) => ({ - root: { - display: 'flex', - [theme.breakpoints.down('sm')]: { - flexDirection: 'column', - }, - height: '100%', - }, - drawerContainer: { - width: theme.dimensions.drawerWidthDesktop, - }, - drawer: { - width: theme.dimensions.drawerWidthDesktop, - [theme.breakpoints.down('sm')]: { - width: theme.dimensions.drawerWidthTablet, - }, - }, - content: { - flex: 1, - padding: theme.spacing(3, 3, 3, 3), - }, - drawerHeader: { - ...theme.mixins.toolbar, - display: 'flex', - alignItems: 'center', - padding: theme.spacing(0, 1), - }, - backArrowIconContainer: { - '&:hover': { - backgroundColor: 'transparent', - }, - }, -})); - -const ReportLayout = ({ children, filter }) => { - const classes = useStyles(); - const history = useHistory(); - const location = useLocation(); - const t = useTranslation(); - - const [openDrawer, setOpenDrawer] = useState(false); - const [reportTitle, setReportTitle] = useState(); - - const routes = useMemo(() => [ - { 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: }, - ], [t]); - - useEffect(() => { - routes.forEach((route) => { - switch (location.pathname) { - case `${route.href}`: - setReportTitle(route.name); - break; - default: - break; - } - }); - }, [routes, location]); - - const pageTitle = `${t('reportTitle')} / ${reportTitle}`; - - return ( -
- - - setOpenDrawer(!openDrawer)} - classes={{ paper: classes.drawer }} - > - - - - - -
- history.push('/')}> - - - - {t('reportTitle')} - -
- - -
-
-
- - {filter} - {children} - -
-
- ); -}; - -export default ReportLayout; -- cgit v1.2.3