@@ -12,19 +12,20 @@ import { Translated } from '../../lib/ReactMeteorData/ReactMeteorData'
12
12
import { RundownUtils } from '../../lib/rundown'
13
13
import { IContextMenuContext } from '../RundownView'
14
14
import { PartUi , SegmentUi } from './SegmentTimelineContainer'
15
- import { PartId , SegmentId } from '@sofie-automation/corelib/dist/dataModel/Ids'
15
+ import { SegmentId } from '@sofie-automation/corelib/dist/dataModel/Ids'
16
16
import { SegmentOrphanedReason } from '@sofie-automation/corelib/dist/dataModel/Segment'
17
17
import { UserEditOperationMenuItems } from '../UserEditOperations/RenderUserEditOperations'
18
18
import * as RundownResolver from '../../lib/RundownResolver'
19
+ import { SelectedElement } from '../RundownView/SelectedElementsContext'
20
+ import { PieceExtended } from '../../lib/RundownResolver'
19
21
20
22
interface IProps {
21
23
onSetNext : ( part : DBPart | undefined , e : any , offset ?: number , take ?: boolean ) => void
22
24
onSetNextSegment : ( segmentId : SegmentId , e : any ) => void
23
25
onQueueNextSegment : ( segmentId : SegmentId | null , e : any ) => void
24
26
onSetQuickLoopStart : ( marker : QuickLoopMarker | null , e : any ) => void
25
27
onSetQuickLoopEnd : ( marker : QuickLoopMarker | null , e : any ) => void
26
- onEditSegmentProps : ( id : SegmentId ) => void
27
- onEditPartProps : ( id : PartId ) => void
28
+ onEditProps : ( element : SelectedElement ) => void
28
29
playlist ?: DBRundownPlaylist
29
30
studioMode : boolean
30
31
contextMenuContext : IContextMenuContext | null
@@ -50,6 +51,7 @@ export const SegmentContextMenu = withTranslation()(
50
51
)
51
52
return null
52
53
54
+ const piece = this . getPieceFromContext ( )
53
55
const part = this . getPartFromContext ( )
54
56
const segment = this . getSegmentFromContext ( )
55
57
const timecode = this . getTimePosition ( )
@@ -109,7 +111,9 @@ export const SegmentContextMenu = withTranslation()(
109
111
{ this . props . enableUserEdits && (
110
112
< >
111
113
< hr />
112
- < MenuItem onClick = { ( ) => this . props . onEditSegmentProps ( part . instance . segmentId ) } >
114
+ < MenuItem
115
+ onClick = { ( ) => this . props . onEditProps ( { type : 'segment' , elementId : part . instance . segmentId } ) }
116
+ >
113
117
< span > { t ( 'Edit Segment Properties' ) } </ span >
114
118
</ MenuItem >
115
119
</ >
@@ -198,12 +202,23 @@ export const SegmentContextMenu = withTranslation()(
198
202
{ this . props . enableUserEdits && (
199
203
< >
200
204
< hr />
201
- < MenuItem onClick = { ( ) => this . props . onEditSegmentProps ( part . instance . segmentId ) } >
205
+ < MenuItem
206
+ onClick = { ( ) => this . props . onEditProps ( { type : 'segment' , elementId : part . instance . segmentId } ) }
207
+ >
202
208
< span > { t ( 'Edit Segment Properties' ) } </ span >
203
209
</ MenuItem >
204
- < MenuItem onClick = { ( ) => this . props . onEditPartProps ( part . instance . part . _id ) } >
210
+ < MenuItem
211
+ onClick = { ( ) => this . props . onEditProps ( { type : 'part' , elementId : part . instance . part . _id } ) }
212
+ >
205
213
< span > { t ( 'Edit Part Properties' ) } </ span >
206
214
</ MenuItem >
215
+ { piece && piece . instance . piece . userEditProperties && (
216
+ < MenuItem
217
+ onClick = { ( ) => this . props . onEditProps ( { type : 'piece' , elementId : piece . instance . piece . _id } ) }
218
+ >
219
+ < span > { t ( 'Edit Piece Properties' ) } </ span >
220
+ </ MenuItem >
221
+ ) }
207
222
</ >
208
223
) }
209
224
</ >
@@ -229,6 +244,14 @@ export const SegmentContextMenu = withTranslation()(
229
244
}
230
245
}
231
246
247
+ getPieceFromContext = ( ) : PieceExtended | null => {
248
+ if ( this . props . contextMenuContext && this . props . contextMenuContext . piece ) {
249
+ return this . props . contextMenuContext . piece
250
+ } else {
251
+ return null
252
+ }
253
+ }
254
+
232
255
// private onSetAsNextFromHere = (part: DBPart, e) => {
233
256
// const offset = this.getTimePosition()
234
257
// this.props.onSetNext(part, e, offset || 0)
0 commit comments