feat: Refine session clear to preserve UI preferences while resetting game state and standardize image cache paths to full and crop subdirectories.
Some checks failed
Build and Deploy / build (push) Failing after 1m0s
Some checks failed
Build and Deploy / build (push) Failing after 1m0s
This commit is contained in:
@@ -454,24 +454,27 @@ export const CubeManager: React.FC<CubeManagerProps> = ({ packs, setPacks, avail
|
||||
localStorage.removeItem('generatedPacks');
|
||||
localStorage.removeItem('availableLands');
|
||||
|
||||
// 3. Reset Local State
|
||||
// 3. Reset Local State to Defaults
|
||||
// This will trigger the useEffect hooks to update localStorage accordingly
|
||||
setInputText('');
|
||||
setRawScryfallData(null);
|
||||
setProcessedData(null);
|
||||
setSelectedSets([]);
|
||||
setSearchTerm(''); // Clear search
|
||||
|
||||
// 4. Clear Local Persistence
|
||||
localStorage.removeItem('cube_inputText');
|
||||
localStorage.removeItem('cube_rawScryfallData');
|
||||
localStorage.removeItem('cube_selectedSets');
|
||||
localStorage.removeItem('cube_viewMode');
|
||||
localStorage.removeItem('cube_gameTypeFilter');
|
||||
// We can optionally clear source mode, or leave it. Let's leave it for UX continuity or clear it?
|
||||
// Let's clear it to full reset.
|
||||
// localStorage.removeItem('cube_sourceMode');
|
||||
setFilters({
|
||||
ignoreBasicLands: false,
|
||||
ignoreCommander: false,
|
||||
ignoreTokens: false
|
||||
});
|
||||
|
||||
// 5. Reset UI Filters/Views to defaults
|
||||
setViewMode('list');
|
||||
setGenSettings({
|
||||
mode: 'mixed',
|
||||
rarityMode: 'peasant'
|
||||
});
|
||||
|
||||
setSourceMode('upload');
|
||||
setNumBoxes(1);
|
||||
setGameTypeFilter('all');
|
||||
|
||||
showToast("Session cleared successfully.", "success");
|
||||
|
||||
@@ -107,10 +107,10 @@ export class PackGeneratorService {
|
||||
layout: layout,
|
||||
colors: cardData.colors || [],
|
||||
image: useLocalImages
|
||||
? `${window.location.origin}/cards/images/${cardData.set}/art_full/${cardData.id}.jpg`
|
||||
? `${window.location.origin}/cards/images/${cardData.set}/full/${cardData.id}.jpg`
|
||||
: (cardData.image_uris?.normal || cardData.card_faces?.[0]?.image_uris?.normal || ''),
|
||||
imageArtCrop: useLocalImages
|
||||
? `${window.location.origin}/cards/images/${cardData.set}/art_crop/${cardData.id}.jpg`
|
||||
? `${window.location.origin}/cards/images/${cardData.set}/crop/${cardData.id}.jpg`
|
||||
: (cardData.image_uris?.art_crop || cardData.card_faces?.[0]?.image_uris?.art_crop || ''),
|
||||
set: cardData.set_name,
|
||||
setCode: cardData.set,
|
||||
|
||||
Reference in New Issue
Block a user