aboutsummaryrefslogtreecommitdiff
path: root/modern/src/main/EventsDrawer.jsx
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-04-06 09:22:10 -0700
committerAnton Tananaev <anton@traccar.org>2024-04-06 09:22:10 -0700
commitf418231b6b2f5e030a0d2dcc390c314602b1f740 (patch)
tree10326adf3792bc2697e06bb5f2b8ef2a8f7e55fe /modern/src/main/EventsDrawer.jsx
parentb392a4af78e01c8e0f50aad5468e9583675b24be (diff)
downloadtrackermap-web-f418231b6b2f5e030a0d2dcc390c314602b1f740.tar.gz
trackermap-web-f418231b6b2f5e030a0d2dcc390c314602b1f740.tar.bz2
trackermap-web-f418231b6b2f5e030a0d2dcc390c314602b1f740.zip
Move modern to the top
Diffstat (limited to 'modern/src/main/EventsDrawer.jsx')
-rw-r--r--modern/src/main/EventsDrawer.jsx81
1 files changed, 0 insertions, 81 deletions
diff --git a/modern/src/main/EventsDrawer.jsx b/modern/src/main/EventsDrawer.jsx
deleted file mode 100644
index f9602e95..00000000
--- a/modern/src/main/EventsDrawer.jsx
+++ /dev/null
@@ -1,81 +0,0 @@
-import React from 'react';
-import { useDispatch, useSelector } from 'react-redux';
-import { useNavigate } from 'react-router-dom';
-import {
- Drawer, IconButton, List, ListItemButton, ListItemText, Toolbar, Typography,
-} from '@mui/material';
-import { makeStyles } from '@mui/styles';
-import DeleteIcon from '@mui/icons-material/Delete';
-import { formatNotificationTitle, formatTime } from '../common/util/formatter';
-import { useTranslation } from '../common/components/LocalizationProvider';
-import { eventsActions } from '../store';
-import { usePreference } from '../common/util/preferences';
-
-const useStyles = makeStyles((theme) => ({
- drawer: {
- width: theme.dimensions.eventsDrawerWidth,
- },
- toolbar: {
- paddingLeft: theme.spacing(2),
- paddingRight: theme.spacing(2),
- },
- title: {
- flexGrow: 1,
- },
-}));
-
-const EventsDrawer = ({ open, onClose }) => {
- const classes = useStyles();
- const navigate = useNavigate();
- const dispatch = useDispatch();
- const t = useTranslation();
-
- const hours12 = usePreference('twelveHourFormat');
-
- const devices = useSelector((state) => state.devices.items);
-
- const events = useSelector((state) => state.events.items);
-
- const formatType = (event) => formatNotificationTitle(t, {
- type: event.type,
- attributes: {
- alarms: event.attributes.alarm,
- },
- });
-
- return (
- <Drawer
- anchor="right"
- open={open}
- onClose={onClose}
- >
- <Toolbar className={classes.toolbar} disableGutters>
- <Typography variant="h6" className={classes.title}>
- {t('reportEvents')}
- </Typography>
- <IconButton size="small" color="inherit" onClick={() => dispatch(eventsActions.deleteAll())}>
- <DeleteIcon fontSize="small" />
- </IconButton>
- </Toolbar>
- <List className={classes.drawer} dense>
- {events.map((event) => (
- <ListItemButton
- key={event.id}
- onClick={() => navigate(`/event/${event.id}`)}
- disabled={!event.id}
- >
- <ListItemText
- primary={`${devices[event.deviceId]?.name} • ${formatType(event)}`}
- secondary={formatTime(event.eventTime, 'seconds', hours12)}
- />
- <IconButton size="small" onClick={() => dispatch(eventsActions.delete(event))}>
- <DeleteIcon fontSize="small" className={classes.delete} />
- </IconButton>
- </ListItemButton>
- ))}
- </List>
- </Drawer>
- );
-};
-
-export default EventsDrawer;