mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-11 10:23:54 +00:00
b7e758bf24
* chore: add typescript and dependencies * refactor: remove react imports * refactor: fix entrypoint * chore: upgrade chakra and deps * chore: configure eslint
44 lines
1.3 KiB
React
44 lines
1.3 KiB
React
import PropTypes from 'prop-types';
|
|
|
|
import PauseIconBtn from '../../../common/components/buttons/PauseIconBtn';
|
|
import RollIconBtn from '../../../common/components/buttons/RollIconBtn';
|
|
import StartIconBtn from '../../../common/components/buttons/StartIconBtn';
|
|
|
|
import style from './PlaybackControl.module.scss';
|
|
|
|
export default function Playback(props) {
|
|
const { playback, selectedId, playbackControl, noEvents } = props;
|
|
const isRolling = playback === 'roll';
|
|
|
|
return (
|
|
<div className={style.playbackContainer}>
|
|
<StartIconBtn
|
|
active={playback === 'start'}
|
|
clickhandler={() => playbackControl.start()}
|
|
disabled={!selectedId || isRolling || noEvents}
|
|
/>
|
|
<PauseIconBtn
|
|
active={playback === 'pause'}
|
|
clickhandler={() => playbackControl.pause()}
|
|
disabled={!selectedId || isRolling || noEvents || playback !== 'start'}
|
|
/>
|
|
<RollIconBtn
|
|
active={playback === 'roll'}
|
|
disabled={playback === 'roll' || noEvents}
|
|
clickhandler={() => playbackControl.roll()}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
Playback.propTypes = {
|
|
playback: PropTypes.string,
|
|
selectedId: PropTypes.string,
|
|
playbackControl: PropTypes.shape({
|
|
start: PropTypes.func,
|
|
pause: PropTypes.func,
|
|
roll: PropTypes.func,
|
|
}).isRequired,
|
|
noEvents: PropTypes.bool.isRequired,
|
|
};
|