Skip to content

Conversation

@rjmunro
Copy link
Contributor

@rjmunro rjmunro commented Oct 22, 2025

Blueprint to demo / test dragging and dropping pieces as enabled by Sofie-Automation/sofie-core#1544 or bbc/sofie-core#58. Requires those to be merged then the version of blueprints-integration bumped before it will pass CI.

Part of my confusion developing this was that updatePieceProps doesn't seem to actually update anything. I've added a TODO to record that fact.

@rjmunro rjmunro force-pushed the feat/ui-piece-retiming branch from a64166a to 3ed6f11 Compare October 22, 2025 11:41
@rjmunro rjmunro force-pushed the feat/ui-piece-retiming branch from 3ed6f11 to f17aaa0 Compare January 12, 2026 14:54
So that we aren't prompted to press the fix-up button and
`--development` mode can work

Leave commented out because this repo serves as an example
to people making their own blueprints later, and they might
need to use it.
config.studio.casparcg was undefined
Yarn was failing when using yarn-link without this change.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds drag-and-drop piece retiming functionality to enable users to adjust piece timing through the Sofie UI. It depends on pending changes in sofie-core and includes a type-fest downgrade to resolve dependency conflicts.

Changes:

  • Implements piece retiming handler that processes drag-and-drop timing operations with validation and clamping logic
  • Enables user edit operations including a new edit mode toggle hotkey (Shift+KeyE)
  • Downgrades type-fest from v5.3.1 to v4.33.0

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
yarn.lock Downgrades type-fest to 4.33.0 and removes tagged-tag dependency
packages/blueprints/src/base/studio/userEditOperations/processIngestData.ts Adds processRetimePiece function to handle drag-and-drop piece retiming with validation logic
packages/blueprints/src/base/studio/applyConfig/index.ts Enables user edits flag and adds optional chaining for casparcg config
packages/blueprints/src/base/showstyle/manifest.ts Comments out fixUpConfig function
packages/blueprints/src/base/showstyle/helpers/userEditOperations.ts Creates new helper for piece user edit operations
packages/blueprints/src/base/showstyle/helpers/graphics.ts Integrates user edit operations into graphics pieces
packages/blueprints/src/base/showstyle/applyconfig/triggered-actions.ts Adds edit mode toggle hotkey binding
packages/blueprints/package.json Updates type-fest dependency version

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

// Parse the part payload to access pieces
const partPayload: any = part.payload
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using any type defeats type safety. Consider defining a proper interface for the part payload structure that includes the pieces array and duration properties, or at minimum use unknown and perform proper type narrowing.

Copilot uses AI. Check for mistakes.
context.logDebug('Original partPayload: ' + JSON.stringify(partPayload, null, 2))

// Find the specific piece to retime
const pieceIndex = partPayload.pieces.findIndex((piece: any) => piece.id === operationTarget.pieceExternalId)
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using any type for the piece parameter defeats type safety. Consider defining a proper interface for the piece structure.

Copilot uses AI. Check for mistakes.
// Each retime gets a unique key to ensure state changes trigger persistence
// This is a horrible hack.
// segment.setUserEditState(pieceRetimeKey, true)
const pieceRetimeKey = `${operation.id}_${operationTarget.pieceExternalId}_${Date.now()}`
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using Date.now() in the key creates timestamp-based keys that will accumulate over time without cleanup. Consider documenting why unique keys are needed for each retime operation, or explore a better approach that doesn't rely on timestamps.

Copilot uses AI. Check for mistakes.
Comment on lines +185 to +190
// Example payload structure for retime operations:
// "payload": {
// "segmentExternalId": "d26d22e2-4f4e-4d31-a0ca-de6f37ff9b3f",
// "partExternalId": "42077925-8d15-4a5d-abeb-a445ccee2984",
// "inPoint": 1061.4136732329084
// }
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example payload structure uses inconsistent indentation (tabs vs spaces). Align the indentation consistently to improve readability.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants