]> git.localhorst.tv Git - alttp.git/blob - resources/js/components/rounds/EditButton.js
tracker items as svg
[alttp.git] / resources / js / components / rounds / EditButton.js
1 import PropTypes from 'prop-types';
2 import React, { useState } from 'react';
3 import { Button } from 'react-bootstrap';
4 import { withTranslation } from 'react-i18next';
5
6 import EditDialog from './EditDialog';
7 import Icon from '../common/Icon';
8 import i18n from '../../i18n';
9
10 const EditButton = ({
11         round,
12         tournament,
13 }) => {
14         const [showDialog, setShowDialog] = useState(false);
15
16         return <>
17                 <EditDialog
18                         onHide={() => setShowDialog(false)}
19                         round={round}
20                         show={showDialog}
21                         tournament={tournament}
22                 />
23                 <Button
24                         onClick={() => setShowDialog(true)}
25                         size="sm"
26                         title={i18n.t('rounds.edit')}
27                         variant="outline-secondary"
28                 >
29                         <Icon.EDIT title="" />
30                 </Button>
31         </>;
32 };
33
34 EditButton.propTypes = {
35         round: PropTypes.shape({
36                 locked: PropTypes.bool,
37         }),
38         tournament: PropTypes.shape({
39         }),
40 };
41
42 export default withTranslation()(EditButton);