import React from 'react'; import { Doughnut, HorizontalBar } from 'react-chartjs-2'; import { connect } from 'react-redux'; import { pick } from 'ramda'; import { Card, CardBody, CardHeader } from 'reactstrap'; import { getShortUrlVisits } from './reducers/shortUrlVisits'; import VisitsParser from '../visits/services/VisitsParser'; export class ShortUrlsVisits extends React.Component { state = { startDate: '', endDate: '' }; componentDidMount() { const { match: { params } } = this.props; this.props.getShortUrlVisits(params.shortCode, this.state); } render() { const { match: { params }, selectedServer, visitsParser, shortUrlVisits } = this.props; const serverUrl = selectedServer ? selectedServer.url : ''; const shortUrl = `${serverUrl}/${params.shortCode}`; const generateGraphData = stats => ({ labels: Object.keys(stats), datasets: Object.values(stats) }); return (