Clean up image management interface

Automatic scanning and button cleanup:
- Added automatic directory scanning on desktop app startup
- Removed manual 'Scan Image Directories' button - no longer needed
- Removed 'Clear Image Cache' button - functionality not useful in desktop mode
- Updated scan info text to reflect automatic scanning behavior
- Cleaned up setupImageManagementEventListeners by removing unused button handlers

Benefits:
- Cleaner, more streamlined interface
- Images automatically available without manual intervention
- Reduced cognitive load - fewer buttons to understand
- More professional desktop application experience
This commit is contained in:
fritzsenpai 2025-09-25 20:24:57 -05:00
parent ba4e532322
commit 18d0f8bba2
2 changed files with 9 additions and 26 deletions

31
game.js
View File

@ -43,6 +43,14 @@ class TaskChallengeGame {
if (typeof DesktopFileManager !== 'undefined') {
this.fileManager = new DesktopFileManager(this.dataManager);
window.desktopFileManager = this.fileManager;
// Auto-scan directories on startup
setTimeout(async () => {
if (this.fileManager && this.fileManager.isElectron) {
console.log('🔍 Auto-scanning directories on startup...');
await this.fileManager.scanAllDirectories();
}
}, 1000); // Wait 1 second for initialization to complete
}
// Check if we're in Electron and update UI accordingly
@ -919,8 +927,6 @@ class TaskChallengeGame {
const backBtn = document.getElementById('back-to-start-from-images-btn');
const uploadBtn = document.getElementById('upload-images-btn');
const uploadInput = document.getElementById('image-upload-input');
const scanBtn = document.getElementById('scan-directories-btn');
const clearCacheBtn = document.getElementById('clear-image-cache-btn');
const storageInfoBtn = document.getElementById('storage-info-btn');
const selectAllBtn = document.getElementById('select-all-images-btn');
const deselectAllBtn = document.getElementById('deselect-all-images-btn');
@ -986,27 +992,6 @@ class TaskChallengeGame {
uploadBtn.parentNode.replaceChild(newUploadBtn, uploadBtn);
newUploadBtn.addEventListener('click', () => this.uploadImages());
}
if (scanBtn) {
const newScanBtn = scanBtn.cloneNode(true);
scanBtn.parentNode.replaceChild(newScanBtn, scanBtn);
newScanBtn.addEventListener('click', async () => {
if (this.fileManager) {
// Use desktop file manager scanning
await this.fileManager.scanAllDirectories();
this.loadImageGallery(); // Refresh the gallery to show scanned images
} else {
// Fallback to web scanning
this.scanForNewImages();
}
});
}
if (clearCacheBtn) {
const newClearCacheBtn = clearCacheBtn.cloneNode(true);
clearCacheBtn.parentNode.replaceChild(newClearCacheBtn, clearCacheBtn);
newClearCacheBtn.addEventListener('click', () => this.clearImageCache());
}
if (storageInfoBtn) {
const newStorageInfoBtn = storageInfoBtn.cloneNode(true);

View File

@ -148,11 +148,9 @@
<span class="upload-info web-feature" style="display: none;">Web: Limited browser upload</span>
</div>
<div class="directory-controls">
<button id="scan-directories-btn" class="btn btn-secondary">🔍 Scan Image Directories</button>
<button id="open-image-folders-btn" class="btn btn-outline desktop-only">📂 Open Image Folders</button>
<button id="clear-image-cache-btn" class="btn btn-outline">🗑️ Clear Image Cache</button>
<button id="storage-info-btn" class="btn btn-outline">📊 Storage Info</button>
<span class="scan-info">Automatically finds images in your game directories</span>
<span class="scan-info">Images automatically scanned on startup</span>
</div>
</div>