1 import PropTypes from 'prop-types';
2 import React, { useState } from 'react';
3 import { Button } from 'react-bootstrap';
4 import { withTranslation } from 'react-i18next';
6 import ReportDialog from './ReportDialog';
7 import Icon from '../common/Icon';
8 import { findResult } from '../../helpers/Participant';
9 import i18n from '../../i18n';
11 const ReportButton = ({ participant, round }) => {
12 const [showDialog, setShowDialog] = useState(false);
16 onClick={() => setShowDialog(true)}
19 {i18n.t(findResult(participant, round) ? 'results.edit' : 'results.report')}
21 <Icon.EDIT title="" />
24 onHide={() => setShowDialog(false)}
25 participant={participant}
32 ReportButton.propTypes = {
33 participant: PropTypes.shape({
35 round: PropTypes.shape({
37 tournament: PropTypes.shape({
41 export default withTranslation()(ReportButton);