11import React , { useCallback , useEffect , useLayoutEffect , useRef , useState } from 'react'
22import { NoteSeverity } from '@sofie-automation/blueprints-integration'
33import { IContextMenuContext } from '../RundownView.js'
4- import { IOutputLayerUi , PartUi , SegmentNoteCounts , SegmentUi } from '../SegmentContainer/withResolvedSegment.js'
4+ import { IOutputLayerUi , PartUi , SegmentUi } from '../SegmentContainer/withResolvedSegment.js'
55import { ContextMenuTrigger } from '@jstarpl/react-contextmenu'
6- import { CriticalIconSmall , WarningIconSmall } from '../../lib/ui/icons/notifications.js'
76import { contextMenuHoldToDisplayTime , useCombinedRefs , useRundownViewEventBusListener } from '../../lib/lib.js'
87import { useTranslation } from 'react-i18next'
98import { literal } from '@sofie-automation/corelib/dist/lib'
@@ -28,6 +27,7 @@ import { isPartPlayable } from '@sofie-automation/corelib/dist/dataModel/Part'
2827import { UIStudio } from '@sofie-automation/corelib/src/dataModel/Studio.js'
2928import { PieceUi } from '@sofie-automation/corelib/src/dataModel/Piece.js'
3029import { isLoopRunning } from '@sofie-automation/corelib/src/playout/stateCacheResolver.js'
30+ import { SegmentHeaderNotes } from '../SegmentHeader/SegmentHeaderNotes.js'
3131
3232interface IProps {
3333 id : string
@@ -36,7 +36,6 @@ interface IProps {
3636 playlist : DBRundownPlaylist
3737 studio : UIStudio
3838 parts : Array < PartUi >
39- segmentNoteCounts : SegmentNoteCounts
4039 hasAlreadyPlayed : boolean
4140 hasGuestItems : boolean
4241 hasRemoteItems : boolean
@@ -79,9 +78,6 @@ export const SegmentAdlibTesting = React.memo(
7978 const [ squishedHover , setSquishedHover ] = useState < null | number > ( null )
8079 const squishedHoverTimeout = useRef < number | null > ( null )
8180
82- const criticalNotes = props . segmentNoteCounts . criticial
83- const warningNotes = props . segmentNoteCounts . warning
84-
8581 const getSegmentContext = ( ) => {
8682 const ctx = literal < IContextMenuContext > ( {
8783 segment : props . segment ,
@@ -460,30 +456,7 @@ export const SegmentAdlibTesting = React.memo(
460456 >
461457 { t ( 'Adlib Testing' ) }
462458 </ h2 >
463- { ( criticalNotes > 0 || warningNotes > 0 ) && (
464- < div className = "segment-timeline__title__notes" >
465- { criticalNotes > 0 && (
466- < div
467- className = "segment-timeline__title__notes__note segment-timeline__title__notes__note--critical"
468- onClick = { ( ) => props . onHeaderNoteClick ?.( props . segment . _id , NoteSeverity . ERROR ) }
469- aria-label = { t ( 'Critical problems' ) }
470- >
471- < CriticalIconSmall />
472- < div className = "segment-timeline__title__notes__count" > { criticalNotes } </ div >
473- </ div >
474- ) }
475- { warningNotes > 0 && (
476- < div
477- className = "segment-timeline__title__notes__note segment-timeline__title__notes__note--warning"
478- onClick = { ( ) => props . onHeaderNoteClick ?.( props . segment . _id , NoteSeverity . WARNING ) }
479- aria-label = { t ( 'Warnings' ) }
480- >
481- < WarningIconSmall />
482- < div className = "segment-timeline__title__notes__count" > { warningNotes } </ div >
483- </ div >
484- ) }
485- </ div >
486- ) }
459+ < SegmentHeaderNotes segmentId = { props . segment . _id } onHeaderNoteClick = { props . onHeaderNoteClick } />
487460 </ ContextMenuTrigger >
488461 < div className = "segment-timeline__source-layers" role = "tree" aria-label = { t ( 'Sources' ) } >
489462 { Object . values < IOutputLayerUi > ( props . segment . outputLayers )
0 commit comments