commit 14b35c45c2cfb3c5f5bbb5061c8a4837e00d14ac
parent 813b92a414b9e5ca4997d6bc68a4b37411610157
Author: kernelkind <kernelkind@gmail.com>
Date: Sun, 5 Oct 2025 15:37:14 -0400
render profile context button
Signed-off-by: kernelkind <kernelkind@gmail.com>
Diffstat:
4 files changed, 35 insertions(+), 5 deletions(-)
diff --git a/crates/notedeck_columns/src/nav.rs b/crates/notedeck_columns/src/nav.rs
@@ -505,7 +505,7 @@ fn process_render_nav_action(
}
}
RenderNavAction::ProfileAction(profile_action) => {
- profile_action.process_profile_action(ctx.ndb, ctx.pool, ctx.accounts)
+ profile_action.process_profile_action(ui.ctx(), ctx.ndb, ctx.pool, ctx.accounts)
}
RenderNavAction::WalletAction(wallet_action) => {
wallet_action.process(ctx.accounts, ctx.global_wallet)
diff --git a/crates/notedeck_columns/src/profile.rs b/crates/notedeck_columns/src/profile.rs
@@ -1,7 +1,7 @@
use enostr::{FilledKeypair, FullKeypair, ProfileState, Pubkey, RelayPool};
use nostrdb::{Ndb, Note, NoteBuildOptions, NoteBuilder, Transaction};
-use notedeck::{Accounts, ContactState};
+use notedeck::{Accounts, ContactState, ProfileContext};
use tracing::info;
use crate::{nav::RouterAction, route::Route};
@@ -38,11 +38,13 @@ pub enum ProfileAction {
SaveChanges(SaveProfileChanges),
Follow(Pubkey),
Unfollow(Pubkey),
+ Context(ProfileContext),
}
impl ProfileAction {
pub fn process_profile_action(
&self,
+ ctx: &egui::Context,
ndb: &Ndb,
pool: &mut RelayPool,
accounts: &Accounts,
@@ -77,6 +79,12 @@ impl ProfileAction {
Self::send_unfollow_user_event(ndb, pool, accounts, target_key);
None
}
+ ProfileAction::Context(profile_context) => {
+ profile_context
+ .selection
+ .process(ctx, &profile_context.profile);
+ None
+ }
}
}
diff --git a/crates/notedeck_columns/src/timeline/route.rs b/crates/notedeck_columns/src/timeline/route.rs
@@ -129,5 +129,8 @@ pub fn render_profile_route(
ui::profile::ProfileViewAction::Unfollow(target_key) => Some(
RenderNavAction::ProfileAction(ProfileAction::Unfollow(target_key)),
),
+ ui::profile::ProfileViewAction::Context(profile_context_selection) => Some(
+ RenderNavAction::ProfileAction(ProfileAction::Context(profile_context_selection)),
+ ),
})
}
diff --git a/crates/notedeck_columns/src/ui/profile/mod.rs b/crates/notedeck_columns/src/ui/profile/mod.rs
@@ -4,8 +4,8 @@ pub use edit::EditProfileView;
use egui::{vec2, Color32, CornerRadius, Layout, Rect, RichText, ScrollArea, Sense, Stroke};
use enostr::Pubkey;
use nostrdb::{ProfileRecord, Transaction};
-use notedeck::{tr, Localization};
-use notedeck_ui::profile::follow_button;
+use notedeck::{tr, Localization, ProfileContext};
+use notedeck_ui::profile::{context::ProfileContextWidget, follow_button};
use robius_open::Uri;
use tracing::error;
@@ -38,6 +38,7 @@ pub enum ProfileViewAction {
Note(NoteAction),
Unfollow(Pubkey),
Follow(Pubkey),
+ Context(ProfileContext),
}
struct ProfileScrollResponse {
@@ -148,7 +149,7 @@ fn profile_body(
) -> Option<ProfileViewAction> {
let mut action = None;
ui.vertical(|ui| {
- banner(
+ let banner_resp = banner(
ui,
profile
.map(|p| p.record().profile())
@@ -156,6 +157,24 @@ fn profile_body(
120.0,
);
+ let place_context = {
+ let mut rect = banner_resp.rect;
+ let size = 24.0;
+ rect.set_bottom(rect.top() + size);
+ rect.set_left(rect.right() - size);
+ rect.translate(vec2(-16.0, 16.0))
+ };
+
+ let context_resp = ProfileContextWidget::new(place_context).context_button(ui, pubkey);
+ if let Some(selection) =
+ ProfileContextWidget::context_menu(ui, note_context.i18n, context_resp)
+ {
+ action = Some(ProfileViewAction::Context(ProfileContext {
+ profile: *pubkey,
+ selection,
+ }));
+ }
+
let padding = 12.0;
notedeck_ui::padding(padding, ui, |ui| {
let mut pfp_rect = ui.available_rect_before_wrap();