Redesign homepage leaderboard cards and add pantheon community race - #328
Conversation
Group raid and pantheon links into clearer per-activity cards with manifest-driven titles, release dates, and responsive layout. Adds the pantheon community race leaderboard page and home link ahead of API PR #137. Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| title={version.name} | ||
| subtitle="Community Race Leaderboard"> | ||
| <CloudflareActivitySplash | ||
| activityId={version.associatedActivityId!} |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
| <CloudflareActivitySplash | ||
| activityId={version.associatedActivityId!} | ||
| versionId={version.id} | ||
| fill | ||
| className="z-[-1]" | ||
| /> |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
| ((v.id == 1 ? raidId >= 15 : !isReprised) || | ||
| (isReprised && !v.isChallengeMode)) | ||
| ) | ||
| const PANTHEON_COMMUNITY_RACE_VERSION_PATH = "insurrection-revolutionary" |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
…n-pantheon-community-race
Use version splash URLs when versionId is provided, guard null associatedActivityId, and identify the community race by version id instead of path. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
| variants[variants.length - 1] | ||
| ).name | ||
| const content = activityVariants.find(c => c.size === size)! | ||
| const content = splashVariants.find(c => c.size === size)! |
There was a problem hiding this comment.
Bug: The image loader may crash with a TypeError if the API returns only image sizes, like "full", that are not in the hardcoded cloudflareVariants list.
Severity: HIGH
Suggested Fix
Add a guard to handle the case where the filtered variants array is empty. Before accessing variants[variants.length - 1], check if the array has elements. If it is empty, provide a safe fallback variant or default size to prevent the TypeError.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: src/components/CloudflareImage.tsx#L154-L156
Potential issue: The loader function in `CloudflareImage.tsx` filters a hardcoded list
of variants (`cloudflareVariants`) against sizes returned by the API. The API can return
a size of `"full"`, which is not present in the hardcoded list. If the API returns only
the `"full"` size, the filtered `variants` array will be empty. The subsequent code
attempts to access an element from this empty array (`variants[variants.length - 1]`),
which evaluates to `undefined`. Accessing the `.name` property on this `undefined` value
will cause a `TypeError`, crashing the component.
| const versionGroups = useMemo( | ||
| () => | ||
| versions | ||
| .toSorted((a, b) => b - a) |
There was a problem hiding this comment.
Bug: The code re-sorts Pantheon versions by numeric ID, ignoring the intentional "display order" provided by the API, which will cause them to appear in the wrong order.
Severity: MEDIUM
Suggested Fix
Remove the .toSorted((a, b) => b - a) call. The versions array is already in the correct display order as provided by the API, so no client-side sorting is necessary.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: src/components/home/HomeBuckets.tsx#L232
Potential issue: The backend API provides a list of Pantheon version IDs
(`pantheonVersionIds`) in a specific, intentional "display order". However, the frontend
code in `HomeBuckets.tsx` explicitly re-sorts this list by numeric ID in descending
order using `.toSorted((a, b) => b - a)`. This overrides the API's intended ordering. As
a result, if a version intended to be first (like the community race version 134) has a
lower ID than other active versions, it will be displayed in the wrong position on the
homepage's Pantheon card.
| export const fetchCache = "default-no-store" | ||
|
|
||
| export async function generateMetadata(): Promise<Metadata> { | ||
| const manifest = await prefetchManifest() | ||
| const activityId = getActivePantheonIds(manifest)[0] | ||
| const activity = activityId != null ? manifest.activityDefinitions[activityId] : undefined | ||
| const version = manifest.versionDefinitions[PANTHEON_COMMUNITY_RACE_VERSION_ID] | ||
|
|
||
| if (!activity || version?.associatedActivityId == null) { | ||
| notFound() | ||
| } |
There was a problem hiding this comment.
Bug: Calling notFound() in generateMetadata for a statically generated page (force-static) will cause the entire application build to fail if the necessary data is missing.
Severity: CRITICAL
Suggested Fix
In generateMetadata, instead of calling notFound(), return fallback metadata (e.g., a generic title). Move the logic for checking data availability and calling notFound() into the Page component itself. This ensures the page can still be statically generated, and the 404 is handled at request time.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: src/app/leaderboards/team/custom/pantheon-community-race/page.tsx#L11-L23
Potential issue: The Pantheon community race page is configured for static generation
via `export const dynamic = "force-static"`. Its `generateMetadata` function calls
`notFound()` if the required manifest data is unavailable at build time. In Next.js,
calling `notFound()` within `generateMetadata` for a statically generated page is not
supported and will cause the entire application build to fail. This could happen if the
API manifest is incomplete or unavailable during deployment, thus preventing new
versions of the site from being deployed.
Summary
lg, with 3/4/5 column breakpoints on smaller viewports/leaderboard/team/custom/pantheon-community-raceobject-coveronfillto prevent stretched leaderboard headersTest plan
/leaderboards/team/custom/pantheon-community-raceand confirm leaderboard loads (requires Raid-Hub/API#137 deployed)Made with Cursor