import React from 'react';
import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next';


const ScrappeStatus = ({ status, handleExecute, id }) => {
  const { t } = useTranslation();
  console.log("id", id)
  if (status === 'requested')
    return <button type="submit" className="btn btn-xs btn-block btn-primary" onClick={() => handleExecute(id)}><i className="fa fa-bell"></i>{t('common.execute')}</button>
  else if (status === 'done')
    return <span className='badge bg-success'>Done</span>
  else
    return <span className='badge bg-warning'>Pending</span>

}

ScrappeStatus.propTypes = {
  status: PropTypes.string,
  id: PropTypes.string,
  handleExecute: PropTypes.func
};
export default ScrappeStatus;
