UNPKG

lml-main

Version:

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

41 lines 2.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const React = require("react"); const react_redux_1 = require("react-redux"); const cosmoui_1 = require("cosmoui"); const ts_utils_1 = require("@lml/ts-utils"); const components_1 = require("../../../common/components"); const place_table_row_action_1 = require("./place-table-row-action"); const actions_1 = require("../../actions"); const selectors_1 = require("../../selectors"); class PlaceTableRowComponent extends cosmoui_1.HoverableComponent { constructor() { super(...arguments); this.cellStyles = { verticalAlign: 'middle', }; this.actionsCellStyles = Object.assign({}, this.cellStyles, { textAlign: 'right', minWidth: '80px' }); this.showEditPlaceModal = () => this.props.openPlaceFormDrawer(this.props.place.placeId); } render() { const { place, partner } = this.props; return (React.createElement("tr", { onDoubleClick: this.showEditPlaceModal, id: `places-table-row-${place.placeId}`, onMouseEnter: this.onMouseEnter, onMouseLeave: this.onMouseLeave }, React.createElement("td", { style: this.cellStyles }, React.createElement(components_1.AvatarIcon, { avatarName: place.label, id: `places-table-label-${place.placeId}` })), React.createElement("td", { style: this.cellStyles, id: `places-table-created-at-${place.placeId}` }, ts_utils_1.formatDate(place.createdAt)), React.createElement("td", { style: this.cellStyles, id: `places-table-partner-${place.placeId}` }, partner.label), React.createElement("td", { style: this.cellStyles, id: `places-table-place-id-${place.placeId}` }, place.placeId), React.createElement("td", { style: this.cellStyles, id: `places-table-postcode-${place.placeId}` }, place.postcode), React.createElement("td", { style: this.actionsCellStyles }, this.state.hover && (React.createElement(place_table_row_action_1.PlaceTableRowAction, { id: `places-table-action-edit-${place.placeId}`, icon: "EditJob", onClick: this.showEditPlaceModal }))))); } } const mapStateToProps = (state, ownProps) => ({ partner: selectors_1.getPartnerById(ownProps.place.partnerId), }); const mapDispatchToProps = { openPlaceFormDrawer: actions_1.openPlaceFormDrawer, closePlaceFormDrawer: actions_1.closePlaceFormDrawer, getPartnerById: selectors_1.getPartnerById, }; exports.PlaceTableRow = react_redux_1.connect(mapStateToProps, mapDispatchToProps)(PlaceTableRowComponent); //# sourceMappingURL=place-table-row.js.map