feat: Implement resume match button, enhance card image loading, and improve server-side logging and deck handling.

This commit is contained in:
2025-12-22 22:15:32 +01:00
parent 325f82ff6b
commit c88c8ced15
6 changed files with 50 additions and 10 deletions

View File

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

View File

@@ -61,10 +61,14 @@ export const CardVisual: React.FC<CardVisualProps> = ({
// Robustly resolve Image Source based on viewMode
let src = card.imageUrl || card.image;
// Use top-level properties if available (common in DraftCard / Game Card objects)
const setCode = card.setCode || card.set || card.definition?.set;
const cardId = card.scryfallId || card.definition?.id;
if (viewMode === 'cutout') {
// Priority 1: Local Cache (standard naming convention) - PREFERRED BY USER
if (card.definition?.set && card.definition?.id) {
src = `/cards/images/${card.definition.set}/crop/${card.definition.id}.jpg`;
if (setCode && cardId) {
src = `/cards/images/${setCode}/crop/${cardId}.jpg`;
}
// Priority 2: Direct Image URIs (if available) - Fallback
else if (card.image_uris?.art_crop || card.image_uris?.crop) {
@@ -77,15 +81,19 @@ export const CardVisual: React.FC<CardVisualProps> = ({
else if (card.definition?.card_faces?.[0]?.image_uris?.art_crop) {
src = card.definition.card_faces[0].image_uris.art_crop;
}
// Priority 4: If card has a manually set image property that looks like a crop (less reliable)
// Priority 4: Server-provided explicit property
else if (card.imageArtCrop) {
src = card.imageArtCrop;
}
// Fallback: If no crop found, src remains whatever it was (likely full)
} else {
// Normal / Full View
// Priority 1: Local Cache (standard naming convention) - PREFERRED
if (card.definition?.set && card.definition?.id) {
if (setCode && cardId) {
// Check if we want standard full image path
src = `/cards/images/${card.definition.set}/full/${card.definition.id}.jpg`;
src = `/cards/images/${setCode}/full/${cardId}.jpg`;
}
// Priority 2: Direct Image URIs
else if (card.image_uris?.normal) {

View File

@@ -107,6 +107,16 @@ export const TournamentManager: React.FC<TournamentManagerProps> = ({ tournament
<Play className="w-4 h-4" /> Play Match
</button>
)}
{/* Resume Button */}
{match.status === 'in_progress' && isMyMatch && (
<button
onClick={() => handleJoinMatch(match.id)}
className="w-full bg-emerald-600 hover:bg-emerald-500 text-white font-bold py-2 flex items-center justify-center gap-2 transition-colors animate-pulse"
>
<Play className="w-4 h-4" /> Resume Match
</button>
)}
</div>
);
})}