Commit Graph
803 Commits
Author SHA1 Message Date
john-okeefe eddaae3ccd Fix watch mode automatic startup on server launch
Fixed a critical bug where watch mode failed to start automatically during container
initialization, despite comments in app.go:79 claiming it would start "after 2-second delay."

Root Cause:
- StartWatchModeForAllLibraries() function existed but was never invoked
- Comment in app.go claimed watch mode started automatically, but no startup code existed

Changes:
- Added "context" import to internal/router/router.go
- Added goroutine in configureRouter() that:
  * Waits 2 seconds after server initialization
  * Calls StartWatchModeForAllLibraries() to activate monitoring
  * Logs startup status or errors

This ensures watch mode begins scanning for new media files automatically when the
container starts, rather than requiring manual intervention.

Testing: Verified watch mode now activates automatically in container logs.
2026-02-25 10:39:56 -05:00
john-okeefe e8effeb666 docs: add comprehensive scanning progress implementation plan
Add detailed implementation plan for fixing Scan Library button and
diagnosing dashboard display issues. Documents investigation findings,
implementation steps, and testing requirements.

Content Sections:
- Fixed Issues: Bruno JSON syntax correction
- Issue 1: Scan Library Button (frontend fix needed)
- Issue 2: Scanned Books Not Showing on Dashboard (diagnosis needed)
- Complete Implementation Plan with code examples
- Diagnostic Steps for dashboard issue
- Potential fixes for all scenarios
- Testing checklist
- Related files and dependencies

Key Findings Documented:
1. Scan Library Button
   - Current: Sends folder_paths: [] → 400 error
   - Fix: Fetch all libraries, scan each, track progress
   - Includes full JavaScript implementation

2. Dashboard Display Issue
   - Books exist in database after scan
   - Not appearing on dashboard UI
   - Root cause requires diagnosis
   - Multiple hypotheses provided

3. Implementation Priority
   - HIGH: Fix Scan button (2-3 hours)
   - MEDIUM: Diagnose dashboard (30 min)
   - LOW: Fix dashboard (unknown)

Implementation Details:
- Complete quickScan() rewrite with error handling
- Progress UI with real-time polling
- Per-library progress tracking
- Results summary display
- CSS animations and styling
- Full diagnostic checklist

Benefits:
- Single source of truth for scanning work
- Can resume implementation at any time
- Documents all investigation findings
- Includes copy-paste ready code examples
- Testing checklist for validation

File: TASKS-scanning-progress.md
Lines: 600+
Related: templates/admin.templ, templates/dashboard.templ
2026-02-24 21:33:55 -05:00
john-okeefe a830e0e2b9 docs: remove completed planning documents
Remove outdated planning documents that have been implemented or are no
longer relevant. All features have been completed and documented elsewhere.

Removed Files:
- THEME_FIX_PLAN.md
- WOOD_PANELING_FONT_FIX_PLAN.md
- WOOD_PANELING_PLAN.md

Reason:
- Wood paneling feature is complete and in production
- Theme fixes have been implemented
- Font color issues resolved
- Documentation consolidated into TASKS-scanning-progress.md

Migration:
- See TASKS-scanning-progress.md for current implementation plans
- Wood paneling is documented in code comments
- Theme system is functional with multiple color schemes

Impact:
- Cleaner repository structure
- Reduced documentation maintenance burden
- Single source of truth for pending work
2026-02-24 21:33:45 -05:00
john-okeefe 836f77582b chore(bruno): update environment variables for testing
Update Bruno environment configuration with current library and job IDs
to support API testing workflows.

Changes:
- Update library_id to current active library
- Update job_id to recent scan job
- Add collection_id variable for collection testing

Variables Updated:
- library_id: 551ac19c-896a-4406-b479-353fc489b295
- job_id: 450094c6-a8f1-4125-aea7-77df80223877
- collection_id: 11e8d915-ef95-4257-98b3-b8eeacfd59b9 (new)

Impact:
- Bruno requests reference current test data
- Supports testing scan functionality
- Enables collection endpoint testing
- Maintains test environment consistency

