-
Notifications
You must be signed in to change notification settings - Fork 18
Feat: UI piece retiming #78
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
base: main
Are you sure you want to change the base?
Conversation
a64166a to
3ed6f11
Compare
3ed6f11 to
f17aaa0
Compare
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.
0bd326f to
3e54a72
Compare
There was a problem hiding this 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 |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
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.
| 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) |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
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.
| // 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()}` |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
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.
| // Example payload structure for retime operations: | ||
| // "payload": { | ||
| // "segmentExternalId": "d26d22e2-4f4e-4d31-a0ca-de6f37ff9b3f", | ||
| // "partExternalId": "42077925-8d15-4a5d-abeb-a445ccee2984", | ||
| // "inPoint": 1061.4136732329084 | ||
| // } |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
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.
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.