diff --git a/apps/client/src/common/components/delay-indicator/DelayIndicator.module.scss b/apps/client/src/common/components/delay-indicator/DelayIndicator.module.scss new file mode 100644 index 000000000..7f7ce3cb2 --- /dev/null +++ b/apps/client/src/common/components/delay-indicator/DelayIndicator.module.scss @@ -0,0 +1,9 @@ +@use '../../../theme/v2Styles' as *; + +.delaySymbol { + svg { + font-size: 1.5rem; + color: $ontime-delay; + margin: 0 auto; + } +} diff --git a/apps/client/src/common/components/delay-indicator/DelayIndicator.tsx b/apps/client/src/common/components/delay-indicator/DelayIndicator.tsx new file mode 100644 index 000000000..71bc3711f --- /dev/null +++ b/apps/client/src/common/components/delay-indicator/DelayIndicator.tsx @@ -0,0 +1,36 @@ +import { Tooltip } from '@chakra-ui/react'; +import { IoChevronDown } from '@react-icons/all-files/io5/IoChevronDown'; +import { IoChevronUp } from '@react-icons/all-files/io5/IoChevronUp'; + +import { tooltipDelayFast } from '../../../ontimeConfig'; +import { millisToDelayString } from '../../utils/dateConfig'; + +import style from './DelayIndicator.module.scss'; + +export default function DelayIndicator(props: { delayValue?: number }) { + const { delayValue } = props; + + if (typeof delayValue === 'number') { + if (delayValue < 0) { + return ( + + + + + + ); + } + + if (delayValue > 0) { + return ( + + + + + + ); + } + } + + return null; +} diff --git a/apps/client/src/features/cuesheet/tableElements/PlaybackIcon.tsx b/apps/client/src/common/components/playback-icon/PlaybackIcon.tsx similarity index 100% rename from apps/client/src/features/cuesheet/tableElements/PlaybackIcon.tsx rename to apps/client/src/common/components/playback-icon/PlaybackIcon.tsx diff --git a/apps/client/src/features/cuesheet/Cuesheet.module.scss b/apps/client/src/features/cuesheet/Cuesheet.module.scss index de94398b9..04c982bcf 100644 --- a/apps/client/src/features/cuesheet/Cuesheet.module.scss +++ b/apps/client/src/features/cuesheet/Cuesheet.module.scss @@ -113,14 +113,6 @@ $table-header-font-size: calc(1rem - 3px); } } -.delaySymbol { - svg { - font-size: 1.5rem; - color: $ontime-delay; - margin: 0 auto; - } -} - .delayedTime { color: $ontime-delay-text; font-size: calc(1rem - 2px); diff --git a/apps/client/src/features/cuesheet/cuesheet-table-header/CuesheetTableHeader.tsx b/apps/client/src/features/cuesheet/cuesheet-table-header/CuesheetTableHeader.tsx index 52e3cda2b..b5445f93f 100644 --- a/apps/client/src/features/cuesheet/cuesheet-table-header/CuesheetTableHeader.tsx +++ b/apps/client/src/features/cuesheet/cuesheet-table-header/CuesheetTableHeader.tsx @@ -6,13 +6,13 @@ import { IoSettingsOutline } from '@react-icons/all-files/io5/IoSettingsOutline' import { EventData, Playback } from 'ontime-types'; import { formatDisplay } from 'ontime-utils'; +import PlaybackIcon from '../../../common/components/playback-icon/PlaybackIcon'; import useFullscreen from '../../../common/hooks/useFullscreen'; import { useTimer } from '../../../common/hooks/useSocket'; import useEventData from '../../../common/hooks-query/useEventData'; import { formatTime } from '../../../common/utils/time'; import { tooltipDelayFast } from '../../../ontimeConfig'; import { useCuesheetSettings } from '../store/CuesheetSettings'; -import PlaybackIcon from '../tableElements/PlaybackIcon'; import style from './CuesheetTableHeader.module.scss'; diff --git a/apps/client/src/features/cuesheet/cuesheetCols.tsx b/apps/client/src/features/cuesheet/cuesheetCols.tsx index 2061feba1..93088429f 100644 --- a/apps/client/src/features/cuesheet/cuesheetCols.tsx +++ b/apps/client/src/features/cuesheet/cuesheetCols.tsx @@ -1,14 +1,10 @@ import { useCallback } from 'react'; -import { Tooltip } from '@chakra-ui/react'; import { IoCheckmark } from '@react-icons/all-files/io5/IoCheckmark'; -import { IoChevronDown } from '@react-icons/all-files/io5/IoChevronDown'; -import { IoChevronUp } from '@react-icons/all-files/io5/IoChevronUp'; import { CellContext, ColumnDef } from '@tanstack/react-table'; import { OntimeEvent, OntimeRundownEntry, UserFields } from 'ontime-types'; import { millisToString } from 'ontime-utils'; -import { millisToDelayString } from '../../common/utils/dateConfig'; -import { tooltipDelayFast } from '../../ontimeConfig'; +import DelayIndicator from '../../common/components/delay-indicator/DelayIndicator'; import { useCuesheetSettings } from './store/CuesheetSettings'; import EditableCell from './tableElements/EditableCell'; @@ -20,30 +16,6 @@ function makePublic(row: CellContext) { return cellValue ? : ''; } -function DelayIndicator(props: { delayValue: number }) { - const { delayValue } = props; - if (delayValue < 0) { - return ( - - - - - - ); - } - - if (delayValue > 0) { - return ( - - - - - - ); - } - return null; -} - function MakeTimer({ getValue, row: { original } }: CellContext) { const showDelayedTimes = useCuesheetSettings((state) => state.showDelayedTimes); const cellValue = (getValue() as number | null) ?? 0;