import React from 'react' import { Col, FormControl, FormGroup, Row } from 'react-bootstrap' import { setDataChannels, setEnabledDataChannels } from '@/app/actions' import { useAppDispatch, useAppSelector } from '@/app/hooks' import { isFormDisabled } from '@/utils' import { TooltipFormCheck } from './TooltipFormCheck' export const DataChannelsForm: React.FC = () => { const enabledDataChannels = useAppSelector((state) => state.enabledDataChannels) const dataChannels = useAppSelector((state) => state.dataChannels) const connectionStatus = useAppSelector((state) => state.soraContents.connectionStatus) const disabled = isFormDisabled(connectionStatus) const dispatch = useAppDispatch() const textareaPlaceholder = 'dataChannelsを指定\n(例)\n' + JSON.stringify( [ { label: '#spam', maxPacketLifeTime: 10, ordered: true, protocol: 'efg', compress: false, direction: 'sendrecv', }, ], null, 2, ) const onChangeSwitch = (event: React.ChangeEvent): void => { dispatch(setEnabledDataChannels(event.target.checked)) } const onChangeText = (event: React.ChangeEvent): void => { dispatch(setDataChannels(event.target.value)) } return ( <> dataChannels {enabledDataChannels ? ( ) : null} ) }