Commit Graph

242 Commits

Author SHA1 Message Date
dilgenfritz 727a0c0800 Fix AI Connection Status UI Update
Status Update Fixes:
 Enhanced updateConnectionStatus with loading state and error handling
 Added proper fallback values for connection status display
 Fixed model status to use actual current model from aiTaskManager
 Added async error handling for connection status updates

 UI Issue Resolved:
 Connection status should now update properly when AI tab loads
 Added 'Checking...' state during connection test
 Better error handling for missing UI elements or failed connections
 Status will show 'Connected' when Ollama is working properly

 Expected Result:
 AI Tasks tab should now show correct connection status
 Model status should display the actual selected model
 No more stuck 'checking' state in the UI
2025-09-29 07:22:38 -05:00
dilgenfritz a80224aebd Fix Content Security Policy for Ollama Connection
CSP Fix Applied:
 Added connect-src 'self' http://localhost:* ws://localhost:* to CSP
 Updated default-src to include http://localhost:*
 This allows fetch requests to Ollama API on localhost:11434

 Error Resolved:
 'Refused to connect' CSP violation error fixed
 AI connection should now work properly
 Fetch requests to localhost now permitted

 Status:
 CSP now allows AI connections while maintaining security
 Local AI integration should be fully functional
2025-09-29 07:19:54 -05:00
dilgenfritz 5e28163f7e Enhanced Ollama Connection Debugging
Debugging Improvements:
 Added detailed console logging for connection attempts
 Enhanced error reporting with error names and messages
 Added CORS headers to fetch requests
 Improved model loading with step-by-step logging
 Added basic fetch capability test in init()

 Electron Security Fix:
 Added webSecurity: false to allow localhost HTTP requests
 This should resolve any CORS/security blocking issues

 Investigation:
 Added comprehensive logging to identify connection failures
 Better error handling throughout the connection process
 Will help diagnose if issue is network, CORS, or API related
2025-09-29 07:18:06 -05:00
dilgenfritz c076a91b85 Fix UI Element Reference Error
Bug Fixed:
 Updated task preview element ID from 'task-preview' to 'test-task-output'
 Added null check to prevent TypeError when element not found
 Enhanced error handling with user feedback
 Fixed task.instruction property reference for generated tasks

 Error Resolved:
 TypeError: Cannot set properties of null (setting 'className')
 Generate Test Task button should now work properly
 Better error messages for debugging

 Status:
 AI task generation UI should now function correctly
 Test task output will display properly in the AI Tasks tab
2025-09-29 07:15:30 -05:00
dilgenfritz 6cff04df11 Fix AI Connection Issues
Fixes Applied:
 Updated preferred model to use installed wizardlm-uncensored:13b
 Fixed AbortSignal.timeout compatibility issues
 Added fallback model selection for any available models
 Enhanced connection testing with better error logging
 Added updateSettings/getSettings alias methods for UI compatibility
 Improved timeout handling with manual AbortController

 AI Status:
 Ollama detected running on localhost:11434
 wizardlm-uncensored:13b model confirmed available
 Connection test should now work properly
 AI task generation ready for testing

 Bug Resolved:
 Fixed infinite 'checking connection' state
 Improved browser compatibility
 Better error handling and debugging
2025-09-29 07:13:20 -05:00
dilgenfritz e7bfabac9b Complete AI Integration with Ollama
Features Added:
 Full AITaskManager class with NSFW task generation
 Complete AI Tasks tab with configuration interface
 Connection testing and model selection
 User preference customization for personalized tasks
 Temperature, max tokens, and difficulty controls
 Auto-generation toggle and privacy-focused design
 Comprehensive setup help and troubleshooting guide

 AI Capabilities:
 Local Ollama integration for uncensored content
 Personalized edging task generation
 Multiple model support (llama3.2, mistral, etc.)
 Configurable difficulty levels (easy/medium/hard/extreme)
 Personal preference integration
 Real-time connection status monitoring

 Technical Implementation:
 AITaskManager class with full error handling
 Debounced user input for performance
 Responsive UI design for AI configuration
 Flash message integration for user feedback
 Settings persistence and validation
 Complete event listener setup

 UI Enhancements:
 Professional AI Tasks tab design
 Status indicators with color coding
 Interactive configuration controls
 Task preview functionality
 Comprehensive help documentation
 Mobile-responsive design elements
2025-09-29 07:06:05 -05:00
dilgenfritz 243d037924 rebrand: Transform to 'Edge & Punishment' - The Ultimate Edging Challenge
Complete rebranding from generic task game to focused edging experience:

- Updated app name: 'Task Challenge Game'  'Edge & Punishment'
- Added tagline: 'How long can you last?'
- Rebranded package.json with adult-focused keywords (edging, adult, nsfw, punishment)
- Updated Electron app title and product name
- Redesigned main heading with stylized tagline
- Added elegant tagline CSS styling (italic, subtle color)
- Completely rewrote README.md focusing on edging/punishment features
- Updated desktop README with NSFW content management focus
- Enhanced descriptions to emphasize the consequence flooding system
- Added adult content keywords for discoverability

 Perfect positioning for the adult gaming market with clear value proposition:
