feat: Implement game restart, battlefield styling with art crops and tapped stacks, and initial draw fixes.
Some checks failed
Build and Deploy / build (push) Failing after 1m10s

This commit is contained in:
2025-12-18 20:26:42 +01:00
parent ca7b5bf7fa
commit bc5eda5e2a
35 changed files with 1337 additions and 634 deletions

View File

@@ -0,0 +1,23 @@
---
title: Cache Art Crops
status: Completed
---
## Objectives
- Ensure "Art Crop" images are cached locally alongside "Normal" images to support offline mode and reduce external API calls.
- Update `CardService` (Server) to download and save `.crop.jpg` files.
- Update `PackGeneratorService` (Client) to use local `.crop.jpg` URLs when `useLocalImages` is enabled.
## Implementation Details
1. **Server (`CardService.ts`)**:
- Modified `cacheImages` loop to detect if `image_uris.art_crop` (or face equivalent) exists.
- Implemented concurrent downloading of both the normal image and the art crop.
- Saves art crops with the pattern: `public/cards/images/[setCode]/[uuid].crop.jpg`.
2. **Client (`PackGeneratorService.ts`)**:
- Updated `processCards` to check the `useLocalImages` flag.
- If true, constructs the `imageArtCrop` URL using the local server path: `${origin}/cards/images/${set}/${id}.crop.jpg`.
## Impact
- When users import a cube or set collection, both image versions will now be stored.
- The Battlefield view (which uses `art_crop`) will now load instantly from the local server cache instead of Scryfall.