commit 143278117d3ce16882447d71f49da77aded7863c
parent 2d939c6b07da10043d1e9e08bd511d90fd7e4690
Author: William Casarin <jb55@jb55.com>
Date: Thu, 4 Dec 2025 01:07:21 -0800
Merge add profile column option by fernando #1212
Fernando López Guevara (1):
feat(profile_view): add profile column from context options only-
when it’s missing
Diffstat:
4 files changed, 51 insertions(+), 6 deletions(-)
diff --git a/crates/notedeck/src/profile/context.rs b/crates/notedeck/src/profile/context.rs
@@ -1,6 +1,7 @@
use enostr::Pubkey;
pub enum ProfileContextSelection {
+ AddProfileColumn,
CopyLink,
ViewAs,
}
@@ -20,7 +21,7 @@ impl ProfileContextSelection {
ctx.copy_text(format!("https://damus.io/{npub}"));
}
- ProfileContextSelection::ViewAs => {
+ ProfileContextSelection::ViewAs | ProfileContextSelection::AddProfileColumn => {
// handled separately in profile.rs
}
}
diff --git a/crates/notedeck_columns/src/nav.rs b/crates/notedeck_columns/src/nav.rs
@@ -568,9 +568,15 @@ fn process_render_nav_action(
return None;
}
}
- RenderNavAction::ProfileAction(profile_action) => {
- profile_action.process_profile_action(ui.ctx(), ctx.ndb, ctx.pool, ctx.accounts)
- }
+ RenderNavAction::ProfileAction(profile_action) => profile_action.process_profile_action(
+ app,
+ ctx.path,
+ ctx.i18n,
+ 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,10 +1,10 @@
use enostr::{FilledKeypair, FullKeypair, ProfileState, Pubkey, RelayPool};
use nostrdb::{Ndb, Note, NoteBuildOptions, NoteBuilder, Transaction};
-use notedeck::{Accounts, ContactState, ProfileContext};
+use notedeck::{Accounts, ContactState, DataPath, Localization, ProfileContext};
use tracing::info;
-use crate::{nav::RouterAction, route::Route};
+use crate::{column::Column, nav::RouterAction, route::Route, storage, Damus};
pub struct SaveProfileChanges {
pub kp: FullKeypair,
@@ -44,6 +44,9 @@ pub enum ProfileAction {
impl ProfileAction {
pub fn process_profile_action(
&self,
+ app: &mut Damus,
+ path: &DataPath,
+ i18n: &mut Localization,
ctx: &egui::Context,
ndb: &Ndb,
pool: &mut RelayPool,
@@ -85,6 +88,29 @@ impl ProfileAction {
ProfileContextSelection::ViewAs => {
Some(RouterAction::SwitchAccount(profile_context.profile))
}
+ ProfileContextSelection::AddProfileColumn => {
+ let timeline_route = Route::Timeline(
+ crate::timeline::TimelineKind::Profile(profile_context.profile),
+ );
+
+ let missing_column = {
+ let deck_columns = app.columns(accounts).columns();
+ let router_head = &[timeline_route.clone()];
+ !deck_columns
+ .iter()
+ .any(|column| column.router.routes().starts_with(router_head))
+ };
+
+ if missing_column {
+ let column = Column::new(vec![timeline_route]);
+
+ app.columns_mut(i18n, accounts).add_column(column);
+
+ storage::save_decks_cache(path, &app.decks_cache);
+ }
+
+ None
+ }
_ => {
profile_context
.selection
diff --git a/crates/notedeck_ui/src/profile/context.rs b/crates/notedeck_ui/src/profile/context.rs
@@ -35,6 +35,18 @@ impl ProfileContextWidget {
ui.set_max_width(100.0);
if ui
+ .button(tr!(
+ i18n,
+ "Add profile column",
+ "Add new column to current deck from profile context menu"
+ ))
+ .clicked()
+ {
+ context_selection = Some(ProfileContextSelection::AddProfileColumn);
+ ui.close_menu();
+ }
+
+ if ui
.button(tr!(i18n, "View as", "Switch active user to this profile"))
.clicked()
{