Skip to content

[7418] TranscodedVideoPicker control#4825

Draft
jvega190 wants to merge 2 commits intocraftercms:developfrom
jvega190:feature/7418-transcoded-video-picker
Draft

[7418] TranscodedVideoPicker control#4825
jvega190 wants to merge 2 commits intocraftercms:developfrom
jvega190:feature/7418-transcoded-video-picker

Conversation

@jvega190
Copy link
Copy Markdown
Member

@jvega190 jvega190 commented Mar 16, 2026

craftercms/craftercms#7418

Summary by CodeRabbit

  • New Features
    • Added a transcoded video picker for form fields: preview videos in a dialog, replace (when enabled), and delete items; respects readonly state and autofocuses action buttons.
  • Improvements
    • Lazy-loads the video picker for faster initial load and improves form value handling and serialization for array-style video entries.

…o feature/7418-transcoded-video-picker

# Conflicts:
#	ui/app/src/components/FormsEngine/lib/controlMap.ts
#	ui/app/src/components/FormsEngine/lib/valueRetrievers.ts
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6a2d7e22-b773-4df7-b328-d1d014a2b01c

📥 Commits

Reviewing files that changed from the base of the PR and between fa4df38 and a92f6d5.

📒 Files selected for processing (3)
  • ui/app/src/components/FormsEngine/lib/controlMap.ts
  • ui/app/src/components/FormsEngine/lib/valueRetrievers.ts
  • ui/app/src/components/FormsEngine/lib/valueSerializers.ts

Walkthrough

Adds a new TranscodedVideoPicker React control and integrates it into the FormsEngine by registering it in the control map (lazy-loaded), switching its value retriever to array-based extraction, and adding a serializer that prepares array values for XML.

Changes

Cohort / File(s) Summary
New TranscodedVideoPicker Component
ui/app/src/components/FormsEngine/controls/TranscodedVideoPicker.tsx
New React component (exported as named and default) that renders a list of transcoded video items, supports null/empty values, respects read-only state, dispatches a preview dialog on View, and clears value on Delete. Replace action present but disabled.
FormsEngine control registration
ui/app/src/components/FormsEngine/lib/controlMap.ts
Replaces null placeholder with lazy-loaded import for 'transcoded-video-picker' control entry.
Value retrieval
ui/app/src/components/FormsEngine/lib/valueRetrievers.ts
Changes retriever for transcoded-video-picker from textFieldExtractor to arrayFieldExtractor.
Value serialization
ui/app/src/components/FormsEngine/lib/valueSerializers.ts
Adds serializer for transcoded-video-picker that delegates to prepareArray (was previously undefined).

Sequence Diagram

sequenceDiagram
    actor User
    participant Picker as TranscodedVideoPicker
    participant Store as ReduxStore
    participant DialogStack as DialogStack
    participant Preview as PreviewDialog

    User->>Picker: Click "View" on item
    activate Picker
    Picker->>Store: dispatch pushDialog({ type: "video", url: item.url })
    deactivate Picker
    activate Store
    Store->>DialogStack: push dialog entry
    deactivate Store
    activate DialogStack
    DialogStack->>Preview: render with provided URL
    deactivate DialogStack
    activate Preview
    Preview->>User: display video preview
    deactivate Preview
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • rart
🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description only contains a link to the GitHub issue without providing any additional context about what the PR accomplishes or how it addresses the issue. Expand the description to explain the purpose of the TranscodedVideoPicker control, its key features, and how it fulfills the requirements in issue 7418.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically references the ticket number (7418) and identifies the main change: introduction of a TranscodedVideoPicker control component.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use Trivy to scan for security misconfigurations and secrets in Infrastructure as Code files.

Add a .trivyignore file to your project to customize which findings Trivy reports.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
ui/app/src/components/FormsEngine/controls/TranscodedVideoPicker.tsx (1)

64-66: Prefer clearing with an empty array instead of null.

Line 65 sets null, but this control’s value type is an array (TranscodedVideoPickerProps.value) and serializer flow in ui/app/src/components/FormsEngine/lib/valueSerializers.ts:185-190 wraps values as { item: value }. Using [] keeps type/serialization consistent.

Proposed fix
 	const handleRemoveVideos = () => {
-		setValue(null);
+		setValue([]);
 	};
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ui/app/src/components/FormsEngine/controls/TranscodedVideoPicker.tsx` around
lines 64 - 66, The handleRemoveVideos function currently calls setValue(null)
but the control's value type (TranscodedVideoPickerProps.value) is an array and
the serializer expects array values (see valueSerializers wrapping at
ui/app/src/components/FormsEngine/lib/valueSerializers.ts). Change
handleRemoveVideos to clear the value with an empty array instead of null (i.e.,
call setValue([])) so the value type and serialization remain consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ui/app/src/components/FormsEngine/controls/TranscodedVideoPicker.tsx`:
- Around line 85-88: The Replace IconButton in TranscodedVideoPicker is
clickable when readonly is false but has no onClick; fix by wiring a real
handler or disabling the control: add an optional prop (e.g., onReplace) to
TranscodedVideoPicker and pass it to the IconButton as onClick, and update the
disabled expression to disabled={readonly || !onReplace} so the button is inert
when no handler is provided; ensure the IconButton (the instance rendering
EditOutlined) still respects autoFocus.
- Around line 76-93: The IconButton elements in TranscodedVideoPicker.tsx (the
view button that calls handleViewVideo, the replace EditOutlined button, and the
delete button that invokes handleRemoveVideos) are icon-only and lack accessible
names; add explicit aria-label attributes to each IconButton (e.g.,
aria-label="View", aria-label="Replace", aria-label="Delete") that match the
Tooltip text so assistive technologies can identify the actions, ensuring you
update the three IconButton instances adjacent to the VisibilityOutlinedIcon,
EditOutlined, and DeleteOutlined icons accordingly.

---

Nitpick comments:
In `@ui/app/src/components/FormsEngine/controls/TranscodedVideoPicker.tsx`:
- Around line 64-66: The handleRemoveVideos function currently calls
setValue(null) but the control's value type (TranscodedVideoPickerProps.value)
is an array and the serializer expects array values (see valueSerializers
wrapping at ui/app/src/components/FormsEngine/lib/valueSerializers.ts). Change
handleRemoveVideos to clear the value with an empty array instead of null (i.e.,
call setValue([])) so the value type and serialization remain consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c06f39df-4550-473b-ae86-64f67fc95f0c

📥 Commits

Reviewing files that changed from the base of the PR and between a00ae8a and fa4df38.

📒 Files selected for processing (4)
  • ui/app/src/components/FormsEngine/controls/TranscodedVideoPicker.tsx
  • ui/app/src/components/FormsEngine/lib/controlMap.ts
  • ui/app/src/components/FormsEngine/lib/valueRetrievers.ts
  • ui/app/src/components/FormsEngine/lib/valueSerializers.ts

@jvega190
Copy link
Copy Markdown
Member Author

Datasources design/work pending

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.

1 participant