-
Notifications
You must be signed in to change notification settings - Fork 21
Remove references to missing CDN assets: Slider.woff2 and xxchahero-te.webp #113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { Stack, Image, Divider } from "@mantine/core"; | ||
| import { leaders } from "@/entities/data/leaders"; | ||
| import { leaders, getLeaderImageId } from "@/entities/data/leaders"; | ||
| import { DetailsCard } from "@/shared/ui/DetailsCard"; | ||
| import { showLeader } from "./Leader/showLeader"; | ||
| import { useIsTwilightsFallMode } from "@/hooks/useIsTwilightsFallMode"; | ||
|
|
@@ -27,7 +27,7 @@ export function LeaderDetailsCard({ leaderId }: Props) { | |
| const renderLeaderIcon = () => { | ||
| if (showLeader(leaderData.source)) { | ||
| return ( | ||
| <Image src={`/leaders/${leaderId}.webp`} w={60} h={80} radius="50%" /> | ||
| <Image src={`/leaders/${getLeaderImageId(leaderId)}.webp`} w={60} h={80} radius="50%" /> | ||
| ); | ||
|
Comment on lines
29
to
31
|
||
| } | ||
| return <></>; | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -181,6 +181,7 @@ export const leaders: LeaderData[] = [ | |||||||||||||||||||||||||
| "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", | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
|
Comment on lines
181
to
186
|
||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
|
|
@@ -5243,3 +5244,8 @@ export const leaders: LeaderData[] = [ | |||||||||||||||||||||||||
| source: "twilights_fall", | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| export function getLeaderImageId(id: string): string { | ||||||||||||||||||||||||||
| const leader = leaders.find((l) => l.id === id); | ||||||||||||||||||||||||||
|
Comment on lines
+5248
to
+5249
|
||||||||||||||||||||||||||
| 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]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LeaderChipalready callsgetLeaderData(id)which doesleaders.find(...). UsinggetLeaderImageId(id)in the image src adds a second linear search over the same array during render. Prefer usingleaderData.imageID ?? id(or havegetLeaderDatareturn the resolved image id) to avoid the extra lookup.