implement chat conversation view #3

Merged
alisson merged 8 commits from feat/impl-chat-view into master 2026-02-28 21:20:06 -03:00
Member

summary:

  • build out the full chat conversation experience — from opening a chat and displaying messages to infinite scroll, read receipts, presence tracking, and keyboard navigation. this replaces the stub ChatView with a production-ready component and refactors the surrounding architecture to support it.

changes:
-> chat view (chat_view.rs)

  • message display with ChatRow enum supporting message bubbles, date separators, and service events
  • bidirectional infinite scroll pagination with VecDeque-based cursor tracking (loads 120 initially, 70 per page, trims at 600)
  • go-to-bottom floating button with 350ms crossfade reveal
  • auto-focus message entry on chat open; Esc closes chat or returns focus to entry
  • chat header with presence status ("online" / "Last seen today at HH:MM")
  • mark-as-read on open

-> chat list (chat_list.rs)

  • replace full-list rebuilds with granular AddChat/UpdateChat operations
  • add selection suppress guard (Rc<Cell>) to prevent feedback loops during list mutations
  • track rows by JID in IndexMap

-> read receipts & presence (application.rs, client.rs)

  • send read receipts to WhatsApp grouped by sender
  • presence events flow from Client → Application → ChatView
  • chat struct gains available/last_seen fields; unread_count moves from struct field to async DB query

-> state & DB

  • remove RenderCache; ChatSelected uses in-memory lookup instead of DB
  • new DB methods: get_unread_count(), get_unread_messages(), mark_chat_read()
  • pagination queries with before/after timestamp support

-> styling

  • split monolithic style.scss into modular partials (_chat_list, _chat_view, _common, _session_view)
  • message bubble styles with vendor-prefixed border radius, incoming/outgoing variants
summary: - build out the full chat conversation experience — from opening a chat and displaying messages to infinite scroll, read receipts, presence tracking, and keyboard navigation. this replaces the stub ChatView with a production-ready component and refactors the surrounding architecture to support it. changes: -> chat view (chat_view.rs) - message display with ChatRow enum supporting message bubbles, date separators, and service events - bidirectional infinite scroll pagination with VecDeque-based cursor tracking (loads 120 initially, 70 per page, trims at 600) - go-to-bottom floating button with 350ms crossfade reveal - auto-focus message entry on chat open; Esc closes chat or returns focus to entry - chat header with presence status ("online" / "Last seen today at HH:MM") - mark-as-read on open -> chat list (chat_list.rs) - replace full-list rebuilds with granular AddChat/UpdateChat operations - add selection suppress guard (Rc<Cell<bool>>) to prevent feedback loops during list mutations - track rows by JID in IndexMap -> read receipts & presence (application.rs, client.rs) - send read receipts to WhatsApp grouped by sender - presence events flow from Client → Application → ChatView - chat struct gains available/last_seen fields; unread_count moves from struct field to async DB query -> state & DB - remove RenderCache; ChatSelected uses in-memory lookup instead of DB - new DB methods: get_unread_count(), get_unread_messages(), mark_chat_read() - pagination queries with before/after timestamp support -> styling - split monolithic style.scss into modular partials (_chat_list, _chat_view, _common, _session_view) - message bubble styles with vendor-prefixed border radius, incoming/outgoing variants
- add ChatView component with message bubbles, scroll tracking, and mark-as-read support.
- replace full-list rebuilds in ChatList with granular AddChat/UpdateChat operations and a selection guard to prevent feedback loops.
- remove RenderCache and RefCell from application state.
- eliminate the intermediate ChatMessageListItem struct by binding ChatMessage to the list view directly.
- fix sender_label append ordering, derive is_group at bind-time from chat_jid, and format timestamps lazily.
- also fix message bubble border radius, correct gitignore path for config.rs, and stop tracking the meson-generated config.rs.
- introduce ChatRow enum (Message, DateSeparator, ServiceEvent) to support service messages and date grouping in chat history.
- move format_date_label to utils.rs.
- split monolithic style.scss into modular partials for chat list, chat view, common, and session view.
- add chat title, service message, and vendor mixin-based bubble styling.
- send read receipts to WhatsApp when marking chats as read by collecting unread messages grouped by sender.
- also includes chat view UI refinements: i18n message placeholder, adjusted padding and sidebar width, removed undershoot classes, and improved list item properties.
- wrap the chat ScrolledWindow in a gtk::Overlay with a floating circular button that fades in when the user scrolls up.
- upgrade ChatView from SimpleAsyncComponent to AsyncComponent so scroll position changes flow through update_cmd, making is_at_bottom reactive for #[watch].
- the button uses a gtk::Revealer with a 350ms crossfade transition.
- scrolling up loads older messages progressively, scrolling down loads newer messages when the tail was trimmed.
- the go-to-bottom button reloads from the real latest.
- a VecDeque of row metadata tracks pagination cursors when rows are trimmed from either end.
opening a chat now grabs focus on the message entry. pressing
Esc while the entry is focused closes the chat; pressing Esc
while the scroll area is focused returns focus to the entry.

other changes:
- ChatOpen/ChatClosed output signals wired through to the application.
- split_view.set_show_content() for proper navigation on mobile.
- chat list selection clearing on close.
- sidebar width tweaked (300→280, 350→340).
- mark_read() refactor in the read receipt handler.
- focusable(false) moved from builder to bind phase.
feat: add user presence tracking with online status and last seen
Some checks are pending
CI / Rustfmt (pull_request) Waiting to run
CI / Flatpak (pull_request) Waiting to run
479a6b3dc2
- this covers the full scope: presence events flow from Client → Application → ChatView, the Chat struct gains available/last_seen fields, and the chat header displays "online" or "Last seen today/yesterday at HH:MM".
- also switches ChatSelected to use in-memory lookup instead of DB.
andrielfr 2026-02-28 20:18:56 -03:00
alisson force-pushed feat/impl-chat-view from 479a6b3dc2
Some checks are pending
CI / Rustfmt (pull_request) Waiting to run
CI / Flatpak (pull_request) Waiting to run
to cd7a070007
Some checks failed
CI / Rustfmt (pull_request) Has been cancelled
CI / Flatpak (pull_request) Has been cancelled
2026-02-28 20:51:22 -03:00
Compare
alisson merged commit cd7a070007 into master 2026-02-28 21:20:06 -03:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
AmanoTeam/Papo!3
No description provided.