feat: improve card image URL resolution by prioritizing image_uris.normal and falling back to constructed paths.

This commit is contained in:
2025-12-19 03:05:19 +01:00
parent c9266b9604
commit 1853fd9e28
4 changed files with 6 additions and 13 deletions

View File

@@ -82,7 +82,7 @@ define(['./workbox-5a5d9309'], (function (workbox) { 'use strict';
"revision": "3ca0b8505b4bec776b69afdba2768812"
}, {
"url": "index.html",
"revision": "0.l4u3i9b5p1c"
"revision": "0.m2b6ukjs8r"
}], {});
workbox.cleanupOutdatedCaches();
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {

View File

@@ -438,15 +438,6 @@ export const DeckBuilderView: React.FC<DeckBuilderViewProps> = ({ initialPool, a
}
};
if (targetId && setCode) {
return {
...cardWithDefinition,
image_uris: {
normal: `/cards/images/${setCode}/full/${targetId}.jpg`,
crop: `/cards/images/${setCode}/crop/${targetId}.jpg`
}
};
}
return cardWithDefinition;
});

View File

@@ -29,8 +29,6 @@ export const CardComponent: React.FC<CardComponentProps> = ({ card, onDragStart,
return () => unregisterCard(card.instanceId);
}, [card.instanceId]);
// Robustly resolve Art Crop
// Robustly resolve Art Crop
// Robustly resolve Art Crop
let imageSrc = card.imageUrl;

View File

@@ -947,7 +947,11 @@ export const GameView: React.FC<GameViewProps> = ({ gameState, currentPlayerId }
{activeDragId ? (
<div className="w-32 h-48 pointer-events-none opacity-80 z-[1000]">
<img
src={gameState.cards[activeDragId]?.imageUrl}
src={(() => {
const c = gameState.cards[activeDragId];
return c?.image_uris?.normal ||
(c?.definition?.set && c?.definition?.id ? `/cards/images/${c.definition.set}/full/${c.definition.id}.jpg` : c?.imageUrl);
})()}
alt="Drag Preview"
className="w-full h-full object-cover rounded-xl shadow-2xl"
/>