Negotiation Inbox: Unread Message Badges in Sidebar
Negotiation Inbox: Unread Message Badges in Sidebar
Available from: v0.1.134
Overview
Agents and landlords working across multiple active negotiation threads can now see at a glance — directly from the sidebar — how many unread tenant messages require a response, separate from the count of open disputes.
This update surfaces two distinct signals on the Negotiation nav item and ensures the same unread count is available on mobile.
Background: Two Different Metrics
The Negotiation section of the dashboard tracks two related but independent concepts:
| Metric | What it means | Badge colour |
|---|---|---|
| Open disputes | Threads where a formal dispute is currently open | 🟡 Amber |
| Unread messages | Messages from tenants not yet read by the agent | 🔴 Red |
Before v0.1.134, the sidebar badge only showed open disputes (openDisputes). This meant an agent could have several unread tenant replies in active threads and receive no distinct visual signal — the badge count would not change unless the dispute status itself changed.
What's New
Dual Badges on the Negotiation Nav Item
The Negotiation sidebar nav item now displays up to two badges at the same time:
- Red badge — total count of unread negotiation messages across all open threads (
unreadNegotiationMessages). This is the primary signal for inbox urgency. - Amber badge — total count of open disputes (
openDisputes). This reflects workflow status rather than communication urgency.
If either count is zero, its badge is hidden automatically.
New unreadNegotiationMessages Field
The WorkQueueSummary type returned by the dashboard.workQueue tRPC query now includes:
unreadNegotiationMessages: number
This field aggregates the total unread message count across all active negotiation threads. It is kept in sync with the existing 8-second polling interval already used by NegotiationInbox, so the sidebar badge updates without requiring a page reload.
Mobile Bottom Tabs
The unread negotiation message count is now also displayed on the Deposits tab within MobileBottomTabs, giving mobile users the same urgency signal as desktop users see in the sidebar.
How Unread Count Is Calculated
- A message is counted as unread if it was sent by a tenant (or third party) and has not been opened by the authenticated agent/landlord user.
- The count spans all open threads — not just threads currently visible in the viewport.
- The count is refreshed every 8 seconds via the polling mechanism in
NegotiationInbox. - Individual thread rows within
NegotiationInboxcontinue to show per-thread unread badges as before — the sidebar badge is the aggregate of these.
Affected Components
| Component | Change |
|---|---|
src/components/sidebar-nav.tsx | Added dual-badge support (red + amber) to Negotiation nav item |
WorkQueueSummary type | Added unreadNegotiationMessages: number field |
dashboard.workQueue tRPC query | Populates new unreadNegotiationMessages field |
MobileBottomTabs | Surfaces unread count on Deposits tab |
Notes
- The
NegotiationInboxpolling behaviour (every 8 seconds) is unchanged. - Per-thread
ThreadRowunread badges are unchanged. - The change is purely additive — no existing badge behaviour has been removed.