Skip to content

Add category-based related games to game detail pages - #16

Draft
Samrudh9 with Copilot wants to merge 2 commits into
mainfrom
copilot/show-related-games-on-details-page
Draft

Samrudh9 with Copilot wants to merge 2 commits into
mainfrom
copilot/show-related-games-on-details-page

Conversation

Copilot AI commented Sep 24, 2026 •

Copy link
Copy Markdown

Game detail pages now surface discoverability by showing other games from the same category, while handling categories with no peers cleanly. This adds a dedicated data-access path and wires it into the detail page UI.

  • Data access: related game query

    • Added getRelatedGames(db, id) in src/lib/games.ts.
    • Looks up the source game category, returns games in that category ordered by title, and excludes the source game.
    • Returns [] when the game is missing or has no category.
  • Game detail page UX

    • Updated src/pages/game/[id].astro to fetch related games alongside the primary game.
    • Added a Related games section with:
      • linked related titles when available
      • explicit empty state when none exist
  • Unit coverage

    • Extended src/lib/games.test.ts with focused tests for:
      • same-category filtering + self-exclusion
      • empty result when no related games exist
export async function getRelatedGames(db: Database, id: number): Promise<Game[]> {
  const gameRow = await db
    .select({ categoryId: games.categoryId })
    .from(games)
    .where(eq(games.id, id))
    .get();

  if (!gameRow || gameRow.categoryId === null) return [];

  const rows = await baseGamesQuery(db)
    .where(and(eq(games.categoryId, gameRow.categoryId), ne(games.id, id)))
    .orderBy(asc(games.title));

  return rows.map(mapGame);
}

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 01bf9ef3-1958-4340-8015-bf27646bbe94

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

Copilot AI linked an issue Sep 24, 2026 that may be closed by this pull request
Co-authored-by: Samrudh9 <84171396+Samrudh9@users.noreply.github.com>
Copilot AI changed the title [WIP] Add related games section on game details page Add category-based related games to game detail pages Sep 24, 2026
Copilot AI requested a review from Samrudh9 September 24, 2026 10:36
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.

Show related games on the game details page

2 participants