import { Button } from 'react-bootstrap';
import Icon from '../common/Icon';
+import { mayEditRestream } from '../../helpers/permissions';
+import { withUser } from '../../helpers/UserContext';
-const Channel = ({ channel }) =>
+const Channel = ({ channel, episode, onEditRestream, user }) =>
<div className="episode-channel">
<Button
href={channel.stream_link}
{' '}
{channel.short_name || channel.title}
</Button>
+ {onEditRestream && mayEditRestream(user, episode, channel) ?
+ <Button
+ className="ms-1"
+ onClick={() => onEditRestream(episode, channel)}
+ variant="outline-secondary"
+ >
+ <Icon.SETTINGS />
+ </Button>
+ : null}
</div>;
Channel.propTypes = {
stream_link: PropTypes.string,
title: PropTypes.string,
}),
+ episode: PropTypes.shape({
+ }),
+ onEditRestream: PropTypes.func,
+ user: PropTypes.shape({
+ }),
};
-export default Channel;
+export default withUser(Channel);