X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Frounds%2FSeedButton.js;fp=resources%2Fjs%2Fcomponents%2Frounds%2FSeedButton.js;h=1d68b6a833ca129caa9b481cf40182b8df488c46;hb=a907ef7c6676fef11f42933b2d79bdd496b20122;hp=0000000000000000000000000000000000000000;hpb=06fd14404164904304a20e2280037e83299247fa;p=alttp.git
diff --git a/resources/js/components/rounds/SeedButton.js b/resources/js/components/rounds/SeedButton.js
new file mode 100644
index 0000000..1d68b6a
--- /dev/null
+++ b/resources/js/components/rounds/SeedButton.js
@@ -0,0 +1,46 @@
+import PropTypes from 'prop-types';
+import React, { useState } from 'react';
+import { Button } from 'react-bootstrap';
+import { withTranslation } from 'react-i18next';
+
+import SeedDialog from './SeedDialog';
+import { maySetSeed } from '../../helpers/permissions';
+import { withUser } from '../../helpers/UserContext';
+import i18n from '../../i18n';
+
+const SeedButton = ({ round, tournament, user }) => {
+ const [showDialog, setShowDialog] = useState(false);
+
+ if (round.seed) {
+ return (
+
+ );
+ }
+ if (maySetSeed(user, tournament)) {
+ return <>
+ setShowDialog(false)}
+ round={round}
+ show={showDialog}
+ />
+
+ >;
+ }
+ return i18n.t('rounds.noSeed');
+};
+
+SeedButton.propTypes = {
+ round: PropTypes.shape({
+ seed: PropTypes.string,
+ }),
+ tournament: PropTypes.shape({
+ }),
+ user: PropTypes.shape({
+ }),
+};
+
+export default withTranslation()(withUser(SeedButton));