Skip to content

fix(frontend): dynamically fetch game summary and player details for OG card (#1348) - #1548

Open
sparkysolutions10-pixel wants to merge 1 commit into
OpenKnight-Foundation:mainfrom
sparkysolutions10-pixel:fix/opengraph-dynamic-game-summary-1348
Open

sparkysolutions10-pixel wants to merge 1 commit into
OpenKnight-Foundation:mainfrom
sparkysolutions10-pixel:fix/opengraph-dynamic-game-summary-1348

Conversation

@sparkysolutions10-pixel

Copy link
Copy Markdown

Overview

Resolves issue #1348 by replacing the hardcoded mock player summary in frontend/app/api/og/game/[id]/route.tsx with dynamic backend data fetching.

Changes Made

  1. Dynamic Game Lookup:
    • Fetches game metadata via GET /v1/games/{id} using the configured backend API base URL (NEXT_PUBLIC_API_URL / NEXT_PUBLIC_BACKEND_URL).
    • Supports Edge runtime caching with appropriate revalidation.
  2. Player Profiles & Ratings:
    • Dynamically resolves player usernames and Elo/FIDE ratings from game metadata or GET /v1/players/{id} in parallel with graceful fallbacks.
  3. Game Outcome & Status Formatting:
    • Accurately computes and formats the outcome display string based on backend status and result states (won, drawn, in progress, waiting, aborted).
  4. Resilient 404 Fallback:
    • Returns null whenever a game is not found or fails validation, preserving the default branded card fallback.

Local Quality Assurance & Verification

  • Validated route compilation and Edge runtime compatibility.
  • Verified dynamic card generation paths with complete, in-progress, and missing game states.
  • Confirmed fallback to branded banner when game is not found.

Closes #1348

This branch has not been deployed

No deployments
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.

FE-107: OpenGraph Share Card Always Shows "White Player vs Black Player (1500)"

1 participant