Remove references to missing CDN assets: Slider.woff2 and xxchahero-te.webp#113
Remove references to missing CDN assets: Slider.woff2 and xxchahero-te.webp#113
Conversation
…e.webp Co-authored-by: adam133 <20442729+adam133@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Removes broken CDN asset references by dropping a missing Slider.woff2 font source and introducing a leader-image redirect mechanism so xxchahero-te reuses the existing xxchahero image.
Changes:
- Remove
Slider.woff2from the@font-facesrc list, leaving thewofffallback. - Add optional
imageID?: stringtoLeaderData, setimageID: "xxchahero"forxxchahero-te, and add agetLeaderImageId()helper. - Update leader UI components to use
getLeaderImageId(id)when constructing/leaders/*.webpURLs.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Large lockfile churn (platform-specific binaries / reordering) included alongside the asset-reference fix. |
| src/styles/fonts.css | Removes reference to missing /font/Slider.woff2. |
| src/entities/data/types.ts | Extends LeaderData with optional imageID redirect field. |
| src/entities/data/leaders.ts | Adds imageID for xxchahero-te and exports getLeaderImageId(). |
| src/domains/player/components/LeaderDetailsCard.tsx | Uses getLeaderImageId() for leader image URL. |
| src/domains/player/components/Leader/LeaderChip.tsx | Uses getLeaderImageId() for leader image URL. |
| src/domains/player/components/Leader/CompactLeader.tsx | Uses getLeaderImageId() for leader image URL. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <div className={styles.leaderImageContainer}> | ||
| <Image src={`/leaders/${id}.webp`} className={styles.leaderImage} /> | ||
| <Image src={`/leaders/${getLeaderImageId(id)}.webp`} className={styles.leaderImage} /> | ||
| </div> |
There was a problem hiding this comment.
LeaderChip already calls getLeaderData(id) which does leaders.find(...). Using getLeaderImageId(id) in the image src adds a second linear search over the same array during render. Prefer using leaderData.imageID ?? id (or have getLeaderData return the resolved image id) to avoid the extra lookup.
| "Place any combination of up to 4 PDS or mechs onto planets you control; ready each planet that you place a unit on. Then, purge this card.", | ||
| unlockCondition: "Have 3 scored objectives.", | ||
| homebrewReplacesID: "xxchahero", | ||
| imageID: "xxchahero", | ||
| source: "thunders_edge", | ||
| }, |
There was a problem hiding this comment.
This file is marked as auto-generated ("Do not edit manually"). Adding imageID directly in the generated leaders array will likely be overwritten the next time the data is regenerated. Prefer updating the upstream JSON/generator that produces leaders.ts, or move overrides into a separate non-generated layer (e.g., a small map of image redirects keyed by leader id).
| export function getLeaderImageId(id: string): string { | ||
| const leader = leaders.find((l) => l.id === id); |
There was a problem hiding this comment.
getLeaderImageId does a linear leaders.find(...) over a ~5k-entry array on every call. Since this will be invoked during rendering (and some callers already do their own leaders.find), consider switching to an O(1) lookup (e.g., build/export a leadersById map once) or accept a LeaderData object so callers can use leaderData.imageID ?? leaderData.id without an extra search.
| export function getLeaderImageId(id: string): string { | |
| const leader = leaders.find((l) => l.id === id); | |
| const leadersById: Record<string, LeaderData> = leaders.reduce( | |
| (acc, leader) => { | |
| acc[leader.id] = leader; | |
| return acc; | |
| }, | |
| {} as Record<string, LeaderData>, | |
| ); | |
| export function getLeaderImageId(id: string): string { | |
| const leader = leadersById[id]; |
| return ( | ||
| <Image src={`/leaders/${leaderId}.webp`} w={60} h={80} radius="50%" /> | ||
| <Image src={`/leaders/${getLeaderImageId(leaderId)}.webp`} w={60} h={80} radius="50%" /> | ||
| ); |
There was a problem hiding this comment.
LeaderDetailsCard already looks up leaderData via leaders.find(...), but the image src now calls getLeaderImageId(leaderId) which performs another leaders.find(...). To avoid duplicate work per render, use leaderData.imageID ?? leaderId (or pass leaderData into a helper) when constructing the image URL.
Two assets are referenced in the codebase but absent from the CDN:
/font/Slider.woff2and/leaders/xxchahero-te.webp.Font
src/styles/fonts.css: Drop thewoff2src line from the Slider@font-facerule; keep thewofffallback.Leader image
xxchahero-te(Thunder's Edge variant ofxxchahero) shares the same art but has no dedicated image on the CDN.LeaderDatatype: Add optionalimageID?: stringto allow a leader to redirect its image to a different ID.leaders.ts: SetimageID: "xxchahero"on thexxchahero-teentry. AddgetLeaderImageId(id)utility that returnsleader.imageID ?? id.CompactLeader,LeaderChip,LeaderDetailsCard: UsegetLeaderImageId(id)when constructing the/leaders/*.webpURL.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.