'An edging challenge game where skipping tasks floods your screen with consequences'
2025-09-28 22:19:25 -05:00
dilgenfritz 7824629631 feat: Increase maximum popup images to 40 with smart performance optimizations
- Updated image count slider max from 8 to 40
- Increased range mode max from 10 to 40
- Updated random mode from 1-5 to 1-10 images
- Added dynamic delay calculation: faster delays for larger popup counts
- Added performance warning for counts >20 popups
- Enhanced UI with warning indicators and updated help text
- Added smart timing to prevent long delays with many popups
2025-09-28 22:01:44 -05:00
dilgenfritz 22a1642faa feat: Add dynamic aspect ratio sizing to punishment popups
- Modified PopupImageManager to calculate popup size based on image aspect ratio
- Added size configuration options (min/max width/height, viewport ratios)
- Enhanced popup positioning to handle variable-sized popups with collision detection
- Added comprehensive size controls to Annoyance Management interface
- Implemented asynchronous image loading to determine proper dimensions
- Added padding between popups to prevent visual overlap
- Updated default configuration with size constraints and viewport ratio settings
2025-09-28 21:53:58 -05:00
dilgenfritz 6fad5af73f feat: Phase 2 - Advanced Flash Message System & Annoyance Management
- Added comprehensive FlashMessageManager class with full CRUD operations
- Implemented 4-tab Annoyance Management interface (Messages, Appearance, Behavior, Import/Export)
- Enhanced message management: add/edit/delete/enable/disable with categories and priorities
- Advanced appearance controls: position, animation, colors, fonts, opacity
- Sophisticated behavior settings: timing, variation, event-based triggers
- Complete import/export system with merge/replace modes and reset options
- Added 20 default encouraging messages across 4 categories
- Integrated flash messages into game events (task completion, streaks, skips)
- Added responsive CSS with animations and professional styling
- Enhanced data persistence and error handling
- Game integration: messages start/pause/resume with game state

