Files
ontime/client/src/features/control/message/MessageControl.jsx
T
Carlos Valente b7e758bf24 Chore/ts (#199)
* chore: add typescript and dependencies
* refactor: remove react imports
* refactor: fix entrypoint
* chore: upgrade chakra and deps
* chore: configure eslint
2022-09-14 21:01:58 +02:00

62 lines
2.4 KiB
React

import { IconButton } from '@chakra-ui/button';
import { Tooltip } from '@chakra-ui/tooltip';
import { IoMicOffOutline } from '@react-icons/all-files/io5/IoMicOffOutline';
import { IoMicSharp } from '@react-icons/all-files/io5/IoMicSharp';
import { useMessageControlProvider } from '../../../common/hooks/useSocketProvider';
import { tooltipDelayMid } from '../../../ontimeConfig';
import InputRow from './InputRow';
import style from './MessageControl.module.scss';
export default function MessageControl() {
const { data, setMessage } = useMessageControlProvider();
return (
<>
<div className={style.messageContainer}>
<InputRow
label='Timer screen message'
placeholder='only the presenter screens see this'
text={data.presenter.text}
visible={data.presenter.visible}
changeHandler={(newValue) => setMessage.presenterText(newValue)}
actionHandler={() => setMessage.presenterVisible(!data.presenter.visible)}
/>
<InputRow
label='Public screen message'
placeholder='public screens will render this'
text={data.public.text}
visible={data.public.visible}
changeHandler={(newValue) => setMessage.publicText(newValue)}
actionHandler={() => setMessage.publicVisible(!data.public.visible)}
/>
<InputRow
label='Lower third message'
placeholder='visible in lower third screen'
text={data.lower.text}
visible={data.lower.visible}
changeHandler={(newValue) => setMessage.lowerText(newValue)}
actionHandler={() => setMessage.lowerVisible(!data.lower.visible)}
/>
</div>
<div className={style.onAirToggle}>
<Tooltip label={data.onAir ? 'Go Off Air' : 'Go On Air'} openDelay={tooltipDelayMid}>
<IconButton
className={style.btn}
size='md'
icon={data.onAir ? <IoMicSharp size='24px' /> : <IoMicOffOutline size='24px' />}
colorScheme='blue'
variant={data.onAir ? 'solid' : 'outline'}
onClick={() => setMessage.onAir(!data.onAir)}
aria-label='Toggle On Air'
/>
</Tooltip>
<span className={style.onAirLabel}>On Air</span>
<span className={style.oscLabel}>{`/ontime/offAir << OSC >> /ontime/onAir`}</span>
</div>
</>
);
}