Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/UI piece retiming #35

Open
wants to merge 3 commits into
base: bbc-release52
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/blueprints-integration/src/ingest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export enum DefaultUserOperationsTypes {
REVERT_PART = '__sofie-revert-part',
REVERT_RUNDOWN = '__sofie-revert-rundown',
UPDATE_PROPS = '__sofie-update-props',
RETIME_PIECE = '__sofie-retime-piece',
}

export interface DefaultUserOperationRevertRundown {
Expand All @@ -153,6 +154,17 @@ export interface DefaultUserOperationEditProperties {
}
}

export type DefaultUserOperationRetimePiece = {
id: DefaultUserOperationsTypes.RETIME_PIECE
payload: {
segmentExternalId: string
partExternalId: string

inPoint: number
// note - at some point this could also include an updated duration
}
}

export type DefaultUserOperations =
| DefaultUserOperationRevertRundown
| DefaultUserOperationRevertSegment
Expand Down
7 changes: 7 additions & 0 deletions packages/blueprints-integration/src/triggers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ export interface IShelfAction extends ITriggeredActionBase {
filterChain: IGUIContextFilterLink[]
}

export interface IEditModeAction extends ITriggeredActionBase {
action: ClientActions.editMode
state: true | false | 'toggle'
filterChain: IGUIContextFilterLink[]
}

