2021-03-03 19:50:16 +01:00
|
|
|
// @flow
|
|
|
|
import React from 'react';
|
|
|
|
import Button from 'component/button';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
uri: string,
|
|
|
|
isMuted: boolean,
|
|
|
|
channelClaim: ?ChannelClaim,
|
2021-06-11 22:49:18 +02:00
|
|
|
doChannelMute: (string, boolean) => void,
|
|
|
|
doChannelUnmute: (string, boolean) => void,
|
2021-03-03 19:50:16 +01:00
|
|
|
};
|
|
|
|
|
2021-07-06 03:29:46 +02:00
|
|
|
function ChannelMuteButton(props: Props) {
|
2021-06-11 22:49:18 +02:00
|
|
|
const { uri, doChannelMute, doChannelUnmute, isMuted } = props;
|
|
|
|
|
|
|
|
function handleClick() {
|
|
|
|
if (isMuted) {
|
|
|
|
doChannelUnmute(uri, false);
|
|
|
|
} else {
|
|
|
|
doChannelMute(uri, false);
|
|
|
|
}
|
|
|
|
}
|
2021-03-03 19:50:16 +01:00
|
|
|
|
|
|
|
return (
|
2021-07-06 03:29:46 +02:00
|
|
|
<Button button={isMuted ? 'alt' : 'secondary'} label={isMuted ? __('Unmute') : __('Mute')} onClick={handleClick} />
|
2021-03-03 19:50:16 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-07-06 03:29:46 +02:00
|
|
|
export default ChannelMuteButton;
|