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 <noreply@anthropic.com>
This commit is contained in:
@@ -1022,9 +1022,21 @@ void RenderChatTab(App* app)
|
|||||||
dl->AddText(nameFont, nameSz, ImVec2(textX, p.y + pad),
|
dl->AddText(nameFont, nameSz, ImVec2(textX, p.y + pad),
|
||||||
c.hidden ? material::OnSurfaceMedium() : material::OnSurface(), c.peerName.c_str());
|
c.hidden ? material::OnSurfaceMedium() : material::OnSurface(), c.peerName.c_str());
|
||||||
dl->PopClipRect();
|
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).
|
// Preview (bottom, clipped to the text column, muted).
|
||||||
const std::string preview = previewOf(c.lastBody);
|
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),
|
dl->AddText(metaFont, metaSz, ImVec2(textX, p.y + rowH - pad - metaSz),
|
||||||
material::OnSurfaceMedium(), preview.c_str());
|
material::OnSurfaceMedium(), preview.c_str());
|
||||||
dl->PopClipRect();
|
dl->PopClipRect();
|
||||||
|
|||||||
@@ -232,6 +232,7 @@ void I18n::loadBuiltinEnglish()
|
|||||||
strings_["chat_empty_hint"] = "No conversations yet. Messages you receive will appear here.";
|
strings_["chat_empty_hint"] = "No conversations yet. Messages you receive will appear here.";
|
||||||
strings_["chat_you"] = "You";
|
strings_["chat_you"] = "You";
|
||||||
strings_["chat_contact_request"] = "contact request";
|
strings_["chat_contact_request"] = "contact request";
|
||||||
|
strings_["chat_request_pill"] = "Request";
|
||||||
strings_["chat_request_title"] = "New contact 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_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";
|
strings_["chat_request_accept"] = "Accept";
|
||||||
|
|||||||
Reference in New Issue
Block a user