feat(web-core): implement unread counters and new-messages divider
Some checks failed
CI / test (push) Failing after 19s

backend:

- add unread_count to ChatRead serialization

- compute unread_count per chat using message_receipts and hidden messages

web:

- add unread badges in chat list

- track unread boundary per chat in store

- show 'New messages' divider in message list

- update realtime flow to increment/clear unread on incoming events
This commit is contained in:
2026-03-08 01:43:27 +03:00
parent 7f15edcb4e
commit 4ffbfc1e83
8 changed files with 88 additions and 6 deletions

View File

@@ -135,9 +135,15 @@ export function ChatList() {
<div className="min-w-0 flex-1">
<div className="flex items-center justify-between gap-2">
<p className="truncate text-sm font-semibold">{chatLabel(chat)}</p>
<span className="shrink-0 text-[11px] text-slate-400">
{messagesByChat[chat.id]?.length ? "now" : ""}
</span>
{(chat.unread_count ?? 0) > 0 ? (
<span className="inline-flex min-w-5 items-center justify-center rounded-full bg-sky-500 px-1.5 py-0.5 text-[10px] font-semibold text-slate-950">
{chat.unread_count}
</span>
) : (
<span className="shrink-0 text-[11px] text-slate-400">
{messagesByChat[chat.id]?.length ? "now" : ""}
</span>
)}
</div>
<p className="truncate text-xs text-slate-400">{chat.type}</p>
</div>