]> git.localhorst.tv Git - alttp.git/blobdiff - resources/js/components/rounds/EditButton.js
round titles
[alttp.git] / resources / js / components / rounds / EditButton.js
diff --git a/resources/js/components/rounds/EditButton.js b/resources/js/components/rounds/EditButton.js
new file mode 100644 (file)
index 0000000..edc6fbf
--- /dev/null
@@ -0,0 +1,42 @@
+import PropTypes from 'prop-types';
+import React, { useState } from 'react';
+import { Button } from 'react-bootstrap';
+import { withTranslation } from 'react-i18next';
+
+import EditDialog from './EditDialog';
+import Icon from '../common/Icon';
+import i18n from '../../i18n';
+
+const EditButton = ({
+       round,
+       tournament,
+}) => {
+       const [showDialog, setShowDialog] = useState(false);
+
+       return <>
+               <EditDialog
+                       onHide={() => setShowDialog(false)}
+                       round={round}
+                       show={showDialog}
+                       tournament={tournament}
+               />
+               <Button
+                       onClick={() => setShowDialog(true)}
+                       size="sm"
+                       title={i18n.t('rounds.edit')}
+                       variant="outline-secondary"
+               >
+                       <Icon.EDIT title="" />
+               </Button>
+       </>;
+};
+
+EditButton.propTypes = {
+       round: PropTypes.shape({
+               locked: PropTypes.bool,
+       }),
+       tournament: PropTypes.shape({
+       }),
+};
+
+export default withTranslation()(EditButton);