11import React , { useCallback , useEffect , useLayoutEffect , useRef , useState } from 'react'
22import { NoteSeverity } from '@sofie-automation/blueprints-integration'
33import { IContextMenuContext } from '../RundownView.js'
4- import {
5- IOutputLayerUi ,
6- PartUi ,
7- PieceUi ,
8- SegmentNoteCounts ,
9- SegmentUi ,
10- } from '../SegmentContainer/withResolvedSegment.js'
4+ import { IOutputLayerUi , PartUi , PieceUi , SegmentUi } from '../SegmentContainer/withResolvedSegment.js'
115import { ContextMenuTrigger } from '@jstarpl/react-contextmenu'
12- import { CriticalIconSmall , WarningIconSmall } from '../../lib/ui/icons/notifications.js'
136import { contextMenuHoldToDisplayTime , useCombinedRefs , useRundownViewEventBusListener } from '../../lib/lib.js'
147import { useTranslation } from 'react-i18next'
158import { literal } from '@sofie-automation/corelib/dist/lib'
@@ -33,6 +26,7 @@ import { SegmentId } from '@sofie-automation/corelib/dist/dataModel/Ids'
3326import { DBRundownPlaylist , RundownHoldState } from '@sofie-automation/corelib/dist/dataModel/RundownPlaylist'
3427import { isPartPlayable } from '@sofie-automation/corelib/dist/dataModel/Part'
3528import { isLoopRunning } from '../../lib/RundownResolver.js'
29+ import { SegmentHeaderNotes } from '../SegmentHeader/SegmentHeaderNotes.js'
3630
3731interface IProps {
3832 id : string
@@ -41,7 +35,6 @@ interface IProps {
4135 playlist : DBRundownPlaylist
4236 studio : UIStudio
4337 parts : Array < PartUi >
44- segmentNoteCounts : SegmentNoteCounts
4538 hasAlreadyPlayed : boolean
4639 hasGuestItems : boolean
4740 hasRemoteItems : boolean
@@ -84,9 +77,6 @@ export const SegmentAdlibTesting = React.memo(
8477 const [ squishedHover , setSquishedHover ] = useState < null | number > ( null )
8578 const squishedHoverTimeout = useRef < number | null > ( null )
8679
87- const criticalNotes = props . segmentNoteCounts . criticial
88- const warningNotes = props . segmentNoteCounts . warning
89-
9080 const getSegmentContext = ( ) => {
9181 const ctx = literal < IContextMenuContext > ( {
9282 segment : props . segment ,
@@ -465,30 +455,7 @@ export const SegmentAdlibTesting = React.memo(
465455 >
466456 { t ( 'Adlib Testing' ) }
467457 </ h2 >
468- { ( criticalNotes > 0 || warningNotes > 0 ) && (
469- < div className = "segment-timeline__title__notes" >
470- { criticalNotes > 0 && (
471- < div
472- className = "segment-timeline__title__notes__note segment-timeline__title__notes__note--critical"
473- onClick = { ( ) => props . onHeaderNoteClick ?.( props . segment . _id , NoteSeverity . ERROR ) }
474- aria-label = { t ( 'Critical problems' ) }
475- >
476- < CriticalIconSmall />
477- < div className = "segment-timeline__title__notes__count" > { criticalNotes } </ div >
478- </ div >
479- ) }
480- { warningNotes > 0 && (
481- < div
482- className = "segment-timeline__title__notes__note segment-timeline__title__notes__note--warning"
483- onClick = { ( ) => props . onHeaderNoteClick ?.( props . segment . _id , NoteSeverity . WARNING ) }
484- aria-label = { t ( 'Warnings' ) }
485- >
486- < WarningIconSmall />
487- < div className = "segment-timeline__title__notes__count" > { warningNotes } </ div >
488- </ div >
489- ) }
490- </ div >
491- ) }
458+ < SegmentHeaderNotes segmentId = { props . segment . _id } onHeaderNoteClick = { props . onHeaderNoteClick } />
492459 </ ContextMenuTrigger >
493460 < div className = "segment-timeline__source-layers" role = "tree" aria-label = { t ( 'Sources' ) } >
494461 { Object . values < IOutputLayerUi > ( props . segment . outputLayers )
0 commit comments