john-okeefe
6728ba83a1
refactor: Add Alpine.js registration to existing TypeScript modules
...
Added Alpine.global() registration to enable template access to functions:
- admin.ts: Added Alpine for scan, stats, and settings functions
- api-explorer.ts: Already had Alpine (kept as is)
- bookshelf.ts: Added Alpine for library/bookshelf interactions
- collections.ts: Added Alpine for collection management
- conflicts.ts: Added Alpine for conflict resolution
- device-management.ts: Added Alpine with event delegation for dynamic content
- header.ts: Added Alpine for theme dropdown and user menu
- library.ts: Added Alpine registrations
- linking.ts: Added Alpine registrations
- queue.ts: Added Alpine for queue operations
- search.ts: Added Alpine registrations
- themeDropdown.ts: Added Alpine for theme switching
Each module now exports functions both traditionally and via Alpine.global() for template access.
2026-03-08 21:36:24 -04:00
john-okeefe
9947a12f09
refactor(ts): Convert internal window dependencies to ES modules
...
Phase 1 of ESBuild migration: Convert 193+ internal window reads
to proper ES module imports across consumer modules.
Replaced window global pattern with direct function imports:
- (window as any).showToast → import { showToast } → showToast(msg, "type")
- (window as any).api.post → import { apiPost } → apiPost(url, data)
- (window as any).dom.getElementById → import { getElementById }
Modules migrated:
- admin.ts: Convert 14 showToast window reads
- analytics.ts: Add ES export (no window reads)
- conflicts.ts: Convert 6 showToast window reads
- custom-section-builder.ts: Convert api.post reads, add ES exports
- dashboard.ts: Convert 10 window reads (api, showToast)
- device-management.ts: Convert 4 showToast window reads, add Alpine registration
- linking.ts: Convert showToast window reads
- queue.ts: Convert 8 showToast window reads
Additionally added Alpine.js registration for templates:
- device-management.ts: Register copyToClipboard, regenerateDeviceToken
Benefits:
- Type-safe imports with build-time validation
- No runtime checks needed (ES modules guarantee existence)
- Clear dependency chains via explicit imports
- Eliminates 193+ window global reads
Pattern now: Import at top, direct function calls, Alpine registration
at bottom for template access.
Migration progress: Phase 1 complete
Next: Phase 2 (Alpine registration for remaining modules)
2026-03-08 01:14:35 -05:00
john-okeefe
39a87ddabc
feat: integrate WebSocket for real-time scan progress in admin panel
...
- Add WebSocket connection for scan progress updates
- Display live progress bar and file count during scans
- Handle scan_complete and scan_error messages
- Store polling interval in module variable for cleanup
- Expose stopScanStatusPolling function for manual control
Replaces or supplements HTTP polling with push-based updates for
better UX and reduced server load.
2026-03-05 17:13:23 -05:00
john-okeefe
ea5ad7a41b
feat(web): update frontend TypeScript modules and API types
...
This commit updates the web frontend TypeScript modules:
Core modules:
- admin.ts: Admin panel functionality and user management
- analytics.ts: Analytics dashboard and data visualization
- api-explorer.ts: Interactive API documentation explorer
- api.ts: Core API client with request/response handling
- collections.ts: Book collection management UI
- conflicts.ts: Sync conflict resolution interface
- custom-section-builder.ts: Dynamic section builder for UI
- docs.ts: Documentation viewer and navigation
- dom.ts: DOM manipulation utilities and helpers
- header.ts: Application header with navigation
- library.ts: Library view and book grid management
- linking.ts: Device-book linking interface
- password_validation.ts: Client-side password strength validation
- queue.ts: Device sync queue management UI
- search.ts: Full-text search with Lunr integration
- storage.ts: Local storage and cache management
- theme.ts: Theme management and CSS variable updates
- themeDropdown.ts: Theme selector dropdown component
- toast.ts: Toast notification system
- woodPaneling.ts: Visual theme effects
- woodPanelingInit.ts: Visual effects initialization
Type definitions:
- api.d.ts: Updated TypeScript definitions for API responses
These updates enhance the frontend with improved functionality
for book management, device synchronization, and user experience.
2026-02-27 17:06:48 -05:00
john-okeefe
abcc468024
frontend: add force rescan to button and watch status display
...
- Send force: true in scan API request body
- Rename 'Scan Library' button to 'Rescan Library'
- Replace Settings card with Watch Status display
- Add loadWatchStatus() to fetch and display watch mode status
- Remove inline script from admin.templ (moved to admin.ts)
2026-02-26 10:11:52 -05:00
john-okeefe
64e1ba87b9
Implement Part 1: Fix Scan Library button with progress UI
...
Implements the frontend scan button fix from TASKS-scanning-progress.md Part 1.
Changes:
1. web/src/admin.ts - Added 6 new TypeScript functions:
- scanAllLibraries(): Fetches all libraries, triggers scan for each
- showScanProgress(): Displays progress UI with per-library progress bars
- pollScanProgress(): Polls status every 2 seconds, updates progress
- updateLibraryProgress(): Updates individual library progress bar/status
- showScanResults(): Displays scan completion results
- hideScanProgress(): Hides progress UI
2. templates/admin.templ - Updated UI:
- Added admin.js script include (Step 2)
- Changed button onclick from quickScan() to scanAllLibraries() (Step 3)
- Removed broken inline quickScan() function (Step 3.5)
- Added progress UI HTML with slide-in animation (Step 4)
Key Features:
- Fetches all libraries via GET /api/libraries
- Triggers scan for each library via POST /api/libraries/{id}/scan
- Displays per-library progress bars
- Shows overall progress percentage
- Real-time status updates every 2 seconds
- Results summary with file counts and errors
- TailwindCSS animation (no custom CSS)
- Follows PROJECT_GUIDELINES.md: TypeScript only, TailwindCSS classes
TypeScript compiles successfully (npm run build:ts)
All guidelines verified (26/26 checks pass)
2026-02-25 12:20:48 -05:00
john-okeefe
dfd9cbcde7
feat(typescript): add feature modules for template conversion
...
- Add search.ts - header search with keyboard navigation
- Debounced search with 300ms delay
- Arrow key navigation through results
- Escape to close, Enter to select
- Library type icons and highlighting
- Add collections.ts - collection and rule management
- Rule CRUD operations (create, update, delete)
- Rule testing functionality
- Bulk collection operations
- Add bookshelf.ts - book display and navigation
- Library selection state management
- Book viewing interactions
- Pagination logic
- Add linking.ts - book matching and manual linking
- Search and match functionality
- Manual link modal
- Bulk auto-link and suggestions
- Add api-explorer.ts - API testing interface
- Request/response display
- cURL command generation
- History tracking
- Add admin.ts - admin dashboard actions
- Library scan triggers
- System statistics display
- Profile management
- Add analytics.ts - analytics data loading
- Chart.js integration
- Daily reading minutes chart
- Device usage and popular books display
- Add queue.ts - sync queue management
- Process pending items
- Clear failed/all items
- Filter by status, type, device
- Add conflicts.ts - conflict resolution
- Individual and bulk resolve operations
- Winner device selection
- Manual override inputs
- Add docs.ts - documentation search
- Lunr.js search integration
- Sidebar toggle for mobile
2026-02-18 16:40:51 -05:00