import { memo, useEffect, useState } from 'react'; import { IoArrowDown, IoArrowUp, IoBan, IoFlag, IoPeople, IoPlay, IoPlayForward, IoPlaySkipForward, IoTime, } from 'react-icons/io5'; import { Tooltip } from '@chakra-ui/react'; import { EndAction, Playback, TimerType, TimeStrategy } from 'ontime-types'; import { cx } from '../../../common/utils/styleUtils'; import { tooltipDelayMid } from '../../../ontimeConfig'; import EditableBlockTitle from '../common/EditableBlockTitle'; import TimeInputFlow from '../time-input-flow/TimeInputFlow'; import EventBlockChip from './composite/EventBlockChip'; import EventBlockPlayback from './composite/EventBlockPlayback'; import EventBlockProgressBar from './composite/EventBlockProgressBar'; import style from './EventBlock.module.scss'; interface EventBlockInnerProps { eventId: string; timeStart: number; timeEnd: number; duration: number; timeStrategy: TimeStrategy; linkStart: boolean; countToEnd: boolean; eventIndex: number; isPublic: boolean; endAction: EndAction; timerType: TimerType; title: string; note: string; delay: number; isNext: boolean; skip: boolean; loaded: boolean; playback?: Playback; isRolling: boolean; dayOffset: number; isPast: boolean; totalGap: number; isLinkedToLoaded: boolean; } function EventBlockInner(props: EventBlockInnerProps) { const { eventId, timeStart, timeEnd, duration, timeStrategy, linkStart, countToEnd, isPublic = true, endAction, timerType, title, note, delay, isNext, skip = false, loaded, playback, isRolling, dayOffset, isPast, totalGap, isLinkedToLoaded, } = props; const [renderInner, setRenderInner] = useState(false); useEffect(() => { setRenderInner(true); }, []); const eventIsPlaying = playback === Playback.Play; const eventIsPaused = playback === Playback.Pause; const playBtnStyles = { _hover: {} }; if (!skip && eventIsPlaying) { playBtnStyles._hover = { bg: '#c05621' }; // $ontime-paused } else if (!skip && !eventIsPlaying) { playBtnStyles._hover = {}; } return !renderInner ? null : ( <>
{isNext && UP NEXT}
{!skip && ( )}
{note}
{loaded && }
); } export default memo(EventBlockInner); function EndActionIcon(props: { action: EndAction; className: string }) { const { action, className } = props; const maybeActiveClasses = cx([action !== EndAction.None && style.active, className]); if (action === EndAction.LoadNext) { return ; } if (action === EndAction.PlayNext) { return ; } return ; } function TimerIcon(props: { type: TimerType; className: string }) { const { type, className } = props; if (type === TimerType.CountUp) { return ; } if (type === TimerType.Clock) { return ; } if (type === TimerType.None) { return ; } return ; }