Fix missing file errors and clean up theme system
- Remove reference to non-existent image-discovery-fix.js file - Add error handling for missing theme CSS files - Update discoverImages method to work without external fix file - Remove unsupported theme options from dropdown - Prevents ERR_FILE_NOT_FOUND errors in console
This commit is contained in:
parent
8bf1f6fe4b
commit
a9a1c9e4a1
|
|
@ -231,9 +231,6 @@
|
|||
<label for="theme-dropdown" class="option-label">Choose Your Vibe:</label>
|
||||
<select id="theme-dropdown" class="theme-dropdown">
|
||||
<option value="balanced-purple" selected>💜 Balanced Purple (Default)</option>
|
||||
<option value="balanced-red">❤️ Balanced Red</option>
|
||||
<option value="balanced-blue">💙 Balanced Blue</option>
|
||||
<option value="balanced-green">💚 Balanced Forest Green</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
|
@ -1939,7 +1936,6 @@
|
|||
<script src="src/features/images/popupImageManager.js"></script>
|
||||
<script src="src/features/tasks/aiTaskManager.js"></script>
|
||||
<script src="src/features/audio/audioManager.js"></script>
|
||||
<script src="src/features/images/image-discovery-fix.js"></script>
|
||||
<script src="src/core/gameModeManager.js"></script>
|
||||
<script src="src/features/webcam/webcamManager.js"></script>
|
||||
<script src="src/features/tts/voiceManager.js"></script>
|
||||
|
|
|
|||
|
|
@ -1577,11 +1577,26 @@ class TaskChallengeGame {
|
|||
}
|
||||
|
||||
async discoverImages() {
|
||||
console.log('🚀 Original discoverImages method - will be overridden by fix');
|
||||
// This method will be replaced by the image-discovery-fix.js
|
||||
gameData.discoveredTaskImages = [];
|
||||
gameData.discoveredConsequenceImages = [];
|
||||
this.imageDiscoveryComplete = true;
|
||||
console.log('<27> Discovering images from directories...');
|
||||
|
||||
try {
|
||||
gameData.discoveredTaskImages = [];
|
||||
gameData.discoveredConsequenceImages = [];
|
||||
|
||||
// Use fileManager to discover images
|
||||
if (this.fileManager && this.fileManager.isElectron) {
|
||||
// Discovery is handled by the main initialization process
|
||||
console.log('📸 Image discovery delegated to file manager');
|
||||
} else {
|
||||
console.log('⚠️ File manager not available for image discovery');
|
||||
}
|
||||
|
||||
this.imageDiscoveryComplete = true;
|
||||
console.log('✅ Image discovery completed');
|
||||
} catch (error) {
|
||||
console.error('❌ Error during image discovery:', error);
|
||||
this.imageDiscoveryComplete = true; // Mark as complete even on error
|
||||
}
|
||||
}
|
||||
|
||||
getEmbeddedManifest() {
|
||||
|
|
@ -2945,6 +2960,15 @@ class TaskChallengeGame {
|
|||
themeLink.id = 'dynamic-theme';
|
||||
themeLink.rel = 'stylesheet';
|
||||
themeLink.href = `${themeName}-theme.css`;
|
||||
|
||||
// Handle missing theme files gracefully
|
||||
themeLink.onerror = () => {
|
||||
console.warn(`Theme file ${themeName}-theme.css not found, falling back to default theme`);
|
||||
themeLink.remove();
|
||||
// Fall back to default theme
|
||||
localStorage.setItem('gameTheme', 'balanced-purple');
|
||||
};
|
||||
|
||||
document.head.appendChild(themeLink);
|
||||
}
|
||||
// balanced-purple is our default theme loaded in the HTML, so no need to load additional CSS
|
||||
|
|
|
|||
Loading…
Reference in New Issue