export interface IGoToOnAirLineAction extends ITriggeredActionBase {
action: ClientActions.goToOnAirLine
filterChain: IGUIContextFilterLink[]
Expand Down Expand Up @@ -318,6 +324,7 @@ export type SomeAction =
| IRundownPlaylistResetAction
| IRundownPlaylistResyncAction
| IShelfAction
| IEditModeAction
| IGoToOnAirLineAction
| IRewindSegmentsAction
| IShowEntireCurrentSegmentAction
Expand Down
17 changes: 16 additions & 1 deletion packages/blueprints-integration/src/userEditing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ import type { JSONBlob } from '@sofie-automation/shared-lib/dist/lib/JSONBlob'
import type { ITranslatableMessage } from './translations'
import { JSONSchema } from '@sofie-automation/shared-lib/dist/lib/JSONSchemaTypes'
import { SourceLayerType } from './content'
import { DefaultUserOperationsTypes } from './ingest'

/**
* Description of a user performed editing operation allowed on an document
*/
export type UserEditingDefinition = UserEditingDefinitionAction | UserEditingDefinitionForm
export type UserEditingDefinition =
| UserEditingDefinitionAction
| UserEditingDefinitionForm
| UserEditingDefinitionSofieDefault

/**
* A simple 'action' that can be performed
Expand Down Expand Up @@ -40,11 +44,22 @@ export interface UserEditingDefinitionForm {
currentValues: Record<string, any>
}

/**
* A built in Sofie User operation
*/
export interface UserEditingDefinitionSofieDefault {
type: UserEditingType.SOFIE
/** Id of this operation */
id: DefaultUserOperationsTypes
}

export enum UserEditingType {
/** Action */
ACTION = 'action',
/** Form */
FORM = 'form',
/** Operation for the Built-in Sofie Rich Editing UI */
SOFIE = 'sofie',
}

export interface UserEditingSourceLayer {
Expand Down
12 changes: 11 additions & 1 deletion packages/corelib/src/dataModel/UserEditingDefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ import type {
JSONBlob,
JSONSchema,
UserEditingSourceLayer,
DefaultUserOperationsTypes,
} from '@sofie-automation/blueprints-integration'
import type { ITranslatableMessage } from '../TranslatableMessage'

export type CoreUserEditingDefinition = CoreUserEditingDefinitionAction | CoreUserEditingDefinitionForm
export type CoreUserEditingDefinition =
| CoreUserEditingDefinitionAction
| CoreUserEditingDefinitionForm
| CoreUserEditingDefinitionSofie

export interface CoreUserEditingDefinitionAction {
type: UserEditingType.ACTION
Expand Down Expand Up @@ -83,3 +87,9 @@ export interface CoreUserEditingProperties {
/** Translation namespaces to use when rendering this form */
translationNamespaces: string[]
}

export interface CoreUserEditingDefinitionSofie {
type: UserEditingType.SOFIE
/** Id of this operation */
id: DefaultUserOperationsTypes
}
27 changes: 19 additions & 8 deletions packages/job-worker/src/blueprints/context/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import {
UserEditingDefinition,
UserEditingDefinitionAction,
UserEditingDefinitionForm,
UserEditingDefinitionSofieDefault,
UserEditingProperties,
UserEditingType,
} from '@sofie-automation/blueprints-integration/dist/userEditing'
Expand Down Expand Up @@ -516,22 +517,27 @@ function translateUserEditsToBlueprint(
userEdits.map((userEdit) => {
switch (userEdit.type) {
case UserEditingType.ACTION:
return {
return literal<UserEditingDefinitionAction>({
type: UserEditingType.ACTION,
id: userEdit.id,
label: omit(userEdit.label, 'namespaces'),
svgIcon: userEdit.svgIcon,
svgIconInactive: userEdit.svgIconInactive,
isActive: userEdit.isActive,
} satisfies Complete<UserEditingDefinitionAction>
})
case UserEditingType.FORM:
return {
return literal<UserEditingDefinitionForm>({
type: UserEditingType.FORM,
id: userEdit.id,
label: omit(userEdit.label, 'namespaces'),
schema: clone(userEdit.schema),
currentValues: clone(userEdit.currentValues),
} satisfies Complete<UserEditingDefinitionForm>
})
case UserEditingType.SOFIE:
return literal<UserEditingDefinitionSofieDefault>({
type: UserEditingType.SOFIE,
id: userEdit.id,
})
default:
assertNever(userEdit)
return undefined
Expand Down Expand Up @@ -573,23 +579,28 @@ export function translateUserEditsFromBlueprint(
userEdits.map((userEdit) => {
switch (userEdit.type) {
case UserEditingType.ACTION:
return {
return literal<CoreUserEditingDefinitionAction>({
type: UserEditingType.ACTION,
id: userEdit.id,
label: wrapTranslatableMessageFromBlueprints(userEdit.label, blueprintIds),
svgIcon: userEdit.svgIcon,
svgIconInactive: userEdit.svgIconInactive,
isActive: userEdit.isActive,
} satisfies Complete<CoreUserEditingDefinitionAction>
})
case UserEditingType.FORM:
return {
return literal<CoreUserEditingDefinitionForm>({
type: UserEditingType.FORM,
id: userEdit.id,
label: wrapTranslatableMessageFromBlueprints(userEdit.label, blueprintIds),
schema: clone(userEdit.schema),
currentValues: clone(userEdit.currentValues),
translationNamespaces: unprotectStringArray(blueprintIds),
} satisfies Complete<CoreUserEditingDefinitionForm>
})
case UserEditingType.SOFIE:
return literal<UserEditingDefinitionSofieDefault>({
type: UserEditingType.SOFIE,
id: userEdit.id,
})
default:
assertNever(userEdit)
return undefined
Expand Down
7 changes: 7 additions & 0 deletions packages/meteor-lib/src/triggers/RundownViewEventBus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export enum RundownViewEvents {
REVEAL_IN_SHELF = 'revealInShelf',
SWITCH_SHELF_TAB = 'switchShelfTab',
SHELF_STATE = 'shelfState',
EDIT_MODE = 'editMode',
MINI_SHELF_QUEUE_ADLIB = 'miniShelfQueueAdLib',
GO_TO_PART = 'goToPart',
GO_TO_PART_INSTANCE = 'goToPartInstance',
Expand Down Expand Up @@ -74,6 +75,10 @@ export interface ShelfStateEvent extends IEventContext {
state: boolean | 'toggle'
}

export interface EditModeEvent extends IEventContext {
state: boolean | 'toggle'
}

export interface MiniShelfQueueAdLibEvent extends IEventContext {
forward: boolean
}
Expand Down Expand Up @@ -139,6 +144,7 @@ class RundownViewEventBus0 extends EventEmitter {
emit(event: RundownViewEvents.SEGMENT_ZOOM_ON): boolean
emit(event: RundownViewEvents.SEGMENT_ZOOM_OFF): boolean
emit(event: RundownViewEvents.SHELF_STATE, e: ShelfStateEvent): boolean
emit(event: RundownViewEvents.EDIT_MODE, e: EditModeEvent): boolean
emit(event: RundownViewEvents.REVEAL_IN_SHELF, e: RevealInShelfEvent): boolean
emit(event: RundownViewEvents.SWITCH_SHELF_TAB, e: SwitchToShelfTabEvent): boolean
emit(event: RundownViewEvents.MINI_SHELF_QUEUE_ADLIB, e: MiniShelfQueueAdLibEvent): boolean
Expand Down Expand Up @@ -175,6 +181,7 @@ class RundownViewEventBus0 extends EventEmitter {
on(event: RundownViewEvents.SEGMENT_ZOOM_OFF, listener: () => void): this
on(event: RundownViewEvents.REVEAL_IN_SHELF, listener: (e: RevealInShelfEvent) => void): this
on(event: RundownViewEvents.SHELF_STATE, listener: (e: ShelfStateEvent) => void): this
on(event: RundownViewEvents.EDIT_MODE, listener: (e: EditModeEvent) => void): this
on(event: RundownViewEvents.SWITCH_SHELF_TAB, listener: (e: SwitchToShelfTabEvent) => void): this
on(event: RundownViewEvents.MINI_SHELF_QUEUE_ADLIB, listener: (e: MiniShelfQueueAdLibEvent) => void): this
on(event: RundownViewEvents.GO_TO_PART, listener: (e: GoToPartEvent) => void): this
Expand Down
13 changes: 13 additions & 0 deletions packages/meteor-lib/src/triggers/actionFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,17 @@ function createShelfAction(_filterChain: IGUIContextFilterLink[], state: boolean
}
}

function createEditModeAction(_filterChain: IGUIContextFilterLink[], state: boolean | 'toggle'): ExecutableAction {
return {
action: ClientActions.editMode,
execute: () => {
RundownViewEventBus.emit(RundownViewEvents.EDIT_MODE, {
state,
})
},
}
}

function createMiniShelfQueueAdLibAction(_filterChain: IGUIContextFilterLink[], forward: boolean): ExecutableAction {
return {
action: ClientActions.miniShelfQueueAdLib,
Expand Down Expand Up @@ -443,6 +454,8 @@ export function createAction(
switch (action.action) {
case ClientActions.shelf:
return createShelfAction(action.filterChain, action.state)
case ClientActions.editMode:
return createEditModeAction(action.filterChain, action.state)
case ClientActions.goToOnAirLine:
return createGoToOnAirLineAction(action.filterChain)
case ClientActions.rewindSegments:
Expand Down
1 change: 1 addition & 0 deletions packages/shared-lib/src/core/model/ShowStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export enum ClientActions {
'rewindSegments' = 'rewindSegments',
'showEntireCurrentSegment' = 'showEntireCurrentSegment',
'miniShelfQueueAdLib' = 'miniShelfQueueAdLib',
'editMode' = 'editMode',
}

export enum DeviceActions {
Expand Down
5 changes: 4 additions & 1 deletion packages/webui/src/client/lib/ui/pieceUiClassNames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export function pieceUiClassNames(
uiState?: {
leftAnchoredWidth: number
rightAnchoredWidth: number
}
},
draggable?: boolean
): string {
const typeClass = layerType ? RundownUtils.getSourceLayerClassName(layerType) : ''

Expand Down Expand Up @@ -57,5 +58,7 @@ export function pieceUiClassNames(
'invert-flash': highlight,

'element-selected': selected,

'draggable-element': draggable,
})
}
28 changes: 16 additions & 12 deletions packages/webui/src/client/styles/elementSelected.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@
$glow-color: rgba(255, 255, 255, 0.58);

.element-selected {
box-shadow: inset 0 0 15px $glow-color;
animation: subtle-glow 1s ease-in-out infinite;
box-shadow: inset 0 0 15px $glow-color;
animation: subtle-glow 1s ease-in-out infinite;

@keyframes subtle-glow {
0%, 100% {
box-shadow: inset 0 0 15px $glow-color;
}
50% {
box-shadow: inset 0 0 25px $glow-color,
inset 0 0 35px $glow-color;
}
}
}
@keyframes subtle-glow {
0%,
100% {
box-shadow: inset 0 0 15px $glow-color;
}
50% {
box-shadow: inset 0 0 25px $glow-color, inset 0 0 35px $glow-color;
}
}
}

.draggable-element {
border: dotted white 1px;
}
Loading
Loading