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 EditStreamLinkDialog from './EditStreamLinkDialog';
7 import Icon from '../common/Icon';
8 import { mayEditStreamLink } from '../../helpers/permissions';
9 import { useUser } from '../../hooks/user';
11 const EditStreamLinkButton = ({ user }) => {
12 const [showDialog, setShowDialog] = useState(false);
14 const { t } = useTranslation();
15 const { user: authUser } = useUser();
17 if (mayEditStreamLink(authUser, user)) {
20 onHide={() => setShowDialog(false)}
25 onClick={() => setShowDialog(true)}
26 title={t('button.edit')}
27 variant="outline-secondary"
29 <Icon.EDIT title="" />
36 EditStreamLinkButton.propTypes = {
37 user: PropTypes.shape({
41 export default EditStreamLinkButton;