import { SecondarySource } from 'ontime-types'; import { useEffect, useState } from 'react'; import Button from '../../../common/components/buttons/Button'; import * as Editor from '../../../common/components/editor-utils/EditorUtils'; import Select from '../../../common/components/select/Select'; import { setMessage, useTimerViewControl } from '../../../common/hooks/useSocket'; import TimerPreview from './TimerPreview'; import style from './TimerViewControl.module.scss'; export default function TimerControlsPreview() { const { blackout, blink } = useTimerViewControl(); return (
); } function SecondarySourceControl() { const { secondarySource } = useTimerViewControl(); const [value, setValue] = useState('aux1'); // sync secondary source with external changes useEffect(() => { if (secondarySource !== null) { setValue(secondarySource); } }, [secondarySource]); const toggleSecondary = () => { if (secondarySource === value) { setMessage.timerSecondarySource(null); } else { setMessage.timerSecondarySource(value); } }; return ( <>