77 JSONBlob ,
88 JSONBlobParse ,
99 JSONSchema ,
10+ UserEditingDefinitionAction ,
1011 UserEditingProperties ,
1112 UserEditingSourceLayer ,
1213 UserEditingType ,
@@ -23,6 +24,8 @@ import { RundownUtils } from '../../lib/rundown'
2324import * as CoreIcon from '@nrk/core-icons/jsx'
2425import { useCallback } from 'react'
2526import { SchemaFormWithState } from '../../lib/forms/SchemaFormWithState'
27+ import { t } from 'i18next'
28+ import { translateMessage } from '@sofie-automation/corelib/dist/TranslatableMessage'
2629
2730type PendingChange = DefaultUserOperationEditProperties [ 'payload' ]
2831
@@ -117,6 +120,25 @@ export function PropertiesPanel(): JSX.Element {
117120 clearSelections ( )
118121 }
119122
123+ const executeAction = ( e : React . MouseEvent , id : string ) => {
124+ if ( ! rundownId || ! selectedElement ) return
125+ doUserAction ( t , e , UserAction . EXECUTE_USER_OPERATION , ( e , ts ) =>
126+ MeteorCall . userAction . executeUserChangeOperation (
127+ e ,
128+ ts ,
129+ rundownId ,
130+ {
131+ segmentExternalId : segment ?. externalId ,
132+ partExternalId : part ?. externalId ,
133+ pieceExternalId : undefined ,
134+ } ,
135+ {
136+ id,
137+ }
138+ )
139+ )
140+ }
141+
120142 const userEditOperations =
121143 selectedElement ?. type === 'part'
122144 ? part ?. userEditOperations
@@ -176,6 +198,9 @@ export function PropertiesPanel(): JSX.Element {
176198 setChange = { setPendingChange }
177199 />
178200 ) }
201+ { userEditProperties ?. operations && (
202+ < ActionList actions = { userEditProperties ?. operations } executeAction = { executeAction } />
203+ ) }
179204 </ div >
180205
181206 < div className = "propertiespanel-pop-up__footer" >
@@ -184,6 +209,14 @@ export function PropertiesPanel(): JSX.Element {
184209 onClick = { handleRevertChanges }
185210 // disabled={!hasPendingChanges}
186211 >
212+ < span className = "svg" >
213+ < svg viewBox = "0 0 20 15" fill = "none" xmlns = "http://www.w3.org/2000/svg" >
214+ < path
215+ d = "M2 14.5251H15C16.3261 14.5251 17.5979 13.9984 18.5355 13.0607C19.4732 12.123 20 10.8512 20 9.52515C20 8.19906 19.4732 6.92729 18.5355 5.98961C17.5979 5.05193 16.3261 4.52515 15 4.52515H10V0.475147L5 5.47515L10 10.4751V6.52515H15C15.7956 6.52515 16.5587 6.84122 17.1213 7.40383C17.6839 7.96643 18 8.7295 18 9.52515C18 10.3208 17.6839 11.0839 17.1213 11.6465C16.5587 12.2091 15.7956 12.5251 15 12.5251H2V14.5251Z"
216+ fill = "#979797"
217+ />
218+ </ svg >
219+ </ span >
187220 < span className = "propertiespanel-pop-up__label" > { t ( 'Restore from NRCS' ) } </ span >
188221 </ button >
189222 < div className = "propertiespanel-pop-up__button-group" >
@@ -233,7 +266,6 @@ function PropertiesEditor({
233266 )
234267 const onUpdate = useCallback (
235268 ( update : Record < string , any > ) => {
236- console . log ( change . pieceTypeProperties . type , update )
237269 setChange ( {
238270 ...change ,
239271 pieceTypeProperties : {
@@ -269,7 +301,7 @@ function PropertiesEditor({
269301 </ div >
270302 < hr />
271303 { parsedSchema && (
272- < div className = "properties-grid form-dark " >
304+ < div className = "properties-panel-pop-up__form styled-schema-form " >
273305 < SchemaFormWithState
274306 key = { ( selectedGroupSchema as any as string ) ?? 'key' }
275307 schema = { parsedSchema }
@@ -301,7 +333,6 @@ function GlobalPropertiesEditor({
301333
302334 const onUpdate = useCallback (
303335 ( update : Record < string , any > ) => {
304- console . log ( 'glob' , update )
305336 setChange ( {
306337 ...change ,
307338 globalProperties : update ,
@@ -326,3 +357,36 @@ function GlobalPropertiesEditor({
326357 </ div >
327358 )
328359}
360+
361+ function ActionList ( {
362+ actions,
363+ executeAction,
364+ } : {
365+ actions : UserEditingDefinitionAction [ ]
366+ executeAction : ( e : any , id : string ) => void
367+ } ) {
368+ const { t } = useTranslation ( )
369+
370+ return (
371+ < div >
372+ { actions . map ( ( action ) => (
373+ < button
374+ title = { 'User Action : ' + action . label . key }
375+ className = "propertiespanel-pop-up__button"
376+ onClick = { ( e ) => executeAction ( e , action . id ) }
377+ key = { action . id }
378+ >
379+ { action . svgIcon && (
380+ < span
381+ className = "svg"
382+ dangerouslySetInnerHTML = { {
383+ __html : action . svgIcon ,
384+ } }
385+ > </ span >
386+ ) }
387+ < span className = "propertiespanel-pop-up__label" > { translateMessage ( action . label , t ) } </ span >
388+ </ button >
389+ ) ) }
390+ </ div >
391+ )
392+ }
0 commit comments