feat(ui): message-list date separators (Today / Yesterday / date) (LC-244) #299
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/lc-244-date-separators"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implements LC-244 (subtask LC-245). Inserts a separator row between messages whose UTC calendar day differs, labeled "Today" / "Yesterday" / an absolute date. Mirrors the existing unread-divider pattern and gives the message list the day structure it lacked.
Implementation
Server-side initial render. The room and DM page builders (
routes/room.rs,routes/dm.rs- the loops that already computeis_follow_up/show_unread_divider) track the previous rendered message's UTC day and set a newMessageView.day_labelon the first message and on each day change.views::room::day_label_formaps a UTC date to a localized Today/Yesterday (room-day-today/room-day-yesterday, en + es) or an English long-form date.room/message.htmlrenders the label as arole="separator"row above the message and carriesdata-lc-dayon every row.Live arrivals. Per-message WS fragments keep
day_label = None(no server divider appended) but every row carriesdata-lc-day. A hook inpartials/auto_scroll.html, on a new message appended to#messages, compares the appended row's UTC day to the previous message row's and inserts the same divider markup when they differ - labeled with the localized "Today" string carried on#messages(live sends are always today UTC). Inserted before the follow-to-bottom scroll so a pinned viewer stays at the true bottom; skipped when a divider already precedes the row.Decisions (per the ticket)
Scope
Rooms and DMs (shared
room/messages.html+message.html). Thread panel out of scope.Tests
data-lc-dayon a day change; exactly one divider for same-day messages.data-lc-dayattribute (diff verified to be only that attribute).just testandjust test-saasgreen; clippy + fmt clean.No operator-visible surface, so no
[operator-action]marker.🤖 Generated with Claude Code
Insert a separator row between messages whose UTC calendar day differs, labeled "Today" / "Yesterday" / an absolute date ("June 9, 2026"). Mirrors the existing unread-divider pattern and gives the message list day structure it lacked. Server-side initial render: the room and DM page builders (routes/room.rs and routes/dm.rs, the loops that already compute is_follow_up / show_unread_divider) track the previous rendered message's UTC day and set a new MessageView.day_label on the first message and on each day change. day_label_for (views/room.rs) maps a UTC date to a localized Today/Yesterday (Fluent room-day-today / room-day-yesterday, en + es) or an English long-form date. message.html renders the label as a role="separator" row above the message and carries data-lc-day on every row. Live arrivals: the per-message WS fragments keep day_label = None (so no server divider is appended), but every row carries data-lc-day. A hook in partials/auto_scroll.html, on a new message appended to #messages, compares the appended row's UTC day to the previous message row's and inserts the same divider markup when they differ, labeled with the localized "Today" string carried on #messages (live sends are always today UTC). Inserted before the follow-to-bottom scroll so a pinned viewer stays at the true bottom; no duplicate when a divider already precedes the row. Day boundaries are UTC to match the app's existing UTC inline timestamps; viewer-local boundaries and month-name localization are deferred to a future timezone pass that would localize both. Deleting the only message of a day may leave a stranded divider until the next full render (accepted for v1). Tests: server render asserts a divider with the right labels and data-lc-day on a day change, and exactly one divider for same-day messages; LC-77 render fixtures regenerated to capture the new data-lc-day attribute (verified the diff is only that attribute). just test and just test-saas green; clippy + fmt clean. #LC-244 #LC-245 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>