add contact context menu and invites
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousDelivery / windows (push) Has been cancelled
ContinuousDelivery / windows-asan (push) Has been cancelled
ContinuousDelivery / dumpsyms (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled
ContinuousIntegration / linux (push) Has been cancelled
ContinuousIntegration / linux-arm (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled

This commit is contained in:
Green Sky
2025-08-04 01:06:24 +02:00
parent 0c9fb6b322
commit 69481869d3
3 changed files with 34 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
#include "./contact_list.hpp"
#include <solanaceae/contact/components.hpp>
#include <solanaceae/contact/contact_model4.hpp>
#include <solanaceae/message3/components.hpp>
#include <solanaceae/util/utils.hpp>
#include <solanaceae/util/time.hpp>
@@ -325,6 +326,7 @@ bool renderContactList(
) {
bool selection_changed {false};
for (const Contact4 cv : view) {
ImGui::PushID(entt::to_integral(cv));
ContactHandle4 c{cr, cv};
const bool selected = selected_c == c;
@@ -342,6 +344,36 @@ bool renderContactList(
selected_c = c;
selection_changed = true;
}
// TODO: move to own function
if (ImGui::BeginPopupContextItem("contact_context")) {
if (c.all_of<Contact::Components::ContactModel>()) {
const auto& cm = c.get<Contact::Components::ContactModel>();
// TODO: make hookable
if (ImGui::BeginMenu("invite to")) {
// big?
//for (const auto& c : cr.view<Contact::Components::TagBig>()) {
// // filter
// if (cr.any_of<Contact::Components::RequestIncoming, Contact::Components::TagRequestOutgoing>(c)) {
// continue;
// }
for (auto [tov] : cr.storage<Contact4>().each()) {
if (cm->canInvite(c, tov)) {
ContactHandle4 to{cr, tov};
if (renderContactBig(th, contact_tc, to, 1, false, true, false)) {
// TODO: error check
cm->invite(c, tov);
}
}
}
ImGui::EndMenu();
}
}
ImGui::EndPopup();
}
ImGui::PopID();
}
return selection_changed;
}