Skip to content

Add search bar to home screen#1775

Open
Srinath-Vulkunda wants to merge 1 commit into
IgnisDa:mainfrom
Srinath-Vulkunda:frontend
Open

Add search bar to home screen#1775
Srinath-Vulkunda wants to merge 1 commit into
IgnisDa:mainfrom
Srinath-Vulkunda:frontend

Conversation

@Srinath-Vulkunda
Copy link
Copy Markdown

@Srinath-Vulkunda Srinath-Vulkunda commented May 31, 2026

This pull request adds a new "Discover your library" search feature to the dashboard page, allowing users to search and filter their media library by type (e.g., Anime, Books, Movies). It introduces a debounced search input, category filter buttons, and displays search results in a grid with loading and empty states.

New search and filter functionality:

  • Added state and UI for dashboardSearchLot and dashboardSearchQuery to manage media type and search input, including a debounced search input (DebouncedSearchInput) and filter buttons for different media categories. [1] [2]
  • Integrated a new query (UserMetadataListDocument) using React Query to fetch and display search results based on the user's input and selected media type, with loading and empty result handling. [1] [2]

Supporting code and imports:

  • Imported new types, queries, and components needed for the search/filter feature, including MediaLot, MediaSortBy, UserMetadataListDocument, UserMetadataListInput, and DebouncedSearchInput. [1] [2]
  • Added useState to manage local state for search input and filter selection.

Summary by CodeRabbit

Release Notes

  • New Features
    • Added search functionality to discover media in your library with a new search interface
    • Filter results by media type using dedicated filter buttons
    • Real-time search with grid display, loading indicators, and empty-state messaging for enhanced browsing

Copilot AI review requested due to automatic review settings May 31, 2026 16:02
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 31, 2026

Review Change Stack

Walkthrough

The dashboard route adds a "Discover your library" search feature that filters media by query string and media lot. Search state is managed locally, metadata is fetched via GraphQL when a query is present, and results are conditionally rendered as a grid, empty state, or loading skeleton.

Changes

Dashboard Search Feature

Layer / File(s) Summary
Import Setup
apps/frontend/app/routes/_dashboard._index.tsx
GraphQL media enums and documents, UserMetadataListInput type, React useState hook, and DebouncedSearchInput component are imported to support search functionality.
Search State & Data Layer
apps/frontend/app/routes/_dashboard._index.tsx
Component state initializes dashboardSearchLot (defaulting to "ALL") and dashboardSearchQuery (empty string). A useMemo computes search input, and useQuery fetches UserMetadataListDocument only when the query is non-empty.
Search UI & Results Rendering
apps/frontend/app/routes/_dashboard._index.tsx
"Discover your library" section renders a debounced search input, lot filter buttons, and conditionally shows a results grid, no-results message, or loading skeleton based on query state and fetch status.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add search bar to home screen' accurately reflects the main change: adding search functionality to the dashboard/home screen.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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.

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: 2

🤖 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 `@apps/frontend/app/routes/_dashboard._index.tsx`:
- Around line 49-50: Imports are out of alphabetical order; move the import of
DebouncedSearchInput (from ~/components/common/filters) so it appears before the
import of ApplicationGrid (from ~/components/common/layout). Update the two
import lines so they are alphabetically sorted by module path (filters before
layout) to satisfy tooling/linters and CI.
- Around line 94-97: Swap the two React hook declarations so the shorter
single-line state hook dashboardSearchQuery (useState("")) is declared before
the multi-line dashboardSearchLot (useState<MediaLot | "ALL">("ALL")), i.e.,
reorder the declarations of dashboardSearchQuery and dashboardSearchLot to
follow ascending line length while keeping useState types and initializers
unchanged.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2091da02-a17b-4f26-9242-57c95e5f3869

📥 Commits

Reviewing files that changed from the base of the PR and between 009b654 and 9ef26d3.

📒 Files selected for processing (1)
  • apps/frontend/app/routes/_dashboard._index.tsx

Comment on lines 49 to +50
import { ApplicationGrid } from "~/components/common/layout";
import { DebouncedSearchInput } from "~/components/common/filters";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Import out of alphabetical order.

~/components/common/filters should precede ~/components/common/layout. This ordering is tooling-enforced and may fail lint/CI.

♻️ Proposed fix
-import { ApplicationGrid } from "~/components/common/layout";
 import { DebouncedSearchInput } from "~/components/common/filters";
+import { ApplicationGrid } from "~/components/common/layout";

As per coding guidelines: "Import statements should follow alphabetical ordering as enforced by tooling".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { ApplicationGrid } from "~/components/common/layout";
import { DebouncedSearchInput } from "~/components/common/filters";
import { DebouncedSearchInput } from "~/components/common/filters";
import { ApplicationGrid } from "~/components/common/layout";
🤖 Prompt for 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.

In `@apps/frontend/app/routes/_dashboard._index.tsx` around lines 49 - 50, Imports
are out of alphabetical order; move the import of DebouncedSearchInput (from
~/components/common/filters) so it appears before the import of ApplicationGrid
(from ~/components/common/layout). Update the two import lines so they are
alphabetically sorted by module path (filters before layout) to satisfy
tooling/linters and CI.

Comment on lines +94 to +97
const [dashboardSearchLot, setDashboardSearchLot] = useState<MediaLot | "ALL">(
"ALL",
);
const [dashboardSearchQuery, setDashboardSearchQuery] = useState("");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial | 💤 Low value

Order the new hooks by ascending line length.

dashboardSearchQuery (single line) should be declared before the multi-line dashboardSearchLot.

♻️ Proposed fix
+	const [dashboardSearchQuery, setDashboardSearchQuery] = useState("");
 	const [dashboardSearchLot, setDashboardSearchLot] = useState<MediaLot | "ALL">(
 		"ALL",
 	);
-	const [dashboardSearchQuery, setDashboardSearchQuery] = useState("");

As per coding guidelines: "When declaring multiple variables in sequence (particularly React hooks), order them by ascending line length".

🤖 Prompt for 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.

In `@apps/frontend/app/routes/_dashboard._index.tsx` around lines 94 - 97, Swap
the two React hook declarations so the shorter single-line state hook
dashboardSearchQuery (useState("")) is declared before the multi-line
dashboardSearchLot (useState<MediaLot | "ALL">("ALL")), i.e., reorder the
declarations of dashboardSearchQuery and dashboardSearchLot to follow ascending
line length while keeping useState types and initializers unchanged.

@IgnisDa
Copy link
Copy Markdown
Owner

IgnisDa commented Jun 1, 2026

Please add some screenshots so that I can verify it visually.

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.

3 participants