feat(contacts,chat): a "Message" action linking Contacts to Chat

- Contacts: a "Message" context-menu item for shielded (z) contacts hands the
  address to the Chat tab (new OpenChatNewConversation entry point) and switches
  there with the New-conversation dialog prefilled; disabled with a reason for
  transparent-only contacts. (Kept to the safe context-menu + picker path, not
  the hand-drawn 4-slot row action cluster, to avoid mis-wiring the destructive
  Delete slot.)
- Chat: the New-conversation picker no longer silently hides transparent
  contacts — they're shown disabled with a "needs a shielded address to chat"
  tooltip instead of vanishing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-10-18 09:52:21 -05:00
co-authored by Claude Opus 4.8
parent 408393a547
commit ae16c06d24
4 changed files with 66 additions and 5 deletions
+18
View File
@@ -18,6 +18,7 @@
#include "../../util/platform.h"
#include "image_picker.h"
#include "transactions_tab.h"
#include "chat_tab.h" // OpenChatNewConversation — Contacts "Message" action
#include "../sidebar.h"
#include "../layout.h"
#include "imgui.h"
@@ -537,6 +538,15 @@ void RenderContactsTab(App* app)
SetTransactionsAddressFilter(book.entries()[s_selected_index].address);
app->setCurrentPage(ui::NavPage::History);
};
// Message a contact in Chat — only z-contacts (chat needs a shielded address to carry encrypted
// memos). Mirrors doViewTransactions: hand the address to the Chat tab and switch there.
auto doMessage = [&]() {
if (!selValid()) return;
const auto& e = book.entries()[s_selected_index];
if (!isShieldedAddr(e.address)) return;
OpenChatNewConversation(e.address);
app->setCurrentPage(ui::NavPage::Chat);
};
// Add/edit form — a modal popup layered over the tab, with a live contact preview and an avatar
// picker (default Z/T badge, a Material icon, or a custom image via the in-app image picker).
@@ -1465,6 +1475,14 @@ void RenderContactsTab(App* app)
if (ImGui::BeginPopup("##contactCtx")) {
if (ImGui::MenuItem(TR("copy_address"))) doCopy();
if (ImGui::MenuItem(TR("view_transactions"))) doViewTransactions();
#if DRAGONX_ENABLE_CHAT
{
const bool canMsg = selValid() && isShieldedAddr(book.entries()[s_selected_index].address);
if (ImGui::MenuItem(TR("contacts_message"), nullptr, false, canMsg)) doMessage();
if (!canMsg && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled))
material::Tooltip("%s", TR("contacts_message_needs_z"));
}
#endif
if (ImGui::MenuItem(TR("edit"))) openEdit();
ImGui::Separator();
if (ImGui::MenuItem(TR("delete"))) doDelete();