diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-09-28 20:43:47 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-09-28 20:43:47 -0700 |
commit | 94e8c40f52b239562aded5e70e334ddbb2eea23b (patch) | |
tree | bd5d8b9425a08ac055f0617818e6e54930c4d557 /modern/src/StatusView.js | |
parent | 9d72339c8365da80154f635dc8184b135a53bab0 (diff) | |
download | trackermap-web-94e8c40f52b239562aded5e70e334ddbb2eea23b.tar.gz trackermap-web-94e8c40f52b239562aded5e70e334ddbb2eea23b.tar.bz2 trackermap-web-94e8c40f52b239562aded5e70e334ddbb2eea23b.zip |
Page for all attributes
Diffstat (limited to 'modern/src/StatusView.js')
-rw-r--r-- | modern/src/StatusView.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/modern/src/StatusView.js b/modern/src/StatusView.js index 61fd1504..0713d47e 100644 --- a/modern/src/StatusView.js +++ b/modern/src/StatusView.js @@ -3,9 +3,14 @@ import React from 'react'; import { useSelector } from 'react-redux'; import { formatPosition } from './common/formatter'; -const StatusView = (props) => { - const device = useSelector(state => state.devices.items[props.deviceId]); - const position = useSelector(state => state.positions.items[props.deviceId]); +const StatusView = ({ deviceId, onShowDetails }) => { + const device = useSelector(state => state.devices.items[deviceId]); + const position = useSelector(state => state.positions.items[deviceId]); + + const handleClick = e => { + e.preventDefault(); + onShowDetails(position.id); + }; return ( <> @@ -17,6 +22,7 @@ const StatusView = (props) => { {position.attributes.batteryLevel && <><b>{t('positionBattery')}:</b> {formatPosition(position.attributes.batteryLevel, 'batteryLevel')}<br /></> } + <a href="#" onClick={handleClick}>{t('sharedShowDetails')}</a> </> ); }; |