Files
ontime/client/src/features/control/message/MessageControl.jsx
T
Carlos Valente b384284175 Refact/feature sockets (#193)
* chore: migrate and upgrade state dependencies
* refactor(eventlist): get data from store
* refactor(messagecontrol): get data from store
* refactor(playbackcontrol): get data from store
* refactor(info): get data from store
* refactor(messagecontrol): handle mutations in hook
* feat(playbackcontrol): get data from store
* refactor(playbackcontrol): handle mutations in hook
* refactor(playbackcontrol): simplify object
* refactor: simplify interfaces
* refactor(InputRow): mixed control + styles
* refactor(socket): cleanup unused endpoints
* refactor(table): prepare table socket endpoint
* refactor(timer): extract timer to own endpoint
* refactor(table): get data from store
* chore: update tests
* refactor(socket): update sockets on cycle
* refactor: remove unnecessary safeguards
2022-09-06 21:11:24 +02:00

63 lines
2.4 KiB
React

import React from '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>
</>
);
}