Phase 1-2 Complete: Core infrastructure + Advanced management ready for Phase 3
2025-09-28 21:33:54 -05:00
fritzsenpai f1f88d5f23 Implement streak bonus system with visual feedback
- Added streak tracking: currentStreak, totalStreakBonuses, lastStreakMilestone
- 10 bonus points awarded every 10 consecutive completed regular tasks
- Streak resets to 0 when task is skipped (consequence tasks don't affect streak)
- Real-time streak display in game stats with fire emoji and milestone highlighting
- Animated streak bonus notification with fire icon and gradient background
- Final stats display includes best streak and total streak bonus points earned
- Enhanced visual feedback with glowing effects for streak milestones (10+)
- Auto-save functionality preserves streak data across game sessions
2025-09-26 11:47:40 -05:00
fritzsenpai a74fefd1a3 Add custom options to game mode dropdowns with user-defined values - Added Custom option to time limit and score target dropdowns - Updated score presets to 100, 200, 300 points - Fixed JavaScript handlers for custom inputs 2025-09-26 11:39:34 -05:00
fritzsenpai 25d855c813 Implement compact interface design with hover-expandable controls
- Clean centered header with prominent title
- Compact timer in top-right corner with subtle styling
- Hover-expandable music controls replacing cluttered header layout
- Single music icon () expands to full control panel on hover
- Organized controls: play/loop/shuffle, track selection, volume
- Modern design with backdrop blur and smooth animations
- Maintains all functionality while dramatically reducing visual clutter
- Fixed textarea input issues in task management
2025-09-26 11:31:21 -05:00
fritzsenpai 6963250361 Enable much larger task images - almost fill the window
Enhanced image scaling for maximum visual impact:

##  Massive Image Scaling Upgrade:

### Dramatically Increased Size Limits:
- **Base Size**: Now 70vh height (was 45vh), 90vw width (was 85vw)
- **Ultra-wide Screens**: Up to 1500px wide, 1000px tall (was 900x700)
- **Large Screens**: Up to 1200px wide, 800px tall (was 700x550)
- **Medium Screens**: Up to 800px wide, 600px tall (was 500x400)
- **Small Screens**: Up to 500px wide, 400px tall (was 400x300)

### Window Size Optimizations:
- **window-xl**: 80vh height, 85vw width - nearly full screen
- **window-large**: 75vh height, 88vw width - most of the screen
- **window-medium**: 65vh height, 90vw width - large portion
- **window-small**: 55vh height, 95vw width - efficient use of space

### Enhanced Container Support:
- Container max-height increased to 85vh (was 70vh)
- Better vertical space utilization
- Full width containers for optimal centering
- Dynamic minimum heights scale with window size

### Responsive Breakpoint Updates:
- **1400px+**: 75vh max height, 85vw width - huge images
- **1000-1399px**: 65vh max height, 88vw width - very large
- **800-999px**: 55vh max height, 92vw width - substantial size
- **<800px**: 50vh max height, 95vw width - fills small windows

##  User Experience:
- **Immersive Viewing**: Images now dominate the screen appropriately
- **Better Detail Visibility**: Much easier to see image details
- **Scalable Impact**: Larger windows = dramatically larger images
- **Maintains Quality**: Aspect ratios and sharpness preserved
- **Space Efficient**: Takes full advantage of available screen real estate

**Images now fill most of the window for maximum visual impact! **
2025-09-26 05:16:23 -05:00
fritzsenpai 5af7d449e5 Implement dynamic task image resizing with hybrid approach
Advanced responsive image scaling that adapts perfectly to window size:

##  Hybrid Image Scaling System:

### Viewport-Based Responsive Sizing:
- Uses CSS viewport units (vw/vh) for smooth scaling with window size
- Images scale from 35vh to 50vh height based on window size
- Width scaling from 75vw to 95vw with appropriate maximum limits
- Dynamic minimum sizes prevent images from becoming too small

### Smart Size Constraints:
- **Large Windows (1600px+)**: Up to 900px wide, 700px tall
- **Medium-Large (1200-1599px)**: Up to 700px wide, 550px tall
- **Medium (900-1199px)**: Up to 500px wide, 400px tall
- **Compact (<900px)**: Up to 400px wide, 300px tall
- Maintains aspect ratios with object-fit: contain

### JavaScript Window Detection:
- Real-time window resize handling with debounced events (150ms)
- Dynamic CSS class assignment based on window width
- Classes: window-xl, window-large, window-medium, window-small
- Smooth layout recalculation and reflow optimization

### Enhanced User Experience:
- **Smooth Transitions**: 0.3s ease transitions between size changes
- **Aspect Ratio Preservation**: Images never get distorted
- **Performance Optimized**: Debounced resize events prevent lag
- **Console Feedback**: Size change logging for debugging

### Responsive Breakpoints:
- **Ultra-wide (1600px+)**: Maximum space utilization, largest images
- **Large (1200-1599px)**: Balanced sizing for desktop monitors
- **Medium (900-1199px)**: Compact but comfortable sizing
- **Small (<900px)**: Space-efficient layout for smaller windows

### Technical Features:
- **Viewport Units**: vw/vh for dynamic scaling
- **CSS min/max Functions**: Intelligent size constraints
- **Object-fit**: Perfect image fitting without distortion
- **Event Debouncing**: Smooth performance during window resizing
- **Layout Reflow**: Optimized image rendering on size changes

##  Result:
Task images now perfectly adapt to any window size while maintaining:
-  Proper aspect ratios
-  Readable minimum sizes
-  Reasonable maximum limits
-  Smooth scaling transitions
-  Optimal space utilization

**Images now resize beautifully with the window! **
2025-09-26 05:12:46 -05:00
fritzsenpai 18a4a7925c Implement comprehensive window resizing and responsive design
Major UX enhancement with full window resize support and responsive layouts:

##  Enhanced Electron Window Configuration:
- Explicitly enabled resizable and maximizable options
- Improved default window size handling
- Better titleBar integration for native controls
- Maintained minimum size constraints (800x600)

## � Window State Memory System:
- Automatically saves and restores window size, position, and maximized state
- State persisted in userData/window-state.json
- Graceful fallback to defaults if saved state is invalid
- Real-time state saving on resize, move, maximize/unmaximize events

##  Comprehensive Responsive Design:

### Layout Improvements:
- Increased max-width from 800px to 1400px for larger screens
- Added min-width constraints to prevent layout breaking
- Centered container with appropriate margins

### Media Query Breakpoints:
- **Large Screens (1200px+)**: Multi-column layouts, larger fonts, better space utilization
- **Medium Screens (900-1199px)**: Balanced layouts with flexible button arrangements
- **Small Screens (<899px)**: Compact layouts while maintaining usability
- **Ultra-wide (1600px+)**: Enhanced gallery layouts with more columns
- **Retina/High-DPI**: Enhanced shadows and visual polish

### Smart Layout Adaptations:
- Main action buttons: Row layout on larger screens, column on smaller
- Game mode selection: Grid layout on wide screens, stacked on narrow
- Image/Audio galleries: Dynamic column counts based on available space
- Task display: Optimal sizing for different screen sizes
- Management screens: Better use of horizontal space

##  User Experience Benefits:
- Window size preferences remembered between sessions
- Better space utilization on all screen sizes
- Improved readability and usability at different resolutions
- Native window controls work properly (maximize, resize corners)
- Professional desktop app experience with proper window management

##  Technical Implementation:
- Window state JSON persistence in user data directory
- Event-driven state saving (resize, move, maximize events)
- CSS Grid and Flexbox for responsive layouts
- Media queries for different screen size optimizations
- Maintains backward compatibility with existing layouts

**Now the app works beautifully at any window size! **
2025-09-26 05:07:25 -05:00
fritzsenpai ab26d61904 Fix game mode task cycling: Only end game on complete-all mode
Critical fix for timed and score target game modes:

Issue:
- Game was ending when all tasks were shown regardless of game mode
- Timed and score target modes should continue cycling through tasks
- Only 'complete-all' mode should end when all tasks are finished

Fix:
- Updated loadMainTask() to check gameMode before ending game
- Complete-all mode: Ends game when all tasks completed (original behavior)
- Timed/Score modes: Reset usedMainTasks array and continue cycling
- Added console logging for task cycling in non-complete-all modes

Now game modes work correctly:
 Complete All: Ends when all tasks finished
 Timed Challenge: Cycles through tasks until time runs out
 Score Target: Cycles through tasks until target score reached

This enables proper infinite task cycling for time-based and score-based challenges!
2025-09-25 22:04:59 -05:00
fritzsenpai cc853ad667 Implement 3 Game Modes: Complete All, Timed Challenge, and Score Target
Complete game mode system with dynamic UI and win conditions:

##  Three Game Modes:

### 1. Complete All Tasks (Default)
- Finish every main task in the game
- Original gameplay experience
- Game ends when all tasks completed

### 2. Timed Challenge
- Race against the clock to complete as many tasks as possible
- Configurable time limits: 5, 10, 15, 20, or 30 minutes
- Countdown timer with color warnings (red < 30s, orange < 60s)
- Game ends when time runs out

### 3. Score Target
- Reach a target score to win
- Configurable targets: 500, 1000, 1500, 2000, or 3000 points
- Game ends immediately when target reached
- Strategic gameplay focusing on high-value tasks

##  Enhanced UI Features:

### Game Mode Selection:
- Beautiful radio button interface on start screen
- Mode-specific configuration options (time/score targets)
- Dynamic show/hide of relevant settings
- Visual feedback with hover effects and selection states

### Smart Timer Display:
- Elapsed time for Complete All and Score Target modes
- Countdown timer for Timed Challenge mode
- Color-coded time warnings (red/orange when running low)
- Dynamic timer status indicators

### Dynamic Game Over Screen:
- Mode-specific victory messages and titles
- Shows selected game mode in final stats
- Different celebration text based on completion reason
- Comprehensive final statistics display

##  Technical Implementation:

### Game State Enhancement:
- Added gameMode, timeLimit, scoreTarget to gameState
- Proper game state reset handling for all modes
- Mode persistence and configuration management

### Win Condition Logic:
- Score target checking on task completion
- Timer countdown with automatic game end
- Complete-all detection (existing functionality preserved)
- Multiple end game reasons ('time', 'score-target', 'complete-all')

### Event System:
- Game mode selection event listeners
- Dynamic configuration updates
- Real-time UI state management
- Mode-specific timer updates

**Ready to challenge yourself in 3 different ways! **
2025-09-25 22:00:44 -05:00
fritzsenpai 927c19c45c Implement image no-repeat system: Images only repeat after all have been shown
Enhance image selection to prevent repeats until all images are exhausted:

## New Game State Tracking:
- Added usedTaskImages array to gameState
- Added usedConsequenceImages array to gameState
- Tracks which specific images have been displayed

## Smart Image Selection Logic:
1. **Filter Available Images**: Remove already-used images from selection pool
2. **Prevent Repeats**: Only select from images that haven't been shown yet
3. **Auto-Reset**: When all images exhausted, reset tracking and allow repeats
4. **Separate Tracking**: Task and consequence images tracked independently

## Enhanced User Experience:
- Users see all their images before any repeats occur
- Better variety and rotation through image collections
- Automatic cycling ensures no image is permanently excluded
- Visual feedback shows progression (X/Y images used)

## Technical Implementation:
- getRandomImage() enhanced with usage tracking
- Image identification works with both string paths and metadata objects
- Maintains compatibility with existing disabled images system
- Preserves all existing custom image functionality

## Console Logging:
- Shows when image cycles reset: 'All [type] images have been shown, resetting for repeat cycle'
- Tracks usage progression: 'Selected [type] image: [name] (X/Y used)'
- Helps users understand image rotation system

**Now images will cycle through the entire collection before repeating!**
2025-09-25 21:50:53 -05:00
fritzsenpai 411885873a Remove hardcoded built-in music tracks
Simplify MusicManager to use only custom audio files:

Changes:
1. MusicManager Constructor:
   - Initialize tracks array as empty instead of with 4 hardcoded tracks
   - Custom tracks loaded immediately by loadCustomTracks()
   - No more built-in vs custom track distinction needed

2. refreshCustomTracks() Method:
   - Simply clear tracks array since no built-in tracks exist
   - Reload custom tracks without filtering logic
   - Cleaner implementation without isBuiltIn property logic

Benefits:
 Music player now shows only user's imported background music
 Simpler codebase without hardcoded audio references
 All tracks are treated equally as custom content
 No need to maintain separate built-in/custom track categories

The music player will now be populated entirely from the user's
imported background audio files through the audio management system.
2025-09-25 21:48:23 -05:00
fritzsenpai 16d561eae2 Implement Phase 3: MusicManager Integration with Custom Audio
Complete integration of custom audio files with existing music player:

## Core Integration Features:

1. **Extended Track System:**
   - Built-in tracks marked with isBuiltIn: true
   - Custom tracks marked with isCustom: true
   - MusicManager now loads custom background music from storage
   - Automatic filtering of enabled custom tracks

2. **Dynamic Track Loading:**
   - loadCustomTracks(): Loads enabled background music into MusicManager
   - refreshCustomTracks(): Updates track list when audio files change
   - Auto-refresh when audio gallery is loaded/updated
   - Maintains backwards compatibility with built-in tracks

3. **Enhanced Track Selector:**
   - updateTrackSelector(): Rebuilds dropdown with all available tracks
   - Custom tracks labeled as '(Custom)' in selector
   - Handles track list changes without breaking current playback
   - Auto-resets to first track if current track becomes unavailable

4. **Seamless Integration:**
   - Custom background music appears alongside built-in tracks
   - All existing music controls work with custom tracks (play/pause, loop, shuffle, volume)
   - Track selector automatically updates when importing/deleting audio
   - No changes needed to existing playback logic

## User Experience:

 Import background music  Automatically appears in music player dropdown
 Enable/disable audio  Updates music player track list immediately
 Delete audio  Safely removes from player and resets if needed
 All music controls work seamlessly with custom tracks
 Visual distinction between built-in and custom tracks

## Technical Implementation:

- MusicManager.tracks array now includes custom audio files
- Automatic synchronization between audio management and music player
- Smart track indexing that survives add/remove operations
- Integrated with existing storage system and settings persistence

**Custom background music now fully integrated with the header music player!**
2025-09-25 21:45:42 -05:00
fritzsenpai c2e5b572ec Fix audio property mismatch: Use 'name' instead of 'filename'
Critical property mismatch fix:

Root Cause:
- Audio objects stored in customAudio have 'name' property (from desktop-file-manager.js)
- But UI templates and functions were looking for 'filename' property
- This caused audio files to never be found for deletion or enable/disable

Fixed Components:

1. HTML Template (loadAudioCategory):
   - data-filename now uses audio.name instead of audio.filename
   - Display filename now uses audio.name
   - onchange handler now passes audio.name

2. Deletion Logic (deleteSelectedAudio):
   - Search logic now looks for audio.name === filename
   - Removed incorrect audio.filename references

3. Storage Operations:
   - removeAudioFromStorage now filters by audio.name
   - toggleAudioEnabled now finds files by audio.name

4. Consistency:
   - All audio operations now use consistent 'name' property
   - Matches the actual storage structure from import process

This fixes:
 Audio file deletion (files can now be found in storage)
 Enable/disable toggles (files can be located properly)
 Storage operations (consistent property references)
 UI display consistency (proper filename display)

Audio deletion should now work correctly.
2025-09-25 21:41:11 -05:00
fritzsenpai 663bc9c489 Fix audio deletion async handling and add debugging
Fixes for audio deletion functionality:

1. Async Handling Fix:
   - Made deleteSelectedAudio() async function
   - Replaced forEach with Promise.all() for proper async handling
   - deletedCount was not updating correctly due to async timing issues
   - Now waits for all deletion promises to complete before showing results

2. Enhanced Error Handling:
   - Added try/catch around Promise.all()
   - Better error messages for failed deletions
   - Separate handling for no deletions vs errors

3. Debug Logging:
   - Added console logs to track audio file lookup process
   - Logs storage contents and search parameters
   - Helps identify why files aren't being found for deletion
   - Shows actual audioFile object found in storage

4. Improved User Feedback:
   - Shows specific count of successful deletions
   - Warning when no files are deleted
   - Error notification for deletion failures

This should resolve the deletion timing issues and provide better insight into any remaining problems.
2025-09-25 21:36:25 -05:00
fritzsenpai b4709e4f66 Fix audio file deletion: Correct path resolution for file deletion
Critical bug fix for audio deletion:

Issue:
- deleteSelectedAudio() was passing category and filename to deleteAudio()
- deleteAudio() expects full file path as first parameter
- This caused deletion attempts on directory paths like 'C:\Users\drew\webGame\background'
- Result: ENOENT errors trying to delete directories instead of files

Fix:
- Look up full audio file path from storage before calling deleteAudio()
- Handle both string and object audio storage formats
- Pass correct audioPath parameter to deleteAudio(audioPath, category)
- Enhanced removeAudioFromStorage() to handle both storage formats properly

Changes:
- deleteSelectedAudio(): Find full path from storage before deletion
- removeAudioFromStorage(): Support both string paths and object formats
- Proper error handling when audio file not found in storage
- Maintains backward compatibility with different storage formats

Now audio deletion works correctly:
 Finds correct file paths from storage
 Deletes actual audio files from disk
 Removes storage references properly
 No more ENOENT directory deletion errors
2025-09-25 21:34:07 -05:00
fritzsenpai 4e8e08c51e Fix audio import functionality: Add missing IPC API exposure
Critical fix for audio management:
- Added missing audio IPC functions to preload.js
- selectAudio: File dialog for selecting audio files
- readAudioDirectory: Directory scanning with title formatting
- copyAudio: File copying for audio import

Issue:
- Audio IPC handlers existed in main.js but weren't exposed to renderer
- selectAndImportAudio() calls were failing with 'undefined function' errors
- Upload functionality was broken due to missing API bridge

Fix:
- Exposed all three audio IPC functions in electronAPI context bridge
- Audio import buttons now have access to required backend functionality
- Maintains consistency with existing image API pattern

Now audio management fully functional:
 File selection dialogs work
 Directory scanning operational
 File copying and import functional
 Ready for user testing
2025-09-25 21:31:40 -05:00
fritzsenpai 9c8876b89f Implement Phase 2: Complete Audio Management UI
Major audio management interface implementation:

HTML Structure (index.html):
- Added complete audio-management-screen after image management
- Audio import buttons for background/ambient/effects categories
- Audio gallery with tabbed interface (background, ambient, effects)
- Audio preview section with HTML5 audio player
- Gallery controls: select all, deselect all, delete, preview
- Manage Audio button added to main start screen
- Professional layout matching image management design

CSS Styling (styles.css):
- Complete audio management styling system
- Audio gallery grid layout with 280px cards
- Audio item cards with icons, titles, controls
- Tabbed interface styling with active states
- Audio preview section with integrated player
- Category-specific icons ( background,  ambient,  effects)
- Hover effects, selection states, and responsive design
- Consistent with image management visual patterns

JavaScript Functionality (game.js):
- showAudioManagement() - main screen initialization
- setupAudioManagementEventListeners() - comprehensive event handling
- loadAudioGallery() - populate all three category galleries
- Audio tab switching (background/ambient/effects)
- Audio selection/deselection with click handlers
- Audio preview system with HTML5 player integration
- Delete functionality for selected audio files
- Enable/disable audio file toggles
- Audio storage info modal with desktop/web mode details
- Complete event listener management with duplicate prevention
- Audio discovery initialization in constructor

Features:
- Three-category audio organization (background, ambient, effects)
- Click-to-select audio items with visual feedback
- Preview selected audio files with integrated player
- Bulk operations: select all, deselect all, delete selected
- Enable/disable individual audio files
- Desktop file management integration
- Automatic audio directory scanning
- Storage information with category breakdowns
- Professional gallery layout with metadata display

Ready for Phase 3: Integration with MusicManager for playlist functionality
2025-09-25 21:27:21 -05:00
fritzsenpai c67d4dca27 Implement Phase 1: Desktop Audio Management Infrastructure
- Add comprehensive audio file management to desktop-file-manager.js
  - Audio directory structure (background/ambient/effects categories)
  - selectAndImportAudio() with category selection and file dialog integration
  - scanDirectoryForAudio() with category-specific scanning
  - updateAudioStorage() with duplicate prevention and storage management
  - deleteAudio() with file cleanup and storage updates
  - Utility functions: getAudioTitle() and getAudioPath()

- Add audio-specific IPC handlers to main.js
  - select-audio: Multi-selection file dialog for audio files
  - read-audio-directory: Directory scanning with title formatting
  - copy-audio: File copying with directory creation
  - Support for MP3, WAV, OGG, M4A, AAC, FLAC formats

- Foundation ready for Phase 2: Audio Management UI implementation
2025-09-25 21:19:58 -05:00
fritzsenpai 5caa82e659 Remove debug logging
Clean up console.log statements added during troubleshooting:
- Removed logging from showImageManagement()
- Removed logging from setupImageManagementEventListeners()
- Removed logging from loadImageGallery()
- Removed logging from updateImageGalleryControls()

Production ready - no more debug console spam.
2025-09-25 21:15:08 -05:00
fritzsenpai 205fbc1186 Fix critical startup freeze when no images loaded
Root cause fix:
- startGame() was calling showScreen('image-management-screen') directly
- This bypassed setupImageManagementEventListeners() and loadImageGallery()
- Changed to call showImageManagement() instead which properly initializes the screen
- showImageManagement() sets up all event listeners and loads gallery correctly

Issue sequence:
1. App starts with no images
2. User immediately clicks 'Start Game'
3. startGame() detects no images available
4. Called showScreen() directly  No event listeners  Freeze
5. Now calls showImageManagement()  Full setup  Works perfectly

Fix tested scenario:
- Start app  Navigate to manage images  Back home  Start game  (was working)
- Start app  Immediately click Start game  (now fixed - was freezing)

The freeze only happened on immediate startup because the screen wasn't properly initialized.
2025-09-25 21:10:12 -05:00
fritzsenpai 3d949fe08c Fix image management screen freeze with performance optimization
Major performance improvements:
- Replaced expensive DOM cloning/replacing in setupImageManagementEventListeners()
- Used direct onclick assignments instead of clone/replace operations
- Added imageManagementListenersAttached flag to prevent duplicate listener attachment
- Simplified updateImageGalleryControls() to use direct onclick assignment
- Added comprehensive logging to track function execution flow
- Reset listener flag when showing image management screen for fresh attachment

Performance fixes:
- Eliminated heavy DOM manipulation that was causing UI freeze
- Reduced memory overhead from constant node cloning
- Prevented listener duplication without expensive DOM operations
- Faster event listener setup with direct property assignment

The freeze was caused by the expensive cloneNode() and replaceChild() operations
being performed on every screen load, creating performance bottlenecks.
2025-09-25 21:06:27 -05:00
fritzsenpai aa3b7d8a1c Fix game freeze with no images loaded
Critical fix for desktop startup:
- Fixed startGame() function to properly handle new customImages object format
- Previously trying to call .length on object instead of array
- Added proper backward compatibility checking for both old array and new object formats
- Added comprehensive logging to debug image management screen freeze
- Now correctly counts custom images from both task and consequence categories

Fixes error where:
- User clicks Start Game with no images
- Game redirects to image management screen but freezes
- TypeError: customImages.length when customImages is {task: [], consequence: []}

Error resolved with proper object structure handling and logging.
2025-09-25 21:03:12 -05:00
fritzsenpai 85ea7f8938 Fix image deletion to remove files from disk
Critical fix for desktop mode:
- Updated deleteSelectedImages() to actually delete image files from disk
- Desktop mode now uses fileManager.deleteImage() to remove physical files
- Added proper category detection (task/consequence) for file deletion
- Enhanced error handling for file deletion operations
- Added different success messages for desktop vs web mode
- Maintains backward compatibility with web mode (storage-only deletion)

Previously:
- Images imported to images/tasks/ and images/consequences/ directories
- Deletion only removed references from localStorage
- Files remained on disk, causing clutter and storage waste

Now:
- Desktop deletion removes both file references AND physical files
- Clean filesystem management with no orphaned files
- Proper feedback about file vs reference deletion
- Robust error handling for file system operations
2025-09-25 20:43:57 -05:00
fritzsenpai d060f46292 Clean up image display interface
Visual improvements:
- Removed filename display from under images for cleaner look
- Removed 'Custom' badge to reduce visual clutter
- Added hover tooltip showing filename when mouse over image
- Simplified image-info section to only show enable/disable controls
- Cleaned up unused isCustom variable logic

Benefits:
- Much cleaner, more minimalist image gallery appearance
- Filename information still accessible via hover tooltip
- Less visual noise - focus on the images themselves
- Enable/disable functionality remains prominent and clear
- More professional gallery layout similar to modern image managers
2025-09-25 20:39:56 -05:00
fritzsenpai f4d695aa76 Remove bulk selection checkboxes, restore click-to-select
Interface simplification:
- Removed bulk selection checkboxes from image items
- Restored original click-to-select behavior for image selection
- Users can now click directly on images to select/deselect them
- Select All/Deselect All buttons now work by directly modifying image classes
- Kept Enable/Disable checkbox functionality unchanged

Benefits:
- Cleaner visual interface with fewer checkboxes
- More intuitive selection - click on image to select it
- Reduced visual clutter while maintaining all functionality
- Same bulk operations (select all, deselect all, delete selected) still work
- Original UX restored where selection was visual highlight, not checkbox
2025-09-25 20:36:19 -05:00
fritzsenpai 7597bc8eed Fix TypeError: customImages is not iterable
- Fixed updateImageCount() function to handle new customImages data structure
- Added compatibility for both old (array) and new (object) customImages format
- Function now properly handles { task: [], consequence: [] } structure
- Prevents TypeError when toggling image enabled/disabled states

Error was occurring when:
- User clicked checkbox to enable/disable images
- updateImageCount() tried to spread customImages as array
- But customImages was object with task/consequence properties

Fix ensures compatibility with both data formats for smooth migration.
2025-09-25 20:31:21 -05:00
fritzsenpai 0a7bcc91e9 Final interface cleanup and improvements
Interface updates:
- Removed 'Open Image Folders' button - functionality wasn't implemented
- Updated Storage Info to show desktop vs web-specific information
- Desktop mode now shows unlimited storage info with file system details
- Web mode shows traditional browser storage limitations

Storage Info improvements:
- Shows image counts by category (tasks/consequences)
- Desktop version highlights unlimited storage benefits
- Clearer information about native file system vs browser storage
- Better visual organization with emojis and sections

.gitignore updates:
- Added comprehensive image file exclusions (jpg, png, gif, webp, etc.)
- Added audio file exclusions (mp3, wav, ogg, m4a, etc.)
- Excluded user imported images directories (images/tasks/*, images/consequences/*)
- Prevents user content from being committed to repo

Benefits:
- Cleaner interface with fewer non-functional buttons
- Context-aware storage information based on platform
- Better repository hygiene by excluding user content files
2025-09-25 20:28:48 -05:00
fritzsenpai 18d0f8bba2 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
2025-09-25 20:24:57 -05:00
fritzsenpai ba4e532322 Fix automatic gallery refresh after image import
- Changed updateImageGalleryControls() to loadImageGallery() in import handlers
- Now gallery refreshes automatically after importing task or consequence images
- Also fixed scan button to refresh gallery after directory scanning
- No more need to navigate away and back to see newly imported images

Gallery now updates immediately showing:
- Newly imported images in the correct category tabs
- Updated image counts and selections
- Real-time visual feedback for successful imports
2025-09-25 20:21:07 -05:00
fritzsenpai 45adf1b757 Fix desktop application errors
Security and functionality fixes:
- Added Content Security Policy to index.html to address Electron security warning
- Fixed function name errors: updateImageGallery() -> updateImageGalleryControls()
- Enhanced error handling in desktop-file-manager.js path operations
- Added null checks for directory initialization to prevent undefined path errors
- Fixed category mapping for task/consequence directory access
- Improved error logging and user feedback for file operations

Fixes resolve:
- Electron CSP security warnings
- TypeError with undefined path arguments
- Missing function reference errors
- Desktop import button functionality
2025-09-25 20:17:30 -05:00
fritzsenpai 1aed657e74 Integrate desktop file manager with UI
Updates:
- Enhanced setupImageManagementEventListeners with desktop import buttons
- Added event handlers for Import Task Images and Import Consequence Images
- Integrated desktop file manager scanning with existing scan button
- Added desktop-specific CSS styling and responsive layouts
- Implemented desktop/web mode detection and UI adaptation

Desktop Features:
- Native file import dialogs for task and consequence images
- Seamless integration with existing image management system
- Desktop-optimized button layouts and hover effects
- Automatic UI adaptation based on Electron vs browser detection

UI Improvements:
- Enhanced button styling for desktop application
- Responsive upload controls with proper spacing
- Desktop-only elements hidden in web mode
- Professional desktop application appearance
2025-09-25 20:11:10 -05:00
fritzsenpai 8e7cf0d4bf Refactor to desktop application with Electron
Major Changes:
- Convert web game to cross-platform desktop app using Electron
- Add complete desktop file management system
- Implement native file dialogs and unlimited storage
- Create secure IPC bridge for file operations

New Files Added:
- main.js: Electron main process with native OS integration
- preload.js: Secure IPC bridge between main and renderer
- desktop-file-manager.js: Full file system access and operations
- package.json: Electron dependencies and build configuration
- setup.bat/setup.sh: Installation scripts for all platforms
- README-DESKTOP.md: Comprehensive desktop application guide

Desktop Features:
- Native file import dialogs (no browser limitations)
- Unlimited disk space for image storage
- Direct folder access and file management
- Cross-platform builds (Windows/Mac/Linux)
- Full offline functionality
- Native performance without web constraints

Benefits:
- Solves browser security sandbox limitations
- Unlimited image storage using file system
- Professional native application experience
- Easy installation and distribution
- True cross-platform compatibility
2025-09-25 20:07:45 -05:00
fritzsenpai 1879a8970f Initial commit: Task Challenge Game v1.4
Core Features:
- Complete task management game with point system
- Theme system with multiple visual styles
- Background music with playlist controls
- Comprehensive keyboard shortcuts (Enter/Ctrl/Shift+Ctrl/Space/P/M/H/Escape)

Image Management System:
- Categorized upload system (Task/Consequence images)
- High-quality image processing (1600x1200, 95% quality)
- Batch operations (select all, delete multiple)
- Storage quota management (50 image limit)
- Support for JPG/PNG/WebP up to 20MB

Technical Architecture:
- DataManager class for localStorage management
- TaskChallengeGame main controller
- Canvas-based image compression
- Cross-browser compatibility
- No dependencies - pure HTML/CSS/JS

Data Management:
- Local storage with auto-migration
- Export/import functionality
- Statistics tracking
- Game state persistence
2025-09-25 19:41:06 -05:00