diff options
Diffstat (limited to 'modern')
-rw-r--r-- | modern/.eslintrc.js | 1 | ||||
-rw-r--r-- | modern/src/MainPage.js | 6 | ||||
-rw-r--r-- | modern/src/map/StatusCard.js | 25 |
3 files changed, 17 insertions, 15 deletions
diff --git a/modern/.eslintrc.js b/modern/.eslintrc.js index ec948e57..f380f4c6 100644 --- a/modern/.eslintrc.js +++ b/modern/.eslintrc.js @@ -14,6 +14,7 @@ module.exports = { 'no-param-reassign': [0], 'no-prototype-builtins': [0], 'no-nested-ternary': [0], + 'operator-linebreak': [0], 'react/jsx-filename-extension': [1, { extensions: ['.js'] }], 'react/prop-types': [0], 'react/jsx-props-no-spreading': [0], diff --git a/modern/src/MainPage.js b/modern/src/MainPage.js index 82ed3756..0f6db95a 100644 --- a/modern/src/MainPage.js +++ b/modern/src/MainPage.js @@ -11,6 +11,7 @@ import CloseIcon from '@material-ui/icons/Close'; import ArrowBackIcon from '@material-ui/icons/ArrowBack'; import ListIcon from '@material-ui/icons/ViewList'; +import { useDispatch, useSelector } from 'react-redux'; import DevicesList from './DevicesList'; import Map from './map/Map'; import SelectedDeviceMap from './map/SelectedDeviceMap'; @@ -23,7 +24,6 @@ import { useTranslation } from './LocalizationProvider'; import PoiMap from './map/PoiMap'; import MapPadding from './map/MapPadding'; import StatusCard from './map/StatusCard'; -import { useDispatch, useSelector } from 'react-redux'; import { devicesActions } from './store'; const useStyles = makeStyles((theme) => ({ @@ -179,14 +179,14 @@ const MainPage = () => { </div> </Paper> <BottomMenu /> - {selectedDeviceId && + {selectedDeviceId && ( <div className={classes.statusCard}> <StatusCard deviceId={selectedDeviceId} onClose={() => dispatch(devicesActions.select(null))} /> </div> - } + )} </div> ); }; diff --git a/modern/src/map/StatusCard.js b/modern/src/map/StatusCard.js index 47f7724d..d19651ca 100644 --- a/modern/src/map/StatusCard.js +++ b/modern/src/map/StatusCard.js @@ -11,7 +11,9 @@ import EditIcon from '@material-ui/icons/Edit'; import DeleteIcon from '@material-ui/icons/Delete'; import { useTranslation } from '../LocalizationProvider'; -import { formatDistance, formatPosition, formatSpeed, formatStatus } from '../common/formatter'; +import { + formatDistance, formatPosition, formatSpeed, formatStatus, +} from '../common/formatter'; import RemoveDialog from '../RemoveDialog'; import { useAttributePreference } from '../common/preferences'; @@ -54,7 +56,7 @@ const StatusRow = ({ name, value }) => { </TableCell> </TableRow> ); -} +}; const StatusCard = ({ deviceId, onClose }) => { const classes = useStyles(); @@ -71,23 +73,23 @@ const StatusCard = ({ deviceId, onClose }) => { return ( <> - {device && + {device && ( <Card> <CardHeader - avatar={ + avatar={( <Avatar> <img className={classes.icon} src={`images/icon/${device.category || 'default'}.svg`} alt="" /> </Avatar> - } - action={ + )} + action={( <IconButton onClick={onClose}> <CloseIcon /> </IconButton> - } + )} title={device.name} subheader={formatStatus(device.status, t)} /> - {position && + {position && ( <CardContent> <TableContainer> <Table size="small" classes={{ root: classes.table }}> @@ -96,14 +98,13 @@ const StatusCard = ({ deviceId, onClose }) => { <StatusRow name={t('positionBattery')} value={formatSpeed(position.speed, speedUnit, t)} /> {position.attributes.odometer ? <StatusRow name={t('positionOdometer')} value={formatDistance(position.attributes.odometer, distanceUnit, t)} /> - : <StatusRow name={t('deviceTotalDistance')} value={formatDistance(position.attributes.totalDistance, distanceUnit, t)} /> - } + : <StatusRow name={t('deviceTotalDistance')} value={formatDistance(position.attributes.totalDistance, distanceUnit, t)} />} <StatusRow name={t('positionCourse')} value={formatPosition(position.course, 'course', t)} /> </TableBody> </Table> </TableContainer> </CardContent> - } + )} <CardActions disableSpacing> <Button onClick={() => history.push(`/position/${position.id}`)} disabled={!position} color="secondary"> {t('sharedInfoTitle')} @@ -122,7 +123,7 @@ const StatusCard = ({ deviceId, onClose }) => { </IconButton> </CardActions> </Card> - } + )} <RemoveDialog open={removeDialogShown} endpoint="devices" |