UNPKG

lml-main

Version:

This is now a mono repository published into many standalone packages.

47 lines 2.56 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const React = require("react"); const react_redux_1 = require("react-redux"); const cosmo_redux_api_1 = require("@lml/cosmo-redux-api"); const components_1 = require("../../../common/components"); const actions_1 = require("../../actions"); const status_icon_1 = require("../status-icon"); const cosmoui_1 = require("cosmoui"); class CourierTableRowComponent extends React.Component { constructor() { super(...arguments); this.showCourierDetails = (refId) => () => this.props.showCourierDetails(refId); this.rowStyles = () => ({ cursor: 'pointer', }); this.cellStyles = () => ({ verticalAlign: 'middle', borderLeft: 'none', borderRight: 'none', }); this.statusIconStyles = () => ({ marginRight: '4px', }); } render() { const { courier } = this.props; return (React.createElement("tr", { style: this.rowStyles(), onClick: this.showCourierDetails(courier.refId), id: `courier-table-row-${courier.refId}` }, React.createElement("td", { style: this.cellStyles() }, React.createElement(components_1.AvatarIcon, { avatarName: courier.label.label, id: `courier-table-label-${courier.refId}` })), React.createElement("td", { style: this.cellStyles(), id: `courier-table-id-${courier.refId}` }, courier.refId.split(':').pop()), React.createElement("td", { style: this.cellStyles(), id: `courier-table-callsign-${courier.refId}` }, courier.assignment.callsign), React.createElement("td", { style: this.cellStyles() }, React.createElement(cosmoui_1.Row, null, React.createElement(status_icon_1.CourierStatusIcon, { style: this.statusIconStyles(), status: courier.status.Status, size: 18 }), React.createElement("span", { id: `courier-table-status-${courier.refId}` }, courier.status.Status))), React.createElement("td", { style: this.cellStyles(), id: `courier-table-vehicle-${courier.refId}` }, courier.metadata.vehicle.description))); } } const mapStateToProps = (state, ownProps) => ({ courier: cosmo_redux_api_1.getCourierById(state, ownProps.refId), }); const mapDispatchToProps = { showCourierDetails: actions_1.showCourierDetails, }; exports.CourierTableRow = react_redux_1.connect(mapStateToProps, mapDispatchToProps)(CourierTableRowComponent); //# sourceMappingURL=courier-table-row.js.map