feat: add audio select menu#447
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe PR generalizes file retrieval by type and adds frontend audio authoring support, including typed audio components, upload and selection flows, audio playback lists, scene integration, and updated image endpoint usage. ChangesAudio file authoring
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant AuthoringUI
participant AudioManager
participant FilesAPI
participant AudioSelectModal
participant VisualScene
AuthoringUI->>AudioManager: Open audio controls
AudioManager->>FilesAPI: Upload audio or open selection
FilesAPI-->>AudioManager: UploadedFile metadata
AudioManager->>AudioSelectModal: Fetch existing audio
AudioSelectModal-->>AudioManager: Selected UploadedFile
AudioManager->>VisualScene: Add AudioComponent
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@backend/src/routes/api/files.js`:
- Around line 108-118: The GET route using "/:scenarioId/:type" conflicts with
single-file retrieval routes by interpreting file IDs as types. Update this
route to a distinct type-filter path, such as "/:scenarioId/type/:type", while
preserving VALID_TYPES validation and retrieveFiles usage; update all callers
and tests to use the new path and keep file-ID requests resolving to their
existing handler.
In `@frontend/src/features/authoring/audio/AudioManager.tsx`:
- Around line 16-34: Update addNewAudio and its picker usages to restrict
selection with accept="audio/*", and validate file.type.startsWith("audio/")
before calling api.post or creating the audio component. Reject non-audio files
early while preserving the existing upload flow for valid audio files.
- Around line 77-93: Replace the click-only dropdown trigger and href-less
anchors in AudioManager.tsx (lines 77-93) with native buttons while preserving
showFilePicker and showModal behavior. In AudioListContainer.tsx (lines 47-68),
render selection and playback as sibling buttons rather than nesting one
interactive control inside another.
- Around line 105-108: Update the audios.map rendering in the audio editor list
to use each audio component’s stable component ID as the React key instead of
the array index. Preserve the existing EditAudioComponent rendering and pass the
ID-based key from the audio object.
In `@frontend/src/features/authoring/audio/AudioSelectModal.tsx`:
- Around line 56-60: Update handleSubmit to clear the selected audio after
addExistingAudio completes, while preserving the existing close and add flow so
reopening the modal starts with no selection.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 7a26c7dd-6c9c-4235-8193-ddedec7873da
📒 Files selected for processing (11)
backend/src/db/daos/fileDao.jsbackend/src/routes/api/__tests__/filesApi.test.jsbackend/src/routes/api/files.jsfrontend/src/features/authoring/CanvasSideBar/AudioManager.jsxfrontend/src/features/authoring/CanvasSideBar/CanvasSideBar.jsxfrontend/src/features/authoring/audio/AudioListContainer.tsxfrontend/src/features/authoring/audio/AudioManager.tsxfrontend/src/features/authoring/audio/AudioSelectModal.tsxfrontend/src/features/authoring/audio/EditAudioComponent.tsxfrontend/src/features/authoring/images.tsxfrontend/src/features/authoring/types.ts
💤 Files with no reviewable changes (1)
- frontend/src/features/authoring/CanvasSideBar/AudioManager.jsx
|
@coderabbitai review |
✅ Action performedReview finished.
|
Issue
A clear and concise description of what the issue is
Solution
A clear and concise description of what the solution is
Risk
Potential risks that this PR might bring
Checklist
Summary by CodeRabbit
New Features
Bug Fixes