aboutsummaryrefslogtreecommitdiff
path: root/modern/src/reports/ReportLayout.js
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/reports/ReportLayout.js')
-rw-r--r--modern/src/reports/ReportLayout.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/modern/src/reports/ReportLayout.js b/modern/src/reports/ReportLayout.js
index 9bf1dd5e..f6e71db0 100644
--- a/modern/src/reports/ReportLayout.js
+++ b/modern/src/reports/ReportLayout.js
@@ -1,4 +1,4 @@
-import React, { useState, useEffect } from 'react';
+import React, { useState, useEffect, useMemo } from 'react';
import { useHistory, useLocation } from 'react-router-dom';
import {
Grid, Typography, Divider, Drawer, makeStyles, IconButton, Hidden,
@@ -51,15 +51,6 @@ const useStyles = makeStyles((theme) => ({
},
}));
-const routes = [
- { name: t('reportRoute'), href: '/reports/route', icon: <TimelineIcon /> },
- { name: t('reportEvents'), href: '/reports/event', icon: <NotificationsActiveIcon /> },
- { name: t('reportTrips'), href: '/reports/trip', icon: <PlayCircleFilledIcon /> },
- { name: t('reportStops'), href: '/reports/stop', icon: <PauseCircleFilledIcon /> },
- { name: t('reportSummary'), href: '/reports/summary', icon: <FormatListBulletedIcon /> },
- { name: t('reportChart'), href: '/reports/chart', icon: <TrendingUpIcon /> },
-];
-
const ReportLayout = ({ children, filter }) => {
const classes = useStyles();
const history = useHistory();
@@ -69,6 +60,15 @@ const ReportLayout = ({ children, filter }) => {
const [openDrawer, setOpenDrawer] = useState(false);
const [reportTitle, setReportTitle] = useState();
+ const routes = useMemo(() => [
+ { name: t('reportRoute'), href: '/reports/route', icon: <TimelineIcon /> },
+ { name: t('reportEvents'), href: '/reports/event', icon: <NotificationsActiveIcon /> },
+ { name: t('reportTrips'), href: '/reports/trip', icon: <PlayCircleFilledIcon /> },
+ { name: t('reportStops'), href: '/reports/stop', icon: <PauseCircleFilledIcon /> },
+ { name: t('reportSummary'), href: '/reports/summary', icon: <FormatListBulletedIcon /> },
+ { name: t('reportChart'), href: '/reports/chart', icon: <TrendingUpIcon /> },
+ ], [t]);
+
useEffect(() => {
routes.forEach((route) => {
switch (location.pathname) {