Revert driller
This reverts commitcec49c83bd. Revert "update NoteContentsDriller to NoteContext" This reverts commit65bd6a65f9. Revert "introduce the driller" This reverts commit95d618e7fe.
This commit is contained in:
@@ -6,7 +6,7 @@ pub use edit::EditProfileView;
|
||||
use egui::load::TexturePoll;
|
||||
use egui::{vec2, Color32, Label, Layout, Rect, RichText, Rounding, ScrollArea, Sense, Stroke};
|
||||
use enostr::Pubkey;
|
||||
use nostrdb::{ProfileRecord, Transaction};
|
||||
use nostrdb::{Ndb, ProfileRecord, Transaction};
|
||||
pub use picture::ProfilePic;
|
||||
pub use preview::ProfilePreview;
|
||||
use tracing::error;
|
||||
@@ -16,22 +16,26 @@ use crate::{
|
||||
colors, images,
|
||||
profile::get_display_name,
|
||||
timeline::{TimelineCache, TimelineKind},
|
||||
ui::timeline::{tabs_ui, TimelineTabView},
|
||||
ui::{
|
||||
note::NoteOptions,
|
||||
timeline::{tabs_ui, TimelineTabView},
|
||||
},
|
||||
NostrName,
|
||||
};
|
||||
|
||||
use notedeck::{Accounts, MuteFun, NotedeckTextStyle, UnknownIds};
|
||||
use notedeck::{Accounts, Images, MuteFun, NoteCache, NotedeckTextStyle, UnknownIds};
|
||||
|
||||
use super::note::contents::NoteContext;
|
||||
|
||||
pub struct ProfileView<'a, 'd> {
|
||||
pub struct ProfileView<'a> {
|
||||
pubkey: &'a Pubkey,
|
||||
accounts: &'a Accounts,
|
||||
col_id: usize,
|
||||
timeline_cache: &'a mut TimelineCache,
|
||||
note_options: NoteOptions,
|
||||
ndb: &'a Ndb,
|
||||
note_cache: &'a mut NoteCache,
|
||||
img_cache: &'a mut Images,
|
||||
unknown_ids: &'a mut UnknownIds,
|
||||
is_muted: &'a MuteFun,
|
||||
note_context: &'a mut NoteContext<'d>,
|
||||
}
|
||||
|
||||
pub enum ProfileViewAction {
|
||||
@@ -39,25 +43,31 @@ pub enum ProfileViewAction {
|
||||
Note(NoteAction),
|
||||
}
|
||||
|
||||
impl<'a, 'd> ProfileView<'a, 'd> {
|
||||
impl<'a> ProfileView<'a> {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
pubkey: &'a Pubkey,
|
||||
accounts: &'a Accounts,
|
||||
col_id: usize,
|
||||
timeline_cache: &'a mut TimelineCache,
|
||||
ndb: &'a Ndb,
|
||||
note_cache: &'a mut NoteCache,
|
||||
img_cache: &'a mut Images,
|
||||
unknown_ids: &'a mut UnknownIds,
|
||||
is_muted: &'a MuteFun,
|
||||
note_context: &'a mut NoteContext<'d>,
|
||||
note_options: NoteOptions,
|
||||
) -> Self {
|
||||
ProfileView {
|
||||
pubkey,
|
||||
accounts,
|
||||
col_id,
|
||||
timeline_cache,
|
||||
ndb,
|
||||
note_cache,
|
||||
img_cache,
|
||||
unknown_ids,
|
||||
note_options,
|
||||
is_muted,
|
||||
note_context,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,12 +78,8 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
||||
.id_salt(scroll_id)
|
||||
.show(ui, |ui| {
|
||||
let mut action = None;
|
||||
let txn = Transaction::new(self.note_context.ndb).expect("txn");
|
||||
if let Ok(profile) = self
|
||||
.note_context
|
||||
.ndb
|
||||
.get_profile_by_pubkey(&txn, self.pubkey.bytes())
|
||||
{
|
||||
let txn = Transaction::new(self.ndb).expect("txn");
|
||||
if let Ok(profile) = self.ndb.get_profile_by_pubkey(&txn, self.pubkey.bytes()) {
|
||||
if self.profile_body(ui, profile) {
|
||||
action = Some(ProfileViewAction::EditProfile);
|
||||
}
|
||||
@@ -81,8 +87,8 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
||||
let profile_timeline = self
|
||||
.timeline_cache
|
||||
.notes(
|
||||
self.note_context.ndb,
|
||||
self.note_context.note_cache,
|
||||
self.ndb,
|
||||
self.note_cache,
|
||||
&txn,
|
||||
&TimelineKind::Profile(*self.pubkey),
|
||||
)
|
||||
@@ -94,10 +100,10 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
||||
let reversed = false;
|
||||
// poll for new notes and insert them into our existing notes
|
||||
if let Err(e) = profile_timeline.poll_notes_into_view(
|
||||
self.note_context.ndb,
|
||||
self.ndb,
|
||||
&txn,
|
||||
self.unknown_ids,
|
||||
self.note_context.note_cache,
|
||||
self.note_cache,
|
||||
reversed,
|
||||
) {
|
||||
error!("Profile::poll_notes_into_view: {e}");
|
||||
@@ -106,9 +112,12 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
||||
if let Some(note_action) = TimelineTabView::new(
|
||||
profile_timeline.current_view(),
|
||||
reversed,
|
||||
self.note_options,
|
||||
&txn,
|
||||
self.ndb,
|
||||
self.note_cache,
|
||||
self.img_cache,
|
||||
self.is_muted,
|
||||
self.note_context,
|
||||
)
|
||||
.show(ui)
|
||||
{
|
||||
@@ -140,12 +149,9 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
||||
ui.horizontal(|ui| {
|
||||
ui.put(
|
||||
pfp_rect,
|
||||
ProfilePic::new(
|
||||
self.note_context.img_cache,
|
||||
get_profile_url(Some(&profile)),
|
||||
)
|
||||
.size(size)
|
||||
.border(ProfilePic::border_stroke(ui)),
|
||||
ProfilePic::new(self.img_cache, get_profile_url(Some(&profile)))
|
||||
.size(size)
|
||||
.border(ProfilePic::border_stroke(ui)),
|
||||
);
|
||||
|
||||
if ui.add(copy_key_widget(&pfp_rect)).clicked() {
|
||||
|
||||
Reference in New Issue
Block a user