1 import PropTypes from 'prop-types';
2 import React, { useState } from 'react';
3 import { Button } from 'react-bootstrap';
4 import { useTranslation } from 'react-i18next';
6 import SeedDialog from './SeedDialog';
7 import { maySetSeed } from '../../helpers/permissions';
8 import { useUser } from '../../hooks/user';
10 const SeedButton = ({ round, tournament }) => {
11 const [showDialog, setShowDialog] = useState(false);
13 const { t } = useTranslation();
14 const { user } = useUser();
18 <Button href={round.seed} target="_blank" variant="primary">
26 variant="outline-primary"
33 if (maySetSeed(user, tournament, round)) {
36 onHide={() => setShowDialog(false)}
40 <Button onClick={() => setShowDialog(true)} variant="outline-primary">
45 return t('rounds.noSeed');
48 SeedButton.propTypes = {
49 round: PropTypes.shape({
50 seed: PropTypes.string,
51 spoiler: PropTypes.string,
53 tournament: PropTypes.shape({
57 export default SeedButton;