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 SeedDialog from './SeedDialog';
7 import { maySetSeed } from '../../helpers/permissions';
8 import { withUser } from '../../helpers/UserContext';
9 import i18n from '../../i18n';
11 const SeedButton = ({ round, tournament, user }) => {
12 const [showDialog, setShowDialog] = useState(false);
16 <Button href={round.seed} target="_blank" variant="primary">
17 {i18n.t('rounds.seed')}
21 if (maySetSeed(user, tournament, round)) {
24 onHide={() => setShowDialog(false)}
28 <Button onClick={() => setShowDialog(true)} variant="outline-primary">
29 {i18n.t('rounds.setSeed')}
33 return i18n.t('rounds.noSeed');
36 SeedButton.propTypes = {
37 round: PropTypes.shape({
38 seed: PropTypes.string,
40 tournament: PropTypes.shape({
42 user: PropTypes.shape({
46 export default withTranslation()(withUser(SeedButton));