Skip to content

Implement interactive chat filtering and enhanced search features#2

Merged
muhammedaksam merged 12 commits into
mainfrom
develop
Dec 19, 2025
Merged

Implement interactive chat filtering and enhanced search features#2
muhammedaksam merged 12 commits into
mainfrom
develop

Conversation

@muhammedaksam

Copy link
Copy Markdown
Owner

Introduce interactive filter pills for chat categories and a search bar that integrates with archived chats and the full contacts list. Fix issues with chat selection and keyboard navigation to ensure a seamless user experience. Enhance search functionality to include all contacts and provide real-time updates based on user input. Update dependencies and versioning accordingly.

- Add filterChats utility for client-side chat filtering
- Make filter pills (All/Unread/Favorites/Groups) clickable
- Filter excludes archived chats by default
- Update archived section to show unread count in archived
- Fix keyboard navigation to use filtered chat count
- All navigation handlers (up/down/home/end/pageup/pagedown) now bound correctly
- Fix filter pills using onMouse handler instead of .on('click')
- Add Tab/Shift+Tab keyboard shortcuts for cycling through filters
- Fix Enter key handler to use filtered chats array
- Fix mouse click handler in ChatListManager to use chat parameter
- Previously selected index was applied to unfiltered array causing wrong chat to open
- Now correctly opens the chat that is visually selected in the filtered list
- Replace static search bar with InputRenderable for interactivity
- Add module-level search input storage for lifecycle management
- Export focusSearchInput/blurSearchInput/clearSearchInput functions
- Add keyboard shortcuts: / or Ctrl+F to focus search
- Escape to blur search or clear query if active
- Search updates searchQuery state in real-time
- Filtering works via existing filterChats function (searches chat names)
- Search properly integrates with inputMode state
- WhatsApp Web includes archived chats in search, not just active chats
- Removed isArchived filter from searchChatsWithSections
- Search now correctly finds chats in archived section
- Fixes issue where searches returned 0 results for archived chat names
- Added allContacts field to AppState for full phonebook contacts
- Created loadAllContacts utility to fetch all contacts from /api/contacts/all
- Integrated loadAllContacts into loadChats function (runs on app startup)
- Updated enhanced search to use allContacts instead of contactsCache
- Contacts section now searches full phonebook, not just chat participants
- Fixes issue where contact searches returned 0 results
- Contacts API returns {id, name, pushname, shortName} not {whatsappId, fullName}
- Updated loadAllContacts to use correct field names from API response
- Now contacts will load correctly (previously loaded 0 contacts)
- **Enhanced Search**: Implemented WhatsApp-style sectioned search results (Chats, Contacts, Messages).
- **Archived Chats**: Added clickable 'Archived' section to chat list with toggle state and back navigation.
  - Added 'Ctrl+A' / 'Meta+A' shortcut to toggle archived view.
- **Start New Chat**: Implemented 'Start new chat from search' feature.
  - Validates phone numbers via WAHA API ().
  - Navigates to conversation view for valid numbers.
- **Refactor**:
  - Cleaned up  types (removed ).
  - Simplified  utility.
  - Improved  component types.
Added getCurrentFilteredChats helper to index.ts that respects
showingArchivedChats state when determining the active chat list.
This ensures keyboard navigation (Up/Down/Enter/Home/End/PageUp/PageDown)
operates on the correct list when viewing archived chats, fixing the bug
where selecting an archived chat would open a different conversation.

Also imported isArchived utility from filterChats for proper type-safe
archive status detection.
- Enable mouse click on chat list items to open conversations (using OpenTUI's onMouse callback)
- Fix "two actives" bug where both selected and clicked chats showed highlights
- Add updateSelectionAndActive() method to properly update all row styling when using cached list
- Convert dynamic imports to static imports for cleaner code:
  - ChatListManager.ts: destroyConversationScrollBox
  - SessionCreate.ts: showQRCode
  - index.ts: setRenderer, showQRCode, chatListManager, getClient
@muhammedaksam muhammedaksam merged commit 18da528 into main Dec 19, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant