@@ -56,6 +56,7 @@ import { SegmentTimeAnchorTime } from '../RundownView/RundownTiming/SegmentTimeA
5656import { logger } from '../../lib/logging'
5757import * as RundownResolver from '../../lib/RundownResolver'
5858import { DBSegment } from '@sofie-automation/corelib/dist/dataModel/Segment'
59+ import { SelectedElementsContext } from '../RundownView/SelectedElementsContext'
5960
6061interface IProps {
6162 id : string
@@ -101,9 +102,7 @@ interface IProps {
101102 showCountdownToSegment : boolean
102103 showDurationSourceLayers ?: Set < ISourceLayer [ '_id' ] >
103104 fixedSegmentDuration : boolean | undefined
104- onSegmentSelect : ( segmentId : SegmentId ) => void
105- clearSelections : ( ) => void
106- isSelected : boolean
105+ // isSelected: boolean
107106}
108107interface IStateHeader {
109108 timelineWidth : number
@@ -118,7 +117,7 @@ interface IStateHeader {
118117 }
119118 >
120119 useTimeOfDayCountdowns : boolean
121- isSelected : boolean
120+ // isSelected: boolean
122121}
123122
124123interface IZoomPropsHeader {
@@ -277,7 +276,7 @@ export class SegmentTimelineClass extends React.Component<Translated<WithTiming<
277276 `segment.${ props . segment . _id } .useTimeOfDayCountdowns` ,
278277 ! ! props . playlist . timeOfDayCountdowns
279278 ) ,
280- isSelected : props . isSelected ,
279+ // isSelected: props.isSelected,
281280 }
282281 }
283282
@@ -1061,74 +1060,78 @@ export class SegmentTimelineClass extends React.Component<Translated<WithTiming<
10611060 holdToDisplay = { contextMenuHoldToDisplayTime ( ) }
10621061 renderTag = "div"
10631062 >
1064- < div
1065- onDoubleClick = { ( ) => {
1066- if ( this . props . studio . settings . enableUserEdits && this . props . onSegmentSelect ) {
1067- if ( ! this . props . isSelected ) {
1068- this . props . onSegmentSelect ( this . props . segment . _id )
1069- } else {
1070- this . props . clearSelections ( )
1071- }
1072- }
1073- } }
1074- >
1075- < h2
1076- id = { `segment-name-${ this . props . segment . _id } ` }
1077- className = {
1078- 'segment-timeline__title__label' +
1079- ( this . props . segment . identifier ? ' identifier' : '' ) +
1080- ( this . state . isSelected ? ' selected' : '' )
1081- }
1082- data-identifier = { this . props . segment . identifier }
1083- >
1084- { /* for debugging: */ this . props . isSelected && < span > !!</ span > }
1085- { this . props . segment . name }
1086- </ h2 >
1087- { ( criticalNotes > 0 || warningNotes > 0 ) && (
1088- < div className = "segment-timeline__title__notes" >
1089- { criticalNotes > 0 && (
1090- < div
1091- className = "segment-timeline__title__notes__note segment-timeline__title__notes__note--critical"
1092- onClick = { ( ) =>
1093- this . props . onHeaderNoteClick &&
1094- this . props . onHeaderNoteClick ( this . props . segment . _id , NoteSeverity . ERROR )
1063+ < SelectedElementsContext . Consumer >
1064+ { ( selectElementContext ) => (
1065+ < div
1066+ onDoubleClick = { ( ) => {
1067+ if ( this . props . studio . settings . enableUserEdits ) {
1068+ if ( ! selectElementContext . isSelected ( this . props . segment . _id ) ) {
1069+ selectElementContext . clearAndSetSelection ( { type : 'segment' , elementId : this . props . segment . _id } )
1070+ } else {
1071+ selectElementContext . clearSelections ( )
10951072 }
1096- aria-label = { t ( 'Critical problems' ) }
1097- >
1098- < CriticalIconSmall />
1099- < div className = "segment-timeline__title__notes__count" > { criticalNotes } </ div >
1073+ }
1074+ } }
1075+ >
1076+ < h2
1077+ id = { `segment-name-${ this . props . segment . _id } ` }
1078+ className = {
1079+ 'segment-timeline__title__label' +
1080+ ( this . props . segment . identifier ? ' identifier' : '' ) +
1081+ ( selectElementContext . isSelected ( this . props . segment . _id ) ? ' selected' : '' )
1082+ }
1083+ data-identifier = { this . props . segment . identifier }
1084+ >
1085+ { /* for debugging: */ selectElementContext . isSelected ( this . props . segment . _id ) && < span > !!</ span > }
1086+ { this . props . segment . name }
1087+ </ h2 >
1088+ { ( criticalNotes > 0 || warningNotes > 0 ) && (
1089+ < div className = "segment-timeline__title__notes" >
1090+ { criticalNotes > 0 && (
1091+ < div
1092+ className = "segment-timeline__title__notes__note segment-timeline__title__notes__note--critical"
1093+ onClick = { ( ) =>
1094+ this . props . onHeaderNoteClick &&
1095+ this . props . onHeaderNoteClick ( this . props . segment . _id , NoteSeverity . ERROR )
1096+ }
1097+ aria-label = { t ( 'Critical problems' ) }
1098+ >
1099+ < CriticalIconSmall />
1100+ < div className = "segment-timeline__title__notes__count" > { criticalNotes } </ div >
1101+ </ div >
1102+ ) }
1103+ { warningNotes > 0 && (
1104+ < div
1105+ className = "segment-timeline__title__notes__note segment-timeline__title__notes__note--warning"
1106+ onClick = { ( ) =>
1107+ this . props . onHeaderNoteClick &&
1108+ this . props . onHeaderNoteClick ( this . props . segment . _id , NoteSeverity . WARNING )
1109+ }
1110+ aria-label = { t ( 'Warnings' ) }
1111+ >
1112+ < WarningIconSmall />
1113+ < div className = "segment-timeline__title__notes__count" > { warningNotes } </ div >
1114+ </ div >
1115+ ) }
11001116 </ div >
11011117 ) }
1102- { warningNotes > 0 && (
1103- < div
1104- className = "segment-timeline__title__notes__note segment-timeline__title__notes__note--warning"
1105- onClick = { ( ) =>
1106- this . props . onHeaderNoteClick &&
1107- this . props . onHeaderNoteClick ( this . props . segment . _id , NoteSeverity . WARNING )
1108- }
1109- aria-label = { t ( 'Warnings' ) }
1110- >
1111- < WarningIconSmall / >
1112- < div className = "segment-timeline__title__notes__count" > { warningNotes } </ div >
1118+ { identifiers . length > 0 && (
1119+ < div className = "segment-timeline__part-identifiers" >
1120+ { identifiers . map ( ( ident ) => (
1121+ < div
1122+ className = "segment-timeline__part-identifiers__identifier"
1123+ key = { ident . partId + '' }
1124+ onClick = { ( ) => this . onClickPartIdent ( ident . partId ) }
1125+ >
1126+ { ident . ident }
1127+ </ div >
1128+ ) ) }
11131129 </ div >
11141130 ) }
1131+ < HeaderEditStates userEditOperations = { this . props . segment . userEditOperations } />
11151132 </ div >
11161133 ) }
1117- { identifiers . length > 0 && (
1118- < div className = "segment-timeline__part-identifiers" >
1119- { identifiers . map ( ( ident ) => (
1120- < div
1121- className = "segment-timeline__part-identifiers__identifier"
1122- key = { ident . partId + '' }
1123- onClick = { ( ) => this . onClickPartIdent ( ident . partId ) }
1124- >
1125- { ident . ident }
1126- </ div >
1127- ) ) }
1128- </ div >
1129- ) }
1130- < HeaderEditStates userEditOperations = { this . props . segment . userEditOperations } />
1131- </ div >
1134+ </ SelectedElementsContext . Consumer >
11321135 </ ContextMenuTrigger >
11331136 < div className = "segment-timeline__duration" tabIndex = { 0 } >
11341137 { this . props . playlist &&
0 commit comments