diff options
author | Anton Tananaev <anton@traccar.org> | 2022-05-15 16:18:01 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-05-15 16:18:01 -0700 |
commit | 18bf43634ba99e8a77571b6bcf650f4687c6df68 (patch) | |
tree | 82eaabfffb159c729c1bdfec1a26574f9c2dce5c /modern/src/main/StatusCard.js | |
parent | dbf6e8127733414b1f25b6c033bfc5437801414d (diff) | |
download | trackermap-web-18bf43634ba99e8a77571b6bcf650f4687c6df68.tar.gz trackermap-web-18bf43634ba99e8a77571b6bcf650f4687c6df68.tar.bz2 trackermap-web-18bf43634ba99e8a77571b6bcf650f4687c6df68.zip |
Combine position attributes
Diffstat (limited to 'modern/src/main/StatusCard.js')
-rw-r--r-- | modern/src/main/StatusCard.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/modern/src/main/StatusCard.js b/modern/src/main/StatusCard.js index 92de7bba..10ea8a3f 100644 --- a/modern/src/main/StatusCard.js +++ b/modern/src/main/StatusCard.js @@ -17,7 +17,6 @@ import PositionValue from '../common/components/PositionValue'; import dimensions from '../common/theme/dimensions'; import { useDeviceReadonly, useReadonly } from '../common/util/permissions'; import usePersistedState from '../common/util/usePersistedState'; -import usePositionProperties from '../common/attributes/usePositionProperties'; import usePositionAttributes from '../common/attributes/usePositionAttributes'; const useStyles = makeStyles((theme) => ({ @@ -69,9 +68,7 @@ const StatusCard = ({ deviceId, onClose }) => { const device = useSelector((state) => state.devices.items[deviceId]); const position = useSelector((state) => state.positions.items[deviceId]); - const positionProperties = usePositionProperties(t); const positionAttributes = usePositionAttributes(t); - const positionObject = { ...positionProperties, ...positionAttributes }; const [positionItems] = usePersistedState('positionItems', ['speed', 'address', 'totalDistance', 'course']); const [removeDialogShown, setRemoveDialogShown] = useState(false); @@ -100,13 +97,16 @@ const StatusCard = ({ deviceId, onClose }) => { <Table size="small" classes={{ root: classes.table }}> <TableBody> {positionItems.map((key) => ( - <StatusRow name={positionObject[key].name} content={ - <PositionValue - position={position} - property={position.hasOwnProperty(key) ? key : null} - attribute={position.hasOwnProperty(key) ? null : key} - /> - } /> + <StatusRow + name={positionAttributes[key].name} + content={( + <PositionValue + position={position} + property={position.hasOwnProperty(key) ? key : null} + attribute={position.hasOwnProperty(key) ? null : key} + /> + )} + /> ))} </TableBody> </Table> |