Implement public site search #99

Closed
opened 2026-05-28 15:01:01 -05:00 by Codex · 1 comment
Member

The public-facing site already displays a search box in the sticky site header, but submitting it does not currently search anything.

The current Laravel checkout has <x-site-header> rendering a search form with action="#" and a search input. There is also an older GameSearchController::search() method that queries Game::where('name', 'like', ...) / alt_titles, but no public route appears to wire that controller into routes/web.php, and the search results view path should be verified before reuse. This issue tracks making public game search work end-to-end from the header.

Scope

  • Public game search from the top site header.
  • A canonical public search route and named route for the search form.
  • Search request validation, empty-query handling, and query length limits.
  • Search results page using the existing public site layout and Tailwind styling.
  • Matching against game names and alternate titles at minimum.
  • Pagination that preserves the search query across result pages.
  • Guest and authenticated-user access.
  • Cleanup or replacement of the stale/unwired GameSearchController behavior as appropriate.

Acceptance Criteria

  • The header search form submits to a real public Laravel route instead of #.
  • Guests and authenticated users can search from public-facing pages.
  • Searching by an existing game name returns matching games.
  • Searching by an alternate title returns matching games.
  • Search results link to the existing public game detail route.
  • The search term remains visible in the header or results UI after submission.
  • Result pagination keeps the current search query when navigating between pages.
  • Empty or whitespace-only searches do not produce a broken page or unhelpful validation dump.
  • Overly long searches are rejected or normalized with user-friendly behavior.
  • No-results searches render a clear empty state using the existing site layout.
  • The implementation avoids N+1 query problems for any related data displayed in results.
  • Existing public pages continue to render the header without route or Vite errors.

Test Coverage Required

  • Feature test confirming the header search form points at the canonical search route.
  • Feature tests confirming guests and authenticated users can access the search route.
  • Feature test confirming game-name matches render in search results.
  • Feature test confirming alternate-title matches render in search results.
  • Feature test confirming result links point to the existing game detail route.
  • Feature test confirming empty or whitespace-only searches are handled cleanly.
  • Feature test confirming no-results searches show an empty state.
  • Feature or pagination test confirming the query string is preserved across pages.
  • Regression test confirming the public header still renders on representative public pages.
  • Tests should use Pest and focused feature coverage.
  • Run the focused affected tests, then run vendor/bin/pint --dirty before closing the issue.

Progress Checklist

  • Public site header includes a visible search input
  • Existing GameSearchController::search() contains partial/stale search behavior
  • Choose the canonical search URL and route name
  • Wire the header form to the canonical search route
  • Decide whether to refactor, replace, or remove stale GameSearchController methods
  • Build or verify the search results view path
  • Implement request validation and empty-query behavior
  • Implement game-name and alternate-title matching
  • Add pagination that preserves the search query
  • Add a no-results empty state
  • Ensure result cards/rows link to public game detail pages
  • Add focused Pest feature tests for route access, matching, empty states, pagination, and header wiring
  • Run the focused affected test file(s)
  • Run vendor/bin/pint --dirty
The public-facing site already displays a search box in the sticky site header, but submitting it does not currently search anything. The current Laravel checkout has `<x-site-header>` rendering a search form with `action="#"` and a `search` input. There is also an older `GameSearchController::search()` method that queries `Game::where('name', 'like', ...)` / `alt_titles`, but no public route appears to wire that controller into `routes/web.php`, and the search results view path should be verified before reuse. This issue tracks making public game search work end-to-end from the header. ## Scope - Public game search from the top site header. - A canonical public search route and named route for the search form. - Search request validation, empty-query handling, and query length limits. - Search results page using the existing public site layout and Tailwind styling. - Matching against game names and alternate titles at minimum. - Pagination that preserves the search query across result pages. - Guest and authenticated-user access. - Cleanup or replacement of the stale/unwired `GameSearchController` behavior as appropriate. ## Acceptance Criteria - The header search form submits to a real public Laravel route instead of `#`. - Guests and authenticated users can search from public-facing pages. - Searching by an existing game name returns matching games. - Searching by an alternate title returns matching games. - Search results link to the existing public game detail route. - The search term remains visible in the header or results UI after submission. - Result pagination keeps the current search query when navigating between pages. - Empty or whitespace-only searches do not produce a broken page or unhelpful validation dump. - Overly long searches are rejected or normalized with user-friendly behavior. - No-results searches render a clear empty state using the existing site layout. - The implementation avoids N+1 query problems for any related data displayed in results. - Existing public pages continue to render the header without route or Vite errors. ## Test Coverage Required - Feature test confirming the header search form points at the canonical search route. - Feature tests confirming guests and authenticated users can access the search route. - Feature test confirming game-name matches render in search results. - Feature test confirming alternate-title matches render in search results. - Feature test confirming result links point to the existing game detail route. - Feature test confirming empty or whitespace-only searches are handled cleanly. - Feature test confirming no-results searches show an empty state. - Feature or pagination test confirming the query string is preserved across pages. - Regression test confirming the public header still renders on representative public pages. - Tests should use Pest and focused feature coverage. - Run the focused affected tests, then run `vendor/bin/pint --dirty` before closing the issue. ## Progress Checklist - [x] Public site header includes a visible search input - [x] Existing `GameSearchController::search()` contains partial/stale search behavior - [x] Choose the canonical search URL and route name - [x] Wire the header form to the canonical search route - [x] Decide whether to refactor, replace, or remove stale `GameSearchController` methods - [x] Build or verify the search results view path - [x] Implement request validation and empty-query behavior - [x] Implement game-name and alternate-title matching - [x] Add pagination that preserves the search query - [x] Add a no-results empty state - [x] Ensure result cards/rows link to public game detail pages - [x] Add focused Pest feature tests for route access, matching, empty states, pagination, and header wiring - [x] Run the focused affected test file(s) - [x] Run `vendor/bin/pint --dirty`
jimmyb self-assigned this 2026-05-29 14:48:10 -05:00
Owner

Work completed!

Work completed!
Sign in to join this conversation.
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MyVideoGameList/myvideogamelist.com#99
No description provided.