UNPKG

stream-chat-react

Version:

React components to create chat conversations or livestream style chat

21 lines (20 loc) 1.21 kB
import { useMessageComposer } from './hooks'; import React from 'react'; import { useStateStore } from '../../store'; import { useTranslationContext } from '../../context'; const stateSelector = (state) => ({ showReplyInChannel: state.showReplyInChannel, }); export const SendToChannelCheckbox = () => { const { t } = useTranslationContext(); const messageComposer = useMessageComposer(); const { showReplyInChannel } = useStateStore(messageComposer.state, stateSelector); if (messageComposer.editedMessage || !messageComposer.threadId) return null; return (React.createElement("div", { className: 'str-chat__send-to-channel-checkbox__container' }, React.createElement("div", { className: 'str-chat__send-to-channel-checkbox__field' }, React.createElement("input", { id: 'send-to-channel-checkbox', onClick: messageComposer.toggleShowReplyInChannel, type: 'checkbox', value: showReplyInChannel.toString() }), React.createElement("label", { htmlFor: 'send-to-channel-checkbox' }, Object.keys(messageComposer.channel.state.members).length === 2 ? t('Also send as a direct message') : t('Also send in channel'))))); };