File: bruno/environments/Bookhoard.yml
2026-02-24 21:33:36 -05:00
john-okeefe 7db5d56577 fix(ui): make wood paneling text colors consistent and visible
Fix text color display issues on wood gradient backgrounds in the
dashboard's collections container, ensuring small text matches big text
and "View All" links stand out with proper wood-specific colors.

Changes:
- Remove .text-sm from grey text rule to match big text colors
- Keep .text-secondary as only grey text class
- Links maintain wood-specific standout colors via specific selectors

Problem:
- Small text (.text-sm) was forced to grey (--wood-text-secondary)
- "View All" links inherited grey instead of wood link colors
- Inconsistent text sizing created visual hierarchy issues

Root Cause:
input.css:243-247 applied --wood-text-secondary to .text-sm
This overrode wood-specific link colors at lines 250-257

Solution:
Remove .text-sm and p.text-sm from the grey text rule:
- Before: .text-sm, .text-secondary, p.text-sm → grey
- After: .text-secondary only → grey
- .text-sm now uses --wood-text-primary (matches big text)
- Links (including "View All") use wood-specific blue colors

Impact:
- All small text now matches big text color on wood backgrounds
- "View All" links stand out with proper colors (#0066cc for light wood, #66ccff for dark)
- Improved readability and visual consistency
- Better user experience on wood gradient themes

Wood Theme Colors:
- Wood Light: #0066cc (dark blue for contrast on light background)
- Wood Dark: #66ccff (light blue for visibility on dark background)
- Wood Mahogany: #66ccff (light blue for visibility on dark background)

Files: web/static/input.css
Lines Modified: 243-247 (removed selectors)
Related: templates/dashboard.templ:100 (View All link)
2026-02-24 21:33:28 -05:00
john-okeefe b4421b0500 fix(bruno): correct JSON syntax in Scan Media Items request
Fix critical bug where library_id variable was not quoted in the request
body, causing invalid JSON that was rejected by the API parser.

Changes:
- Quote library_id variable: {{library_id}} → "{{library_id}}"
- Add explicit Content-Type header
- Update request body format to use proper YAML multi-line string

Root Cause:
- Unquoted UUID in JSON: {"library_id": 551ac19c-896a-...}
- Produced invalid JSON that failed c.Bind() in scanner handler
- Handler returned 400 "invalid request" error

Impact:
- Bruno requests for scanning now work correctly
- API scan endpoint accepts request successfully
- Enables proper testing of scan functionality via Bruno

Testing:
- Verified scan request completes successfully
- Job ID returned correctly
- Scanner processes files as expected

File: bruno/scanner/Scan Media Items.yml
2026-02-24 21:33:16 -05:00
john-okeefe 875e4abb46 fix: preserve wood paneling on dashboard refresh and improve colors
- Fix View All link flashing by preserving data-wood attribute when dashboard re-renders
- Update wood-dark text color to match wood-mahogany (#f5f5f5) for better consistency
- Add smart link colors for wood paneling (#0066cc for light wood, #66ccff for dark woods)
- Fix carousel arrow gradients to be less harsh on wood backgrounds (0.6 for light, 0.3 for dark)
- Remove accent color preservation rule that was conflicting with wood-specific link colors
2026-02-24 17:00:11 -05:00
john-okeefe 4571a19159 feat: add smart font colors for wood paneling backgrounds
- Add data-wood attribute to collections container for CSS targeting
- Update woodPaneling.ts and woodPanelingInit.ts to set/remove attribute
- Add CSS variables for wood-specific text colors (dark text on light wood, light text on dark wood)
- Add !important rules to override theme colors when wood is active
- Replace wood-dark and wood-mahogany textures with darker variants
- Add subtle borders to book cards on wood backgrounds
2026-02-24 16:36:49 -05:00
john-okeefe c50f58dafc docs: add wood paneling font color fix plan
- Create comprehensive implementation plan for smart font colors on wood paneling backgrounds
- Addresses readability issues where current theme colors don't contrast well with wood textures
- Includes CSS strategy, TypeScript changes, texture replacements, and testing checklist
- Ready to implement when needed
2026-02-24 16:10:36 -05:00
john-okeefe 30d053d908 fix: resolve library management issues
- Fix library edit form to use type_name instead of library_type_id for type dropdown
- Clear library-id input after successful delete to prevent create-then-delete bug
- This fixes the issue where creating a new library after deleting one would fail with 'Unknown error' due to stale library-id
2026-02-24 16:10:33 -05:00
john-okeefe 519633ff87 chore(templates): add generated admin_sidebar templ file 2026-02-24 13:43:01 -05:00
john-okeefe 9426df01fc refactor(theme): separate wood paneling from color themes
- Remove wood themes (wood-light, wood-dark, wood-mahogany) from profile theme selector
- Add wood paneling as separate section in header theme dropdown
- Update script references to include new theme management files
- Change header layout to full-width design
2026-02-24 13:41:24 -05:00
john-okeefe 4b43116f13 refactor(templates): apply activeClass helper and full-width layout
- Replace inline ternary operators with activeClass helper function
- Change layout containers from max-w-7xl to w-full for full-width design
- Update file path references in error messages for better debugging
2026-02-24 13:41:19 -05:00
john-okeefe 3128ae05a6 feat(assets): add wood texture images for paneling
- Add wood-light.png, wood-dark.png, wood-mahogany.png textures
- Rebuild CSS with wood background utilities and indicator classes
2026-02-24 13:06:07 -05:00
john-okeefe 8b8af87504 docs(user): add themes and wood paneling guide
- Document all available color themes with descriptions
- Explain wood paneling feature and available textures
- Provide step-by-step instructions for changing themes
- Add tips for theme/texture pairing
2026-02-24 13:03:12 -05:00
john-okeefe c341679aaa refactor(layout): apply full-width layout to all pages
- Remove max-w-7xl containers from all page templates
- Replace with w-full for full-screen width utilization
- Maintain padding for readability
- Admin templates: modify inner content div only (preserve sidebar layout)
2026-02-24 13:03:01 -05:00
john-okeefe 3870168452 refactor(dashboard): apply full-width layout and wood paneling
- Remove max-w-7xl constraints from library selector and collections
- Include woodPanelingInit.js script for early paneling application
- Prevent flash of wrong background on page load
- Wood paneling applied only to #collections-container
2026-02-24 13:02:34 -05:00
john-okeefe 0327d367f2 refactor(header): separate wood paneling from color themes
- Remove max-w-7xl constraint, use full-width layout
- Replace wood theme buttons with wood paneling section
- Add visual previews for wood textures in dropdown
- Section labeled "Bookshelf Background" for clarity
- Include woodPaneling.js and themeDropdown.js scripts
2026-02-24 13:01:45 -05:00
john-okeefe b1dcb3889e feat(styles): add active indicator classes for dropdown buttons
- Add bg-theme-active/inactive for theme buttons
- Add bg-wood-active/inactive for wood paneling buttons
- Use CSS variables already defined in input.css
- Use !important to override inline styles
2026-02-24 13:01:10 -05:00
john-okeefe 3575396e5c feat(tailwind): add wood texture background utilities
- Add bg-wood-light, bg-wood-dark, bg-wood-mahogany utilities
- Reference texture files in web/static/textures/
- Extend theme.backgroundImage for seamless texture support
2026-02-24 13:00:48 -05:00
john-okeefe 245c775f54 feat(theme): add active indicators for theme dropdown
- Create themeDropdown.ts to manage active state highlighting
- Show which theme/wood option is currently selected
- Use CSS classes instead of inline styles for indicators
- Wrap existing functions to update indicators on toggle
- Auto-initialize indicators on DOM ready
2026-02-24 13:00:14 -05:00
john-okeefe fffa87009a feat(wood-paneling): create wood paneling management system
- Add woodPaneling.ts with localStorage-based paneling preferences
- Add woodPanelingInit.ts for early initialization (prevents flash)
- Support none, wood-light, wood-dark, wood-mahogany options
- Apply paneling to #collections-container only (not full body)
- Use Tailwind utility classes for backgrounds
- Use CSS variable classes for active indicators
- Export functions for HTML onclick handlers
- Auto-initialize on DOM ready
2026-02-24 12:59:48 -05:00
john-okeefe 891b1f3a3e refactor(profile): remove wood themes from profile settings
- Remove wood-light, wood-dark, wood-mahogany from theme dropdown
- Wood paneling is now browser-only (localStorage preference)
- Users select wood paneling from header dropdown, not profile
- Profile form only controls server-synced color themes
2026-02-24 12:58:57 -05:00
john-okeefe 9eebf6675b refactor(css): remove wood theme CSS variables
- Remove .theme-wood-light, .theme-wood-dark, .theme-wood-mahogany
- Wood paneling will use separate background utilities
2026-02-24 12:58:29 -05:00
john-okeefe 6407c2f299 refactor(tailwind): remove wood themes from safelist
- Remove theme-wood-light, theme-wood-dark, theme-wood-mahogany
- Wood themes no longer exist as color themes
2026-02-24 12:58:12 -05:00
john-okeefe 3d3af8bd92 refactor(theme): remove wood themes from core theme system
- Remove wood-light, wood-dark, wood-mahogany from ThemeType
- Remove wood theme gradient logic from applyTheme()
- Wood themes will be reimplemented as separate paneling feature
- Paneling will target dashboard bookshelf background only
2026-02-24 12:57:54 -05:00
john-okeefe 67f08ba75e docs(wood-paneling): fix line reference and build commands
- Phase 5: Change line number to structural reference (before closing brace)
- Fix all TypeScript build commands from 'npm run build' to 'npm run build:ts'
- Ensures plan aligns with actual package.json scripts
- Prevents execution failures during implementation
2026-02-24 12:55:17 -05:00
john-okeefe ee3e2147c2 docs(wood-paneling): fix JavaScript violations and add profile form updates
- Add Phase 1b to remove wood themes from profile_form.templ
- Add woodPanelingInit.ts to Phase 2 for early initialization
- Remove inline JavaScript from Phase 7, use TypeScript instead
- Update Critical Requirements to prohibit inline scripts entirely
- Update Files Summary with new files and modifications
- All changes align with PROJECT_GUIDELINES.md requirements
2026-02-24 12:35:06 -05:00
john-okeefe f2577ef96d chore: update gitignore for IDE support
- Add .zed/ to gitignore (Zed editor config)
- Add .opencode/ to gitignore (opencode tool data)
- Remove .zed/settings.json from version control
- Keeps repository clean of IDE-specific files
2026-02-24 12:01:04 -05:00
john-okeefe e8bb1496cf docs(wood-paneling): comprehensive plan update with TypeScript and documentation
- Add Implementation Principles section (critical requirements)
- Add Git Commit Strategy section (sequential commands, verification)
- Split implementation into 10 detailed phases (0-10)
- Convert all JavaScript to TypeScript (no inline scripts except simple init)
- Use CSS variable classes instead of inline styles for indicators
- Add explicit verification steps after each file edit
- Add documentation phase (Phase 9) for user-facing features
- Add final testing phase (Phase 10) with comprehensive checklist
- Preserve admin template sidebar layout instructions
- All git commits structured sequentially (no && chaining)
- Post-edit verification mandatory after each file change

Addresses issues found during analysis:
- Missing documentation updates
- Inline JavaScript should be TypeScript
- No explicit git commit structure
- Missing post-edit verification checkpoints
- Use CSS variables already defined in input.css
2026-02-24 11:55:43 -05:00
john-okeefe 9b4eee0c1f docs: add git workflow guidelines for sequential command execution 2026-02-24 10:46:30 -05:00
john-okeefe 665e2533f6 build: compile templates and JavaScript after theme fixes
- Regenerate admin_library_templ.go with admin sidebar integration
- Regenerate admin_users_templ.go with sidebar layout and theme fixes
- Regenerate bookshelf_templ.go with dynamic theme rendering
- Regenerate index_templ.go with progressive enhancement script
- Regenerate login_templ.go with progressive enhancement script
- Regenerate register_templ.go with progressive enhancement script
- Compile header.js with consolidated theme logic
2026-02-24 10:26:31 -05:00
john-okeefe 65b737ec2c fix(theme): ensure theme.js loaded before header.js
- Add theme.js script include to header template
- Fixes theme selector not working on pages using Header component
- Ensures applyTheme() is defined before changeThemeTo() calls it
2026-02-24 10:25:10 -05:00
john-okeefe 7a420ef975 refactor(theme): fix theme consistency and persistence
- Apply server-side theme rendering to authenticated pages
  - bookshelf.templ: use dynamic theme-{ user.Theme }
  - admin pages: use dynamic theme rendering
- Add progressive enhancement for public pages
  - index.templ, login.templ, register.templ: inline localStorage check
  - Prevents theme flash on page load
- Consolidate wood theme logic into theme.ts
  - Move wood gradient handling from header.ts to theme.ts
  - Apply wood themes consistently via applyTheme()
- Export applyTheme to window for use by header.ts
- Fix theme selector by adding theme.js to header template
2026-02-24 10:25:06 -05:00
john-okeefe 4be69861bd refactor(admin): integrate reusable sidebar into admin pages
- Update admin.templ to use @AdminSidebar component
- Update admin_library.templ to use @AdminSidebar component
- Update admin_users.templ to use @AdminSidebar component
- Add sidebar layout wrapper to admin_users.templ (previously missing)
- Fix theme rendering to use user.Theme in all admin templates
- Remove duplicated sidebar markup across admin pages
2026-02-24 10:24:50 -05:00
john-okeefe 3b0fee4281 feat(frontend): add reusable admin sidebar component
- Create AdminSidebar component for admin panel navigation
- Support active state highlighting based on currentPath
- Consistent navigation across all admin pages
- Replaces duplicated sidebar markup in admin templates
2026-02-24 10:24:21 -05:00
john-okeefe 79d10b5b37 docs: add theme fix and admin sidebar implementation plans
- Add THEME_FIX_PLAN.md: comprehensive plan for theme system consistency
- Add ADMIN_SIDEBAR_PLAN.md: reusable admin sidebar component plan
- Add WOOD_PANELING_PLAN.md: wood paneling and full-width layout plan
2026-02-24 10:24:05 -05:00
john-okeefe 97d22687ed docs(theme): add comprehensive theme system consistency fix plan
- Document root cause of theme flashing issue
- Detail implementation plan for server-side theme rendering
- Include testing checklist and rollback strategy
- Cover wood theme gradient persistence fix
2026-02-24 08:05:04 -05:00
john-okeefe e16c277caa docs: remove completed admin library implementation plan
-- Delete ADMIN_LIBRARY_IMPROVEMENTS_PLAN.md
-- All features from the plan have been implemented
-- Plan is no longer needed as reference
2026-02-23 20:24:20 -05:00
john-okeefe e68a53651a refactor(devops): reorganize rebuild targets for clarity
-- Rename 'build' to 'rebuild' for clarity (rebuilds all containers)
-- Rename 'build-force' to 'rebuild-force' for consistency
-- Add 'rebuild-app-force' target for app-only rebuild without cache
-- Add 'rebuild-force-db' target that DELETES database for clean rebuild
-- Improve help text to clarify what each target does
-- Remove circular dependency (rebuild no longer depends on clean)
-- All rebuild targets now preserve database unless explicitly stated
2026-02-23 20:24:16 -05:00
john-okeefe e7f30a00c0 style(templates): fix code formatting with consistent indentation
-- Reformat all generated template Go files with consistent indentation
-- Standardize code style across templates/
-- No functional changes, formatting only
-- Generated by templ tool during development
2026-02-23 20:24:10 -05:00
john-okeefe 85ba3d4060 feat(frontend): add delete confirmation modal for library management
-- Add dedicated delete confirmation modal to admin/library page
-- Refactor deleteLibrary() to use modal instead of inline confirm()
-- Add showDeleteModal(), hideDeleteModal(), confirmDeleteLibrary() functions
-- Modal displays clear warning about what gets deleted
-- Improves UX by making the confirmation dialog more prominent and informative
2026-02-23 20:23:56 -05:00
john-okeefe be49bc13a7 test(bruno): add manual API contract test for folder browsing
- Create bruno/library/browse-folders.yml
- Single manual test case for admin context
- Unit/integration tests cover all scenarios (no auth, user, admin)
- Bruno provides quick manual API contract verification

Fixes: Issue 2 (manual testing)
2026-02-23 17:03:49 -05:00
john-okeefe f91b1bf54b docs(api): document library folder browsing endpoint
- Add docs/developer/api/libraries/browse-folders.md
- Document security features (path traversal protection, admin-only)
- Include usage examples and error responses
- Clarify browses server filesystem, not client's

docs(user): add admin library folder browser documentation

- Add docs/user/admin-library-management.md
- Document how to use the folder browser UI
- Include security notes and manual entry instructions
- Explain server filesystem browsing behavior

Fixes: Issue 2 (documentation)
2026-02-23 17:03:35 -05:00
john-okeefe 22e10fa460 test(backend): add unit and integration tests for folder browsing
- Add unit tests in internal/services/library_service_test.go
  - Test path traversal protection
  - Test non-existent path handling
  - Test file vs directory validation
  - Test successful directory listing
- Add integration tests in cmd/server/tests/library_browse_test.go
  - Use setupTestServer() helper from test_helpers.go
  - Test no authentication returns 401
  - Test regular user returns 403 forbidden
  - Test admin can browse directories
  - Test path traversal blocking
- All tests use table-driven approach with t.Run()

Fixes: Issue 2 (tests)
2026-02-23 17:03:03 -05:00
john-okeefe 2af035d87f feat(backend): add server-side directory browsing API
- Add BrowseDirectories() to library service with path traversal protection
- Add BrowseDirectories handler with proper error handling
- Register GET /api/libraries/browse endpoint (admin-only)
- Returns current path, parent path, and list of subdirectories
- Security: blocks "..", validates path exists, checks is directory

Fixes: Issue 2 (backend)
2026-02-23 17:02:52 -05:00
john-okeefe c333c82c6b fix(frontend): add data parameter support to apiDelete
- Add optional data parameter to apiDelete() with generic type safety
- Enables DELETE requests with request bodies (needed for folder deletion)
- 100% backward compatible (optional parameter)
- Supports type-safe request body passing

Part of: Issue 1
2026-02-23 17:02:35 -05:00
john-okeefe 509423b46e feat(frontend): implement library edit functionality
- Reuse Create Library modal for edit mode
- Add hidden library-id input to track create vs edit
- Update handleCreateLibrarySubmit to detect mode and use PUT vs POST
- Implement editLibrary() to populate modal with existing data
- Pass library data to Edit button via data attributes
- Reset modal title when opening for create mode

Fixes: Issue 3
2026-02-23 17:02:01 -05:00
john-okeefe a137d3ea76 docs: add admin library page improvements implementation plan
- Document 4 improvements to /admin/library page
- Issue 1: Fix folder list display bugs (toggle logic, DELETE request body)
- Issue 2: Add server-side folder browser with full-stack implementation
- Issue 3: Implement edit library functionality
- Issue 4: Clarify delete confirmation message

Key changes:
- Add os import for BrowseDirectories service function
- Use event delegation pattern for folder browser UI
- Add DeleteFolderRequest interface for type safety
- Include comprehensive testing strategy (unit, integration, Bruno)
- Follow PROJECT_GUIDELINES.md throughout
- Procedural/imperative style, no OOP
- Progressive enhancement maintained
2026-02-23 16:12:25 -05:00
john-okeefe ce50312e1b feat(frontend): Add TypeScript for admin library page
Add web/src/library.ts with complete functionality for /admin/library
page interactivity.

Features:
- reloadLibraries() - fetch and render library list after changes
- renderLibraries() - SSR replacement with proper data.data handling
- loadUserVisibility() - load and display user library permissions
- setLibraryVisibility() - toggle library visibility for users
- handleCreateLibrarySubmit() - form submission with fetch API
- deleteLibrary() - delete with confirmation
- showLibraryFolders() - folder management
- addLibraryFolder() / removeLibraryFolder() - folder CRUD
- editLibrary() - placeholder for future implementation
- Modal controls (show/hide)
- Event delegation for dynamic buttons
- XSS protection with escapeHtmlLocal()

TypeScript Features:
- Proper type definitions (Library, User, LibraryFolder)
- Async/await with error handling
- Procedural style (no OOP, per PROJECT_GUIDELINES)
- Exports functions to window for global access

Bug Fixes:
- Fixed data.data API response handling
- Replaced broken HTMX form with fetch()
- Proper error messages with toast notifications

Lines: 394
2026-02-22 21:07:06 -05:00