import { Day, EndAction, Playback, TimeStrategy, TimerType } from 'ontime-types'; import { memo } from 'react'; import { IoArrowDown, IoArrowUp, IoBan, IoFlash, IoPlay, IoPlayForward, IoPlaySkipForward, IoTime, } from 'react-icons/io5'; import { LuArrowDownToLine } from 'react-icons/lu'; import Tooltip from '../../../common/components/tooltip/Tooltip'; import { cx } from '../../../common/utils/styleUtils'; import { AppMode } from '../../../ontimeConfig'; import TitleEditor from '../common/TitleEditor'; import TimeInputFlow from '../time-input-flow/TimeInputFlow'; import { useEditorFollowMode } from '../useEditorFollowMode'; import RundownEventChip from './composite/RundownEventChip'; import EventBlockPlayback from './composite/RundownEventPlayback'; import EventBlockProgressBar from './composite/RundownEventProgressBar'; import style from './RundownEvent.module.scss'; interface RundownEventInnerProps { eventId: string; timeStart: number; timeEnd: number; duration: number; timeStrategy: TimeStrategy; linkStart: boolean; countToEnd: boolean; eventIndex: number; endAction: EndAction; timerType: TimerType; title: string; note: string; delay: number; automationsEnabled?: boolean; isNext: boolean; skip: boolean; loaded: boolean; playback?: Playback; isRolling: boolean; dayOffset: Day; isPast: boolean; totalGap: number; isLinkedToLoaded: boolean; hasTriggers: boolean; } export default memo(RundownEventInner); function RundownEventInner({ eventId, timeStart, timeEnd, duration, timeStrategy, linkStart, countToEnd, endAction, timerType, title, note, delay, automationsEnabled, isNext, skip = false, loaded, playback, isRolling, dayOffset, isPast, totalGap, isLinkedToLoaded, hasTriggers, }: RundownEventInnerProps) { const { editorMode } = useEditorFollowMode(); const eventIsPlaying = playback === Playback.Play; const eventIsPaused = playback === Playback.Pause; const automationTooltip = (() => { if (!hasTriggers) { return 'Event has no triggers'; } if (automationsEnabled !== false) { return 'Event has triggers'; } return 'Event has triggers, but automations are disabled'; })(); const automationIconClasses = cx([ style.statusIcon, hasTriggers ? (automationsEnabled === false ? style.warning : style.active) : style.disabled, ]); const playBtnStyles = { _hover: {} }; if (!skip && eventIsPlaying) { playBtnStyles._hover = { bg: '#c05621' }; // $ontime-paused } else if (!skip && !eventIsPlaying) { playBtnStyles._hover = {}; } return ( <>