Feat/search improvement#5
Open
Daksh-Vermaa wants to merge 3 commits into
Open
Conversation
Daksh-Vermaa
commented
Jul 13, 2026
Contributor
- Added advanced game search.
- Added real-time search suggestions.
- Added filtering and sorting options for games.
- Improved search page UI and user experience.
- Enhanced navigation from search suggestions to game pages.
- Fixed search-related bugs and edge cases.
|
@Daksh-Vermaa is attempting to deploy a commit to the avneeshkumar01's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
This PR upgrades the games discovery experience by introducing a richer search/filter model, adding real-time search suggestions, and shifting the /games page to a client-driven UI backed by new API proxy routes to RAWG.
Changes:
- Added shared search/filter TypeScript types (sort options, active filters, suggestions) and expanded
Gametyping. - Introduced a new navbar search bar with live suggestions, and refactored the header to use it.
- Rebuilt
/gamesaround a client-side filter + pagination flow (GamesClient) and added new API routes for games/genres/platforms.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/types.ts | Adds genres to Game and introduces search/filter-related types used across the new UI. |
| components/Global/NavSearchBar.tsx | New global search input with debounced live suggestions and keyboard navigation. |
| components/Global/Header.tsx | Replaces the old header search inputs with the new NavSearchBar. |
| components/Games/SearchBar.tsx | Adds a dedicated search bar component with suggestions (currently not wired in). |
| components/Games/HomeGamesSection.tsx | New server-rendered home page games section with Link-based pagination. |
| components/Games/GamesClient.tsx | Client-side search/filter/pagination state synced with URL + data fetching via /api/games. |
| components/Games/GameGrid.tsx | Converts grid to a client component with loading skeletons and callback-based pagination. |
| components/Games/FilterPanel.tsx | Adds filter UI (sort, genres, platforms, tags, year, metacritic) with dropdowns. |
| components/Games/ActiveFiltersBar.tsx | Adds active-filter chips, sort chip, and filter panel toggle with result count. |
| app/page.tsx | Updates home page to use HomeGamesSection and adds page metadata. |
| app/games/page.tsx | Replaces server pagination with Suspense + GamesClient and a skeleton fallback. |
| app/api/platforms/route.ts | New API route to fetch/cached platform metadata from RAWG. |
| app/api/genres/route.ts | New API route to fetch/cached genre metadata from RAWG. |
| app/api/games/route.ts | New API route proxying RAWG games search (supports suggestion mode). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1
to
+4
| "use client"; | ||
|
|
||
| import GameCard from "./GameCard"; | ||
| import type { Game } from "@/lib/types"; |
Comment on lines
+8
to
+26
| function highlightMatch(text: string, query: string) { | ||
| if (!query.trim()) return <span>{text}</span>; | ||
| const escaped = query.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); | ||
| const regex = new RegExp(`(${escaped})`, "gi"); | ||
| const parts = text.split(regex); | ||
| return ( | ||
| <> | ||
| {parts.map((part, i) => | ||
| regex.test(part) ? ( | ||
| <mark key={i} className="bg-transparent text-accent font-bold not-italic"> | ||
| {part} | ||
| </mark> | ||
| ) : ( | ||
| <span key={i}>{part}</span> | ||
| ) | ||
| )} | ||
| </> | ||
| ); | ||
| } |
Comment on lines
+14
to
+27
| function highlightMatch(text: string, query: string) { | ||
| if (!query.trim()) return text; | ||
| const regex = new RegExp(`(${query.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")})`, "gi"); | ||
| const parts = text.split(regex); | ||
| return parts.map((part, i) => | ||
| regex.test(part) ? ( | ||
| <mark key={i} className="bg-transparent text-accent font-bold not-italic"> | ||
| {part} | ||
| </mark> | ||
| ) : ( | ||
| <span key={i}>{part}</span> | ||
| ) | ||
| ); | ||
| } |
Comment on lines
+29
to
+33
| export default function SearchBar({ value, onChange, onSubmit, placeholder = "Search games, genres, publishers…" }: SearchBarProps) { | ||
| const [suggestions, setSuggestions] = useState<SuggestionItem[]>([]); | ||
| const [showSuggestions, setShowSuggestions] = useState(false); | ||
| const [loading, setLoading] = useState(false); | ||
| const [activeIndex, setActiveIndex] = useState(-1); |
Comment on lines
+33
to
+37
| if (filters.releaseYearMin || filters.releaseYearMax) { | ||
| const from = filters.releaseYearMin || "1980"; | ||
| const to = filters.releaseYearMax || "2025"; | ||
| params.set("dates", `${from}-01-01,${to}-12-31`); | ||
| } |
Comment on lines
+66
to
+80
| return { | ||
| filters: { | ||
| search: searchParams.get("search") || "", | ||
| genres: searchParams.get("genres")?.split(",").filter(Boolean) || [], | ||
| platforms: searchParams.get("platforms")?.split(",").filter(Boolean) || [], | ||
| tags: searchParams.get("tags")?.split(",").filter(Boolean) || [], | ||
| publishers: searchParams.get("publishers")?.split(",").filter(Boolean) || [], | ||
| releaseYearMin, | ||
| releaseYearMax, | ||
| metacriticMin, | ||
| metacriticMax, | ||
| ordering: (searchParams.get("ordering") as SortOption) || "-metacritic", | ||
| }, | ||
| page: Number(searchParams.get("page")) || 1, | ||
| }; |
| { value: "-added", label: "Recently Added" }, | ||
| ]; | ||
|
|
||
| const RELEASE_YEARS = Array.from({ length: 2026 - 1980 }, (_, i) => 2025 - i); |
Comment on lines
+111
to
+134
| function CheckboxRow({ label, checked, onChange }: { label: string; checked: boolean; onChange: () => void }) { | ||
| return ( | ||
| <label className="flex items-center gap-2.5 px-4 py-2 cursor-pointer hover:bg-white/5 transition-colors group"> | ||
| <div | ||
| className={`w-4 h-4 rounded border flex items-center justify-center shrink-0 transition-all duration-150 ${ | ||
| checked ? "bg-accent border-accent" : "border-white/20 group-hover:border-white/40" | ||
| }`} | ||
| onClick={onChange} | ||
| > | ||
| {checked && ( | ||
| <svg className="w-2.5 h-2.5 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={3.5}> | ||
| <path strokeLinecap="round" strokeLinejoin="round" d="M5 13l4 4L19 7" /> | ||
| </svg> | ||
| )} | ||
| </div> | ||
| <span | ||
| className={`text-sm transition-colors ${checked ? "text-white font-medium" : "text-zinc-300 group-hover:text-white"}`} | ||
| onClick={onChange} | ||
| > | ||
| {label} | ||
| </span> | ||
| </label> | ||
| ); | ||
| } |
Comment on lines
+29
to
+34
| for (const key of forwardable) { | ||
| const val = incoming.get(key); | ||
| if (val && val.trim() !== "") { | ||
| params.set(key, val); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.