From 2fdf33f99bbf7b8eb68229918a7c5f89cc313d34 Mon Sep 17 00:00:00 2001 From: DanS Date: Sun, 18 Oct 2026 18:27:44 -0500 Subject: [PATCH] feat(chat): "Request" pill on unsolicited conversations in the list The conversation list now marks a pending stranger request with a small "Request" pill (bottom-right of the row), so it's distinguishable before you open it; the preview text is clipped to the pill's left so they don't overlap. Completes the request-affordance pair with the in-thread Accept/Block card. Co-Authored-By: Claude Opus 4.8 --- src/ui/windows/chat_tab.cpp | 14 +++++++++++++- src/util/i18n.cpp | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/ui/windows/chat_tab.cpp b/src/ui/windows/chat_tab.cpp index dabae3f..3b75eec 100644 --- a/src/ui/windows/chat_tab.cpp +++ b/src/ui/windows/chat_tab.cpp @@ -1022,9 +1022,21 @@ void RenderChatTab(App* app) dl->AddText(nameFont, nameSz, ImVec2(textX, p.y + pad), c.hidden ? material::OnSurfaceMedium() : material::OnSurface(), c.peerName.c_str()); dl->PopClipRect(); + // Pending-request pill (bottom-right) for an unsolicited stranger; the preview is clipped to its left. + float previewRight = mx.x - pad; + if (c.pendingRequest) { + const char* rl = TR("chat_request_pill"); + const ImVec2 rs = metaFont->CalcTextSizeA(metaSz, FLT_MAX, 0.0f, rl); + const float px = 6.0f * dp, py = 1.0f * dp; + const ImVec2 pmax(mx.x - pad, p.y + rowH - pad + py); + const ImVec2 pmin(pmax.x - rs.x - 2.0f * px, pmax.y - rs.y - 2.0f * py); + dl->AddRectFilled(pmin, pmax, material::WithAlpha(material::Warning(), 60), (rs.y + 2.0f * py) * 0.5f); + dl->AddText(metaFont, metaSz, ImVec2(pmin.x + px, pmin.y + py), material::Warning(), rl); + previewRight = pmin.x - pad; + } // Preview (bottom, clipped to the text column, muted). const std::string preview = previewOf(c.lastBody); - dl->PushClipRect(ImVec2(textX, p.y), ImVec2(mx.x - pad, mx.y), true); + dl->PushClipRect(ImVec2(textX, p.y), ImVec2(std::max(textX, previewRight), mx.y), true); dl->AddText(metaFont, metaSz, ImVec2(textX, p.y + rowH - pad - metaSz), material::OnSurfaceMedium(), preview.c_str()); dl->PopClipRect(); diff --git a/src/util/i18n.cpp b/src/util/i18n.cpp index 44e3c97..b56d310 100644 --- a/src/util/i18n.cpp +++ b/src/util/i18n.cpp @@ -232,6 +232,7 @@ void I18n::loadBuiltinEnglish() strings_["chat_empty_hint"] = "No conversations yet. Messages you receive will appear here."; strings_["chat_you"] = "You"; strings_["chat_contact_request"] = "contact request"; + strings_["chat_request_pill"] = "Request"; strings_["chat_request_title"] = "New contact request"; strings_["chat_request_body"] = "This person isn't in your contacts. Accept to add them, or block to delete this conversation and ignore them."; strings_["chat_request_accept"] = "Accept";