aboutsummaryrefslogtreecommitdiff
path: root/modern/src/DeviceList.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-03-22 19:30:28 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-03-22 19:30:28 -0700
commit990d485a21c945e7d57b85378650a65f3e79eed3 (patch)
treeeb513a337f097607410f4ae48d673dd18c2f1c74 /modern/src/DeviceList.js
parent80f36b23de8557445623e530708298a557f9fa2e (diff)
downloadtrackermap-web-990d485a21c945e7d57b85378650a65f3e79eed3.tar.gz
trackermap-web-990d485a21c945e7d57b85378650a65f3e79eed3.tar.bz2
trackermap-web-990d485a21c945e7d57b85378650a65f3e79eed3.zip
Handle list clicks
Diffstat (limited to 'modern/src/DeviceList.js')
-rw-r--r--modern/src/DeviceList.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/modern/src/DeviceList.js b/modern/src/DeviceList.js
index f636921d..03c5126c 100644
--- a/modern/src/DeviceList.js
+++ b/modern/src/DeviceList.js
@@ -10,16 +10,21 @@ import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
import IconButton from '@material-ui/core/IconButton';
import MoreVertIcon from '@material-ui/icons/MoreVert';
import Divider from '@material-ui/core/Divider';
+import { selectDevice } from './actions';
const mapStateToProps = state => ({
devices: Array.from(state.devices.values())
});
class DeviceList extends Component {
+ handleClick(device) {
+ this.props.dispatch(selectDevice(device));
+ }
+
render() {
const devices = this.props.devices.map((device, index, list) =>
<Fragment key={device.id.toString()}>
- <ListItem button>
+ <ListItem button onClick={(e) => this.handleClick(device)}>
<ListItemAvatar>
<Avatar>
<LocationOnIcon />