/* eslint-disable react/prop-types */ /* eslint-disable camelcase */ import _ from 'lodash'; import React, { Component } from 'react'; import { connect } from 'react-redux'; import { Link } from 'react-router-dom'; import { Table, Label } from 'semantic-ui-react'; import * as actionCreators from '../store/actions/globalActions'; // Phone Labels component const PhIdsLabels = ({ phIds, onPhoneClick }) => { const listItems = phIds.map(i => ( onPhoneClick(i)} > )); return listItems; }; // Table component class SubGraphsTable extends Component { constructor(props) { super(props); const { tableData } = props; this.state = { column: null, data: tableData, direction: null, }; } handleSort = clickedColumn => () => { const { column, data, direction } = this.state; if (column !== clickedColumn) { this.setState({ column: clickedColumn, data: _.sortBy(data, [clickedColumn]), direction: 'ascending', }); return; } this.setState({ data: data.reverse(), direction: direction === 'ascending' ? 'descending' : 'ascending', }); } render() { const { column, data, direction } = this.state; const { onPhoneClick } = this.props; return ( Group ID Num Images Num Phones Total Num Nodes Phone Numbers Suspect Score {_.map(data, ({ grp_id, num_imgs, num_phones, total_nodes, ph_numbers, suspect_score, highlight, }) => ( {grp_id} {num_imgs} {num_phones} {total_nodes} {/* */} {/* {ph_numbers} */} {suspect_score} ))}
); } } function mapStateToProps(state) { return { tableData: state.sub_graphs_table_data, }; } function mapDispatchToProps(dispatch) { return { onPhoneClick: phoneSearchText => dispatch(actionCreators.initiateGetGraphData(phoneSearchText)), }; } export default connect(mapStateToProps, mapDispatchToProps)(SubGraphsTable);