blob: 76564e11dc3613466e1189cc4164b29575435eef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
import React from 'react';
import {
Divider, List, ListItemButton, ListItemIcon, ListItemText,
} from '@mui/material';
import StarIcon from '@mui/icons-material/Star';
import TimelineIcon from '@mui/icons-material/Timeline';
import PauseCircleFilledIcon from '@mui/icons-material/PauseCircleFilled';
import PlayCircleFilledIcon from '@mui/icons-material/PlayCircleFilled';
import NotificationsActiveIcon from '@mui/icons-material/NotificationsActive';
import FormatListBulletedIcon from '@mui/icons-material/FormatListBulleted';
import TrendingUpIcon from '@mui/icons-material/TrendingUp';
import BarChartIcon from '@mui/icons-material/BarChart';
import RouteIcon from '@mui/icons-material/Route';
import EventRepeatIcon from '@mui/icons-material/EventRepeat';
import NotesIcon from '@mui/icons-material/Notes';
import { Link, useLocation } from 'react-router-dom';
import { useTranslation } from '../../common/components/LocalizationProvider';
import { useAdministrator, useRestriction } from '../../common/util/permissions';
const MenuItem = ({
title, link, icon, selected,
}) => (
<ListItemButton key={link} component={Link} to={link} selected={selected}>
<ListItemIcon>{icon}</ListItemIcon>
<ListItemText primary={title} />
</ListItemButton>
);
const ReportsMenu = () => {
const t = useTranslation();
const location = useLocation();
const admin = useAdministrator();
const readonly = useRestriction('readonly');
return (
<>
<List>
<MenuItem
title={t('reportCombined')}
link="/reports/combined"
icon={<StarIcon />}
selected={location.pathname === '/reports/combined'}
/>
<MenuItem
title={t('reportRoute')}
link="/reports/route"
icon={<TimelineIcon />}
selected={location.pathname === '/reports/route'}
/>
<MenuItem
title={t('reportEvents')}
link="/reports/event"
icon={<NotificationsActiveIcon />}
selected={location.pathname === '/reports/event'}
/>
<MenuItem
title={t('reportTrips')}
link="/reports/trip"
icon={<PlayCircleFilledIcon />}
selected={location.pathname === '/reports/trip'}
/>
<MenuItem
title={t('reportStops')}
link="/reports/stop"
icon={<PauseCircleFilledIcon />}
selected={location.pathname === '/reports/stop'}
/>
<MenuItem
title={t('reportSummary')}
link="/reports/summary"
icon={<FormatListBulletedIcon />}
selected={location.pathname === '/reports/summary'}
/>
<MenuItem
title={t('reportChart')}
link="/reports/chart"
icon={<TrendingUpIcon />}
selected={location.pathname === '/reports/chart'}
/>
<MenuItem
title={t('reportReplay')}
link="/replay"
icon={<RouteIcon />}
/>
</List>
<Divider />
<List>
<MenuItem
title={t('sharedLogs')}
link="/reports/logs"
icon={<NotesIcon />}
/>
{!readonly && (
<MenuItem
title={t('reportScheduled')}
link="/reports/scheduled"
icon={<EventRepeatIcon />}
/>
)}
{admin && (
<MenuItem
title={t('statisticsTitle')}
link="/reports/statistics"
icon={<BarChartIcon />}
selected={location.pathname === '/reports/statistics'}
/>
)}
</List>
</>
);
};
export default ReportsMenu;
|