Skip to content

feat: support filter media type in media panel#45

Merged
izadoesdev merged 3 commits into
OpenCut-app:mainfrom
GeorgeCaoJ:feat/media-panel-filter
Jun 24, 2025
Merged

feat: support filter media type in media panel#45
izadoesdev merged 3 commits into
OpenCut-app:mainfrom
GeorgeCaoJ:feat/media-panel-filter

Conversation

@GeorgeCaoJ
Copy link
Copy Markdown
Contributor

@GeorgeCaoJ GeorgeCaoJ commented Jun 24, 2025

Description

support filter media type in media panel

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Performance improvement
  • Code refactoring
  • Tests

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Test Configuration:

  • Node version:
  • Browser (if applicable):
  • Operating System:

Screenshots (if applicable)

image

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • New Features
    • Added media filtering and search functionality to the media panel, allowing users to filter media items by type and search by name.
    • Updated the interface with a dropdown for media type selection and a search input for easier navigation of media items.
    • Improved empty state messaging to reflect filtered results.

@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 24, 2025

👷 Deploy request for appcut pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 25dc5f5

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 24, 2025

Walkthrough

The MediaPanel component was updated to support filtering media by type and searching by name. New state variables and a useEffect were added to manage and compute filtered results. The UI now features a dropdown for media type and a search input, displaying only media items matching the selected criteria.

Changes

File(s) Change Summary
apps/web/src/components/editor/media-panel.tsx Added state for search and filter, UI controls for filtering/searching, and logic to display filtered media items.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant MediaPanel

    User->>MediaPanel: Selects media type filter or enters search query
    MediaPanel->>MediaPanel: Updates searchQuery and/or mediaFilter state
    MediaPanel->>MediaPanel: useEffect triggers filtering logic
    MediaPanel->>MediaPanel: Computes filteredMediaItems
    MediaPanel-->>User: Renders filtered media items in UI
Loading

Poem

In the meadow of media, where files abound,
A filter and search now easily found.
With dropdown and query, your hunt is a breeze,
Only the right files shown—search as you please!
The panel now smarter, a rabbit’s delight,
Hop, filter, and search—your media in sight!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 984be4f and 25dc5f5.

📒 Files selected for processing (1)
  • apps/web/src/components/editor/media-panel.tsx (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/src/components/editor/media-panel.tsx
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@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: 1

🧹 Nitpick comments (2)
apps/web/src/components/editor/media-panel.tsx (2)

83-83: Consider initializing as empty array.

While the current initialization works, consider initializing filteredMediaItems as an empty array to be more explicit about the initial state before the useEffect runs.

-  const [filteredMediaItems, setFilteredMediaItems] = useState(mediaItems);
+  const [filteredMediaItems, setFilteredMediaItems] = useState<any[]>([]);

210-250: Enhance accessibility of form controls.

The new UI layout looks good, but the dropdown and search input could benefit from accessibility improvements.

              <select
                value={mediaFilter}
                onChange={(e) => setMediaFilter(e.target.value)}
                className="px-2 py-1 text-xs border rounded bg-background"
+               aria-label="Filter media by type"
              >
                <option value="all">All</option>
                <option value="video">Video</option>
                <option value="audio">Audio</option>
                <option value="image">Image</option>
              </select>
              <input
                type="text"
                placeholder="Search media..."
                className="min-w-[60px] flex-1 px-2 py-1 text-xs border rounded bg-background"
                value={searchQuery}
                onChange={(e) => setSearchQuery(e.target.value)}
+               aria-label="Search media items"
              />
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9e761a9 and 984be4f.

📒 Files selected for processing (1)
  • apps/web/src/components/editor/media-panel.tsx (5 hunks)
🔇 Additional comments (3)
apps/web/src/components/editor/media-panel.tsx (3)

10-10: LGTM!

The useEffect import is correctly added to support the new filtering functionality.


85-99: Well-implemented filtering logic.

The filtering logic correctly handles both media type filtering and search functionality:

  • Filters by media type when not "all"
  • Performs case-insensitive search on item names
  • Uses proper dependency array for the useEffect

The implementation is clean and efficient.


255-255: Correct implementation of filtered rendering.

The changes to use filteredMediaItems instead of mediaItems for both the empty state check and the mapping logic are implemented correctly. This ensures the UI properly reflects the current filter and search state.

Also applies to: 270-270

Comment thread apps/web/src/components/editor/media-panel.tsx Outdated
@izadoesdev izadoesdev merged commit b17e05f into OpenCut-app:main Jun 24, 2025
1 check passed
@GeorgeCaoJ GeorgeCaoJ deleted the feat/media-panel-filter branch June 25, 2025 01:40
zstar1003 pushed a commit to zstar1003/FlashCut that referenced this pull request Jan 28, 2026
…lter

feat: support filter media type in media panel
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