Add immediate visual feedback on search click

Status updates to "Starting search..." immediately when button clicked,
before async operations. This will help diagnose if JS handler is running.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
b1rdmania
2025-12-29 16:35:14 +00:00
parent cb9ea7bcc9
commit 7dcc233445
+9 -7
View File
@@ -147,20 +147,22 @@ class MotifApp {
} }
private setupEventListeners(): void { private setupEventListeners(): void {
this.searchBtn.addEventListener('click', () => { const doSearch = () => {
console.log('[MotifApp] Search button clicked'); console.log('[MotifApp] Search triggered');
// Immediately show feedback so user knows click registered
this.status.textContent = 'Starting search...';
this.handleSearch().catch(err => { this.handleSearch().catch(err => {
console.error('[MotifApp] Search error:', err); console.error('[MotifApp] Search error:', err);
this.updateStatus(`Error: ${err instanceof Error ? err.message : 'Unknown error'}`); this.updateStatus(`Error: ${err instanceof Error ? err.message : 'Unknown error'}`);
}); });
}); };
// Use both click and touchend for iOS compatibility
this.searchBtn.addEventListener('click', doSearch);
this.songInput.addEventListener('keypress', (e) => { this.songInput.addEventListener('keypress', (e) => {
if (e.key === 'Enter') { if (e.key === 'Enter') {
this.handleSearch().catch(err => { doSearch();
console.error('[MotifApp] Search error:', err);
this.updateStatus(`Error: ${err instanceof Error ? err.message : 'Unknown error'}`);
});
} }
}); });