diff --git a/src/routes/Dashboard/components/ShipmentsTable/ShipmentsTable.jsx b/src/routes/Dashboard/components/ShipmentsTable/ShipmentsTable.jsx
index b0b4d7a..afaf201 100644
--- a/src/routes/Dashboard/components/ShipmentsTable/ShipmentsTable.jsx
+++ b/src/routes/Dashboard/components/ShipmentsTable/ShipmentsTable.jsx
@@ -1,6 +1,8 @@
import React from 'react';
import { connect } from 'react-redux';
import { palette } from 'styles/muiTheme';
+import { selectMarker } from 'routes/Dashboard/modules/Dashboard';
+
import {
Table,
TableBody,
@@ -33,39 +35,54 @@ const styles = {
},
};
-export const ShipmentsTable = (props) => (
-
-
-
-
+
+export class ShipmentsTable extends React.PureComponent {
+
+ handleClick = (rowNumber) => this.props.selectMarker('shipment', this.props.shipments[rowNumber]);
+
+ render() {
+ const props = this.props;
+ return (
+ this.handleClick(rowNumber)}
+ >
+
+
+
Active Shipments ({props.shipments.length})
-
-
- Shipment #
- Status
- Destination
- Date Placed
- Estimated Time of Arrival
-
-
-
- {props.shipments.map(shipment =>
-
- {shipment.id}
- {shipment.status}
- {shipment.toId}
- {moment(shipment.createdAt).format(timeFormat)}
-
- {moment(shipment.estimatedTimeOfArrival).format(timeFormat)}
-
-
+
+
+ Shipment #
+ Status
+ Destination
+ Date Placed
+ Estimated Time of Arrival
+
+
+
+ {props.shipments.map(shipment =>
+
+ {shipment.id}
+ {shipment.status}
+ {shipment.toId}
+ {moment(shipment.createdAt).format(timeFormat)}
+
+ {moment(shipment.estimatedTimeOfArrival).format(timeFormat)}
+
+
)}
-
-
-);
+
+
+ );
+ }
+
+}
ShipmentsTable.propTypes = {
+ selectMarker: React.PropTypes.func.isRequired,
shipments: React.PropTypes.array,
};
@@ -73,8 +90,13 @@ ShipmentsTable.propTypes = {
// Connect Component to Redux
// ------------------------------------
+const mapActionCreators = {
+ selectMarker,
+};
+
const mapStateToProps = (state) => ({
shipments: state.dashboard.shipments,
});
-export default connect(mapStateToProps, {})(ShipmentsTable);
+
+export default connect(mapStateToProps, mapActionCreators)(ShipmentsTable);