content: import React from 'react';
  import ConfirmSurveyDeletion from './ConfirmSurveyDeletion';
  import PropTypes from 'prop-types';
  import { Link } from 'react-router-dom';
  
  const SurveysTableRow = ({ item, onSetPage, deleteSurveysRequest, addFlashMessage }, context) => {
  
    const onEditClick = () => {
      context.router.history.push(`/edit/${item._id}`);
    };
  
    return (
      <tr>
        <td className="text">{item.title}</td>
        <td>{item.creationDate.substring(0, 10)}</td>
        <td>{item.count}</td>
        <td><Link to={'/survey/' + item._id}>Link to the survey</Link></td>
        <td><Link to={'/results/' + item._id}>Results</Link></td>
        <td className="text-center">
          <button onClick={onEditClick} className="btn btn-primary btn-sm" type="button">
            <i className="fa fa-pencil" aria-hidden="true"></i>
            &nbsp;Edit
            </button>
          &nbsp;<ConfirmSurveyDeletion
            id={item._id}
            onSetPage={onSetPage}
            deleteSurveysRequest={deleteSurveysRequest}
            addFlashMessage={addFlashMessage}
          />
        </td>
      </tr>
    );
  };
  
  SurveysTableRow.propTypes = {
    item: PropTypes.object.isRequired,
    deleteSurveysRequest: PropTypes.func.isRequired,
    addFlashMessage: PropTypes.func.isRequired,
    onSetPage: PropTypes.func.isRequired,
  };
  
  SurveysTableRow.contextTypes = {
    router: PropTypes.object.isRequired
  };
  
  export default SurveysTableRow;
  