commit 9c5ee1fec4528a187d0b1f58113bba7091342d0c
parent 1ce777c306283632581c4a5fac3e23d0c876cc7c
Author: kernelkind <kernelkind@gmail.com>
Date: Thu, 11 Dec 2025 13:12:58 -0600
refactor(ContactsListView): migrate away from NoteContext
it's unnecessary
Signed-off-by: kernelkind <kernelkind@gmail.com>
Diffstat:
2 files changed, 29 insertions(+), 23 deletions(-)
diff --git a/crates/notedeck_columns/src/nav.rs b/crates/notedeck_columns/src/nav.rs
@@ -1001,13 +1001,19 @@ fn render_nav_body(
(txn, contacts)
};
- ContactsListView::new(ContactsCollection::Vec(&contacts), &mut note_context, &txn)
- .ui(ui)
- .map_output(|action| match action {
- ContactsListAction::OpenProfile(pk) => {
- RenderNavAction::NoteAction(NoteAction::Profile(pk))
- }
- })
+ ContactsListView::new(
+ ContactsCollection::Vec(&contacts),
+ note_context.jobs,
+ note_context.ndb,
+ note_context.img_cache,
+ &txn,
+ )
+ .ui(ui)
+ .map_output(|action| match action {
+ ContactsListAction::OpenProfile(pk) => {
+ RenderNavAction::NoteAction(NoteAction::Profile(pk))
+ }
+ })
}
Route::FollowedBy(_pubkey) => DragResponse::none(),
Route::Wallet(wallet_type) => {
diff --git a/crates/notedeck_ui/src/contacts_list.rs b/crates/notedeck_ui/src/contacts_list.rs
@@ -3,12 +3,16 @@ use std::collections::HashSet;
use crate::ProfilePic;
use egui::{RichText, Sense};
use enostr::Pubkey;
-use nostrdb::Transaction;
-use notedeck::{name::get_display_name, profile::get_profile_url, DragResponse, NoteContext};
+use nostrdb::{Ndb, Transaction};
+use notedeck::{
+ name::get_display_name, profile::get_profile_url, DragResponse, Images, MediaJobSender,
+};
-pub struct ContactsListView<'a, 'd, 'txn> {
+pub struct ContactsListView<'a, 'txn> {
contacts: ContactsCollection<'a>,
- note_context: &'a mut NoteContext<'d>,
+ jobs: &'a MediaJobSender,
+ ndb: &'a Ndb,
+ img_cache: &'a mut Images,
txn: &'txn Transaction,
}
@@ -47,16 +51,20 @@ impl<'a> Iterator for ContactsIter<'a> {
}
}
-impl<'a, 'd, 'txn> ContactsListView<'a, 'd, 'txn> {
+impl<'a, 'txn> ContactsListView<'a, 'txn> {
pub fn new(
contacts: ContactsCollection<'a>,
- note_context: &'a mut NoteContext<'d>,
+ jobs: &'a MediaJobSender,
+ ndb: &'a Ndb,
+ img_cache: &'a mut Images,
txn: &'txn Transaction,
) -> Self {
ContactsListView {
contacts,
- note_context,
+ ndb,
+ img_cache,
txn,
+ jobs,
}
}
@@ -75,7 +83,6 @@ impl<'a, 'd, 'txn> ContactsListView<'a, 'd, 'txn> {
}
let profile = self
- .note_context
.ndb
.get_profile_by_pubkey(self.txn, contact_pubkey.bytes())
.ok();
@@ -95,14 +102,7 @@ impl<'a, 'd, 'txn> ContactsListView<'a, 'd, 'txn> {
child_ui.horizontal(|ui| {
ui.add_space(16.0);
- ui.add(
- &mut ProfilePic::new(
- self.note_context.img_cache,
- self.note_context.jobs,
- profile_url,
- )
- .size(48.0),
- );
+ ui.add(&mut ProfilePic::new(self.img_cache, self.jobs, profile_url).size(48.0));
ui.add_space(12.0);