add Accounts to NoteContext
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -4,6 +4,7 @@ mod context;
|
|||||||
pub use action::{MediaAction, NoteAction, ScrollInfo, ZapAction, ZapTargetAmount};
|
pub use action::{MediaAction, NoteAction, ScrollInfo, ZapAction, ZapTargetAmount};
|
||||||
pub use context::{BroadcastContext, ContextSelection, NoteContextSelection};
|
pub use context::{BroadcastContext, ContextSelection, NoteContextSelection};
|
||||||
|
|
||||||
|
use crate::Accounts;
|
||||||
use crate::JobPool;
|
use crate::JobPool;
|
||||||
use crate::UnknownIds;
|
use crate::UnknownIds;
|
||||||
use crate::{notecache::NoteCache, zaps::Zaps, Images};
|
use crate::{notecache::NoteCache, zaps::Zaps, Images};
|
||||||
@@ -17,6 +18,7 @@ use std::fmt;
|
|||||||
/// passed to inner UI elements, minimizing prop drilling.
|
/// passed to inner UI elements, minimizing prop drilling.
|
||||||
pub struct NoteContext<'d> {
|
pub struct NoteContext<'d> {
|
||||||
pub ndb: &'d Ndb,
|
pub ndb: &'d Ndb,
|
||||||
|
pub accounts: &'d Accounts,
|
||||||
pub img_cache: &'d mut Images,
|
pub img_cache: &'d mut Images,
|
||||||
pub note_cache: &'d mut NoteCache,
|
pub note_cache: &'d mut NoteCache,
|
||||||
pub zaps: &'d mut Zaps,
|
pub zaps: &'d mut Zaps,
|
||||||
|
|||||||
@@ -424,8 +424,10 @@ fn render_nav_body(
|
|||||||
col: usize,
|
col: usize,
|
||||||
inner_rect: egui::Rect,
|
inner_rect: egui::Rect,
|
||||||
) -> Option<RenderNavAction> {
|
) -> Option<RenderNavAction> {
|
||||||
|
let current_account_has_wallet = get_current_wallet(ctx.accounts, ctx.global_wallet).is_some();
|
||||||
let mut note_context = NoteContext {
|
let mut note_context = NoteContext {
|
||||||
ndb: ctx.ndb,
|
ndb: ctx.ndb,
|
||||||
|
accounts: ctx.accounts,
|
||||||
img_cache: ctx.img_cache,
|
img_cache: ctx.img_cache,
|
||||||
note_cache: ctx.note_cache,
|
note_cache: ctx.note_cache,
|
||||||
zaps: ctx.zaps,
|
zaps: ctx.zaps,
|
||||||
@@ -433,12 +435,11 @@ fn render_nav_body(
|
|||||||
job_pool: ctx.job_pool,
|
job_pool: ctx.job_pool,
|
||||||
unknown_ids: ctx.unknown_ids,
|
unknown_ids: ctx.unknown_ids,
|
||||||
clipboard: ctx.clipboard,
|
clipboard: ctx.clipboard,
|
||||||
current_account_has_wallet: get_current_wallet(ctx.accounts, ctx.global_wallet).is_some(),
|
current_account_has_wallet,
|
||||||
};
|
};
|
||||||
match top {
|
match top {
|
||||||
Route::Timeline(kind) => render_timeline_route(
|
Route::Timeline(kind) => render_timeline_route(
|
||||||
&mut app.timeline_cache,
|
&mut app.timeline_cache,
|
||||||
ctx.accounts,
|
|
||||||
kind,
|
kind,
|
||||||
col,
|
col,
|
||||||
app.note_options,
|
app.note_options,
|
||||||
@@ -449,7 +450,6 @@ fn render_nav_body(
|
|||||||
),
|
),
|
||||||
Route::Thread(selection) => render_thread_route(
|
Route::Thread(selection) => render_thread_route(
|
||||||
&mut app.threads,
|
&mut app.threads,
|
||||||
ctx.accounts,
|
|
||||||
selection,
|
selection,
|
||||||
col,
|
col,
|
||||||
app.note_options,
|
app.note_options,
|
||||||
@@ -602,7 +602,6 @@ fn render_nav_body(
|
|||||||
app.note_options,
|
app.note_options,
|
||||||
search_buffer,
|
search_buffer,
|
||||||
&mut note_context,
|
&mut note_context,
|
||||||
&(&ctx.accounts.get_selected_account().key).into(),
|
|
||||||
&mut app.jobs,
|
&mut app.jobs,
|
||||||
)
|
)
|
||||||
.show(ui)
|
.show(ui)
|
||||||
|
|||||||
@@ -6,13 +6,12 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use enostr::Pubkey;
|
use enostr::Pubkey;
|
||||||
use notedeck::{Accounts, MuteFun, NoteContext};
|
use notedeck::{MuteFun, NoteContext};
|
||||||
use notedeck_ui::{jobs::JobsCache, NoteOptions};
|
use notedeck_ui::{jobs::JobsCache, NoteOptions};
|
||||||
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn render_timeline_route(
|
pub fn render_timeline_route(
|
||||||
timeline_cache: &mut TimelineCache,
|
timeline_cache: &mut TimelineCache,
|
||||||
accounts: &mut Accounts,
|
|
||||||
kind: &TimelineKind,
|
kind: &TimelineKind,
|
||||||
col: usize,
|
col: usize,
|
||||||
note_options: NoteOptions,
|
note_options: NoteOptions,
|
||||||
@@ -32,10 +31,9 @@ pub fn render_timeline_route(
|
|||||||
let note_action = ui::TimelineView::new(
|
let note_action = ui::TimelineView::new(
|
||||||
kind,
|
kind,
|
||||||
timeline_cache,
|
timeline_cache,
|
||||||
&accounts.mutefun(),
|
¬e_context.accounts.mutefun(),
|
||||||
note_context,
|
note_context,
|
||||||
note_options,
|
note_options,
|
||||||
&(&accounts.get_selected_account().key).into(),
|
|
||||||
jobs,
|
jobs,
|
||||||
)
|
)
|
||||||
.ui(ui);
|
.ui(ui);
|
||||||
@@ -47,11 +45,10 @@ pub fn render_timeline_route(
|
|||||||
if depth > 1 {
|
if depth > 1 {
|
||||||
render_profile_route(
|
render_profile_route(
|
||||||
pubkey,
|
pubkey,
|
||||||
accounts,
|
|
||||||
timeline_cache,
|
timeline_cache,
|
||||||
col,
|
col,
|
||||||
ui,
|
ui,
|
||||||
&accounts.mutefun(),
|
¬e_context.accounts.mutefun(),
|
||||||
note_options,
|
note_options,
|
||||||
note_context,
|
note_context,
|
||||||
jobs,
|
jobs,
|
||||||
@@ -61,10 +58,9 @@ pub fn render_timeline_route(
|
|||||||
let note_action = ui::TimelineView::new(
|
let note_action = ui::TimelineView::new(
|
||||||
kind,
|
kind,
|
||||||
timeline_cache,
|
timeline_cache,
|
||||||
&accounts.mutefun(),
|
¬e_context.accounts.mutefun(),
|
||||||
note_context,
|
note_context,
|
||||||
note_options,
|
note_options,
|
||||||
&(&accounts.get_selected_account().key).into(),
|
|
||||||
jobs,
|
jobs,
|
||||||
)
|
)
|
||||||
.ui(ui);
|
.ui(ui);
|
||||||
@@ -78,7 +74,6 @@ pub fn render_timeline_route(
|
|||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn render_thread_route(
|
pub fn render_thread_route(
|
||||||
threads: &mut Threads,
|
threads: &mut Threads,
|
||||||
accounts: &mut Accounts,
|
|
||||||
selection: &ThreadSelection,
|
selection: &ThreadSelection,
|
||||||
col: usize,
|
col: usize,
|
||||||
mut note_options: NoteOptions,
|
mut note_options: NoteOptions,
|
||||||
@@ -94,9 +89,8 @@ pub fn render_thread_route(
|
|||||||
threads,
|
threads,
|
||||||
selection.selected_or_root(),
|
selection.selected_or_root(),
|
||||||
note_options,
|
note_options,
|
||||||
&accounts.mutefun(),
|
¬e_context.accounts.mutefun(),
|
||||||
note_context,
|
note_context,
|
||||||
&(&accounts.get_selected_account().key).into(),
|
|
||||||
jobs,
|
jobs,
|
||||||
)
|
)
|
||||||
.id_source(col)
|
.id_source(col)
|
||||||
@@ -107,7 +101,6 @@ pub fn render_thread_route(
|
|||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn render_profile_route(
|
pub fn render_profile_route(
|
||||||
pubkey: &Pubkey,
|
pubkey: &Pubkey,
|
||||||
accounts: &Accounts,
|
|
||||||
timeline_cache: &mut TimelineCache,
|
timeline_cache: &mut TimelineCache,
|
||||||
col: usize,
|
col: usize,
|
||||||
ui: &mut egui::Ui,
|
ui: &mut egui::Ui,
|
||||||
@@ -118,7 +111,6 @@ pub fn render_profile_route(
|
|||||||
) -> Option<RenderNavAction> {
|
) -> Option<RenderNavAction> {
|
||||||
let profile_view = ProfileView::new(
|
let profile_view = ProfileView::new(
|
||||||
pubkey,
|
pubkey,
|
||||||
accounts,
|
|
||||||
col,
|
col,
|
||||||
timeline_cache,
|
timeline_cache,
|
||||||
note_options,
|
note_options,
|
||||||
@@ -130,7 +122,8 @@ pub fn render_profile_route(
|
|||||||
|
|
||||||
if let Some(action) = profile_view {
|
if let Some(action) = profile_view {
|
||||||
match action {
|
match action {
|
||||||
ui::profile::ProfileViewAction::EditProfile => accounts
|
ui::profile::ProfileViewAction::EditProfile => note_context
|
||||||
|
.accounts
|
||||||
.get_full(pubkey)
|
.get_full(pubkey)
|
||||||
.map(|kp| RenderNavAction::ProfileAction(ProfileAction::Edit(kp.to_full()))),
|
.map(|kp| RenderNavAction::ProfileAction(ProfileAction::Edit(kp.to_full()))),
|
||||||
ui::profile::ProfileViewAction::Note(note_action) => {
|
ui::profile::ProfileViewAction::Note(note_action) => {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use egui::{
|
|||||||
widgets::text_edit::TextEdit,
|
widgets::text_edit::TextEdit,
|
||||||
Frame, Layout, Margin, Pos2, ScrollArea, Sense, TextBuffer,
|
Frame, Layout, Margin, Pos2, ScrollArea, Sense, TextBuffer,
|
||||||
};
|
};
|
||||||
use enostr::{FilledKeypair, FullKeypair, KeypairUnowned, NoteId, Pubkey, RelayPool};
|
use enostr::{FilledKeypair, FullKeypair, NoteId, Pubkey, RelayPool};
|
||||||
use nostrdb::{Ndb, Transaction};
|
use nostrdb::{Ndb, Transaction};
|
||||||
use notedeck_ui::{
|
use notedeck_ui::{
|
||||||
app_images,
|
app_images,
|
||||||
@@ -352,15 +352,9 @@ impl<'a, 'd> PostView<'a, 'd> {
|
|||||||
ui.vertical(|ui| {
|
ui.vertical(|ui| {
|
||||||
ui.set_max_width(avail_size.x * 0.8);
|
ui.set_max_width(avail_size.x * 0.8);
|
||||||
|
|
||||||
let zapping_acc = self
|
|
||||||
.note_context
|
|
||||||
.current_account_has_wallet
|
|
||||||
.then(|| KeypairUnowned::from(&self.poster));
|
|
||||||
|
|
||||||
render_note_preview(
|
render_note_preview(
|
||||||
ui,
|
ui,
|
||||||
self.note_context,
|
self.note_context,
|
||||||
zapping_acc.as_ref(),
|
|
||||||
txn,
|
txn,
|
||||||
id.bytes(),
|
id.bytes(),
|
||||||
nostrdb::NoteKey::new(0),
|
nostrdb::NoteKey::new(0),
|
||||||
@@ -793,6 +787,7 @@ mod preview {
|
|||||||
let txn = Transaction::new(app.ndb).expect("txn");
|
let txn = Transaction::new(app.ndb).expect("txn");
|
||||||
let mut note_context = NoteContext {
|
let mut note_context = NoteContext {
|
||||||
ndb: app.ndb,
|
ndb: app.ndb,
|
||||||
|
accounts: app.accounts,
|
||||||
img_cache: app.img_cache,
|
img_cache: app.img_cache,
|
||||||
note_cache: app.note_cache,
|
note_cache: app.note_cache,
|
||||||
zaps: app.zaps,
|
zaps: app.zaps,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use crate::ui::{
|
|||||||
note::{PostAction, PostResponse, PostType},
|
note::{PostAction, PostResponse, PostType},
|
||||||
};
|
};
|
||||||
|
|
||||||
use enostr::{FilledKeypair, KeypairUnowned, NoteId};
|
use enostr::{FilledKeypair, NoteId};
|
||||||
use notedeck::NoteContext;
|
use notedeck::NoteContext;
|
||||||
use notedeck_ui::jobs::JobsCache;
|
use notedeck_ui::jobs::JobsCache;
|
||||||
use notedeck_ui::{NoteOptions, NoteView, ProfilePic};
|
use notedeck_ui::{NoteOptions, NoteView, ProfilePic};
|
||||||
@@ -67,27 +67,16 @@ impl<'a, 'd> PostReplyView<'a, 'd> {
|
|||||||
let note_offset: i8 =
|
let note_offset: i8 =
|
||||||
pfp_offset - ProfilePic::medium_size() / 2 - NoteView::expand_size() / 2;
|
pfp_offset - ProfilePic::medium_size() / 2 - NoteView::expand_size() / 2;
|
||||||
|
|
||||||
let zapping_acc = self
|
|
||||||
.note_context
|
|
||||||
.current_account_has_wallet
|
|
||||||
.then(|| KeypairUnowned::from(&self.poster));
|
|
||||||
|
|
||||||
let quoted_note = egui::Frame::NONE
|
let quoted_note = egui::Frame::NONE
|
||||||
.outer_margin(egui::Margin::same(note_offset))
|
.outer_margin(egui::Margin::same(note_offset))
|
||||||
.show(ui, |ui| {
|
.show(ui, |ui| {
|
||||||
NoteView::new(
|
NoteView::new(self.note_context, self.note, self.note_options, self.jobs)
|
||||||
self.note_context,
|
.truncate(false)
|
||||||
zapping_acc.as_ref(),
|
.selectable_text(true)
|
||||||
self.note,
|
.actionbar(false)
|
||||||
self.note_options,
|
.medium_pfp(true)
|
||||||
self.jobs,
|
.options_button(true)
|
||||||
)
|
.show(ui)
|
||||||
.truncate(false)
|
|
||||||
.selectable_text(true)
|
|
||||||
.actionbar(false)
|
|
||||||
.medium_pfp(true)
|
|
||||||
.options_button(true)
|
|
||||||
.show(ui)
|
|
||||||
})
|
})
|
||||||
.inner;
|
.inner;
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use crate::{
|
|||||||
ui::timeline::{tabs_ui, TimelineTabView},
|
ui::timeline::{tabs_ui, TimelineTabView},
|
||||||
};
|
};
|
||||||
use notedeck::{
|
use notedeck::{
|
||||||
name::get_display_name, profile::get_profile_url, Accounts, IsFollowing, MuteFun, NoteAction,
|
name::get_display_name, profile::get_profile_url, IsFollowing, MuteFun, NoteAction,
|
||||||
NoteContext, NotedeckTextStyle,
|
NoteContext, NotedeckTextStyle,
|
||||||
};
|
};
|
||||||
use notedeck_ui::{
|
use notedeck_ui::{
|
||||||
@@ -24,7 +24,6 @@ use notedeck_ui::{
|
|||||||
|
|
||||||
pub struct ProfileView<'a, 'd> {
|
pub struct ProfileView<'a, 'd> {
|
||||||
pubkey: &'a Pubkey,
|
pubkey: &'a Pubkey,
|
||||||
accounts: &'a Accounts,
|
|
||||||
col_id: usize,
|
col_id: usize,
|
||||||
timeline_cache: &'a mut TimelineCache,
|
timeline_cache: &'a mut TimelineCache,
|
||||||
note_options: NoteOptions,
|
note_options: NoteOptions,
|
||||||
@@ -44,7 +43,6 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
|||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn new(
|
pub fn new(
|
||||||
pubkey: &'a Pubkey,
|
pubkey: &'a Pubkey,
|
||||||
accounts: &'a Accounts,
|
|
||||||
col_id: usize,
|
col_id: usize,
|
||||||
timeline_cache: &'a mut TimelineCache,
|
timeline_cache: &'a mut TimelineCache,
|
||||||
note_options: NoteOptions,
|
note_options: NoteOptions,
|
||||||
@@ -54,7 +52,6 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
|||||||
) -> Self {
|
) -> Self {
|
||||||
ProfileView {
|
ProfileView {
|
||||||
pubkey,
|
pubkey,
|
||||||
accounts,
|
|
||||||
col_id,
|
col_id,
|
||||||
timeline_cache,
|
timeline_cache,
|
||||||
note_options,
|
note_options,
|
||||||
@@ -118,7 +115,6 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
|||||||
&txn,
|
&txn,
|
||||||
self.is_muted,
|
self.is_muted,
|
||||||
self.note_context,
|
self.note_context,
|
||||||
&(&self.accounts.get_selected_account().key).into(),
|
|
||||||
self.jobs,
|
self.jobs,
|
||||||
)
|
)
|
||||||
.show(ui)
|
.show(ui)
|
||||||
@@ -179,7 +175,7 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
|||||||
ui.add_space(24.0);
|
ui.add_space(24.0);
|
||||||
|
|
||||||
let target_key = self.pubkey;
|
let target_key = self.pubkey;
|
||||||
let selected = self.accounts.get_selected_account();
|
let selected = self.note_context.accounts.get_selected_account();
|
||||||
|
|
||||||
let profile_type = if selected.key.secret_key.is_none() {
|
let profile_type = if selected.key.secret_key.is_none() {
|
||||||
ProfileType::ReadOnly
|
ProfileType::ReadOnly
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use egui::{vec2, Align, Color32, CornerRadius, RichText, Stroke, TextEdit};
|
use egui::{vec2, Align, Color32, CornerRadius, RichText, Stroke, TextEdit};
|
||||||
use enostr::{KeypairUnowned, NoteId, Pubkey};
|
use enostr::{NoteId, Pubkey};
|
||||||
use state::TypingType;
|
use state::TypingType;
|
||||||
|
|
||||||
use crate::{timeline::TimelineTab, ui::timeline::TimelineTabView};
|
use crate::{timeline::TimelineTab, ui::timeline::TimelineTabView};
|
||||||
@@ -27,7 +27,6 @@ pub struct SearchView<'a, 'd> {
|
|||||||
txn: &'a Transaction,
|
txn: &'a Transaction,
|
||||||
is_muted: &'a MuteFun,
|
is_muted: &'a MuteFun,
|
||||||
note_context: &'a mut NoteContext<'d>,
|
note_context: &'a mut NoteContext<'d>,
|
||||||
cur_acc: &'a KeypairUnowned<'a>,
|
|
||||||
jobs: &'a mut JobsCache,
|
jobs: &'a mut JobsCache,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +37,6 @@ impl<'a, 'd> SearchView<'a, 'd> {
|
|||||||
note_options: NoteOptions,
|
note_options: NoteOptions,
|
||||||
query: &'a mut SearchQueryState,
|
query: &'a mut SearchQueryState,
|
||||||
note_context: &'a mut NoteContext<'d>,
|
note_context: &'a mut NoteContext<'d>,
|
||||||
cur_acc: &'a KeypairUnowned<'a>,
|
|
||||||
jobs: &'a mut JobsCache,
|
jobs: &'a mut JobsCache,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@@ -47,7 +45,6 @@ impl<'a, 'd> SearchView<'a, 'd> {
|
|||||||
query,
|
query,
|
||||||
note_options,
|
note_options,
|
||||||
note_context,
|
note_context,
|
||||||
cur_acc,
|
|
||||||
jobs,
|
jobs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,7 +154,6 @@ impl<'a, 'd> SearchView<'a, 'd> {
|
|||||||
self.txn,
|
self.txn,
|
||||||
self.is_muted,
|
self.is_muted,
|
||||||
self.note_context,
|
self.note_context,
|
||||||
self.cur_acc,
|
|
||||||
self.jobs,
|
self.jobs,
|
||||||
)
|
)
|
||||||
.show(ui)
|
.show(ui)
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
use egui::InnerResponse;
|
use egui::InnerResponse;
|
||||||
use egui_virtual_list::VirtualList;
|
use egui_virtual_list::VirtualList;
|
||||||
use enostr::KeypairUnowned;
|
|
||||||
use nostrdb::{Note, Transaction};
|
use nostrdb::{Note, Transaction};
|
||||||
use notedeck::note::root_note_id_from_selected_id;
|
use notedeck::note::root_note_id_from_selected_id;
|
||||||
use notedeck::{MuteFun, NoteAction, NoteContext};
|
use notedeck::{MuteFun, NoteAction, NoteContext};
|
||||||
@@ -18,7 +17,6 @@ pub struct ThreadView<'a, 'd> {
|
|||||||
id_source: egui::Id,
|
id_source: egui::Id,
|
||||||
is_muted: &'a MuteFun,
|
is_muted: &'a MuteFun,
|
||||||
note_context: &'a mut NoteContext<'d>,
|
note_context: &'a mut NoteContext<'d>,
|
||||||
cur_acc: &'a KeypairUnowned<'a>,
|
|
||||||
jobs: &'a mut JobsCache,
|
jobs: &'a mut JobsCache,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,7 +28,6 @@ impl<'a, 'd> ThreadView<'a, 'd> {
|
|||||||
note_options: NoteOptions,
|
note_options: NoteOptions,
|
||||||
is_muted: &'a MuteFun,
|
is_muted: &'a MuteFun,
|
||||||
note_context: &'a mut NoteContext<'d>,
|
note_context: &'a mut NoteContext<'d>,
|
||||||
cur_acc: &'a KeypairUnowned<'a>,
|
|
||||||
jobs: &'a mut JobsCache,
|
jobs: &'a mut JobsCache,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let id_source = egui::Id::new("threadscroll_threadview");
|
let id_source = egui::Id::new("threadscroll_threadview");
|
||||||
@@ -41,7 +38,6 @@ impl<'a, 'd> ThreadView<'a, 'd> {
|
|||||||
id_source,
|
id_source,
|
||||||
is_muted,
|
is_muted,
|
||||||
note_context,
|
note_context,
|
||||||
cur_acc,
|
|
||||||
jobs,
|
jobs,
|
||||||
col: 0,
|
col: 0,
|
||||||
}
|
}
|
||||||
@@ -134,17 +130,11 @@ impl<'a, 'd> ThreadView<'a, 'd> {
|
|||||||
ui.colored_label(ui.visuals().error_fg_color, "LOADING NOTES");
|
ui.colored_label(ui.visuals().error_fg_color, "LOADING NOTES");
|
||||||
}
|
}
|
||||||
|
|
||||||
let zapping_acc = self
|
|
||||||
.note_context
|
|
||||||
.current_account_has_wallet
|
|
||||||
.then_some(self.cur_acc);
|
|
||||||
|
|
||||||
show_notes(
|
show_notes(
|
||||||
ui,
|
ui,
|
||||||
list,
|
list,
|
||||||
¬es,
|
¬es,
|
||||||
self.note_context,
|
self.note_context,
|
||||||
zapping_acc,
|
|
||||||
self.note_options,
|
self.note_options,
|
||||||
self.jobs,
|
self.jobs,
|
||||||
txn,
|
txn,
|
||||||
@@ -159,7 +149,6 @@ fn show_notes(
|
|||||||
list: &mut VirtualList,
|
list: &mut VirtualList,
|
||||||
thread_notes: &ThreadNotes,
|
thread_notes: &ThreadNotes,
|
||||||
note_context: &mut NoteContext<'_>,
|
note_context: &mut NoteContext<'_>,
|
||||||
zapping_acc: Option<&KeypairUnowned<'_>>,
|
|
||||||
flags: NoteOptions,
|
flags: NoteOptions,
|
||||||
jobs: &mut JobsCache,
|
jobs: &mut JobsCache,
|
||||||
txn: &Transaction,
|
txn: &Transaction,
|
||||||
@@ -190,7 +179,7 @@ fn show_notes(
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
let resp = note.show(note_context, zapping_acc, flags, jobs, ui);
|
let resp = note.show(note_context, flags, jobs, ui);
|
||||||
|
|
||||||
action = if cur_index == selected_note_index {
|
action = if cur_index == selected_note_index {
|
||||||
resp.action.and_then(strip_note_action)
|
resp.action.and_then(strip_note_action)
|
||||||
@@ -313,21 +302,14 @@ impl<'a> ThreadNote<'a> {
|
|||||||
fn show(
|
fn show(
|
||||||
&self,
|
&self,
|
||||||
note_context: &'a mut NoteContext<'_>,
|
note_context: &'a mut NoteContext<'_>,
|
||||||
zapping_acc: Option<&'a KeypairUnowned<'a>>,
|
|
||||||
flags: NoteOptions,
|
flags: NoteOptions,
|
||||||
jobs: &'a mut JobsCache,
|
jobs: &'a mut JobsCache,
|
||||||
ui: &mut egui::Ui,
|
ui: &mut egui::Ui,
|
||||||
) -> NoteResponse {
|
) -> NoteResponse {
|
||||||
let inner = notedeck_ui::padding(8.0, ui, |ui| {
|
let inner = notedeck_ui::padding(8.0, ui, |ui| {
|
||||||
NoteView::new(
|
NoteView::new(note_context, &self.note, self.options(flags), jobs)
|
||||||
note_context,
|
.unread_indicator(self.unread_and_have_replies)
|
||||||
zapping_acc,
|
.show(ui)
|
||||||
&self.note,
|
|
||||||
self.options(flags),
|
|
||||||
jobs,
|
|
||||||
)
|
|
||||||
.unread_indicator(self.unread_and_have_replies)
|
|
||||||
.show(ui)
|
|
||||||
});
|
});
|
||||||
|
|
||||||
match self.note_type {
|
match self.note_type {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
use egui::containers::scroll_area::ScrollBarVisibility;
|
use egui::containers::scroll_area::ScrollBarVisibility;
|
||||||
use egui::{vec2, Direction, Layout, Pos2, Stroke};
|
use egui::{vec2, Direction, Layout, Pos2, Stroke};
|
||||||
use egui_tabs::TabColor;
|
use egui_tabs::TabColor;
|
||||||
use enostr::KeypairUnowned;
|
|
||||||
use nostrdb::Transaction;
|
use nostrdb::Transaction;
|
||||||
use notedeck::ui::is_narrow;
|
use notedeck::ui::is_narrow;
|
||||||
use notedeck_ui::jobs::JobsCache;
|
use notedeck_ui::jobs::JobsCache;
|
||||||
@@ -22,7 +21,6 @@ pub struct TimelineView<'a, 'd> {
|
|||||||
reverse: bool,
|
reverse: bool,
|
||||||
is_muted: &'a MuteFun,
|
is_muted: &'a MuteFun,
|
||||||
note_context: &'a mut NoteContext<'d>,
|
note_context: &'a mut NoteContext<'d>,
|
||||||
cur_acc: &'a KeypairUnowned<'a>,
|
|
||||||
jobs: &'a mut JobsCache,
|
jobs: &'a mut JobsCache,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +32,6 @@ impl<'a, 'd> TimelineView<'a, 'd> {
|
|||||||
is_muted: &'a MuteFun,
|
is_muted: &'a MuteFun,
|
||||||
note_context: &'a mut NoteContext<'d>,
|
note_context: &'a mut NoteContext<'d>,
|
||||||
note_options: NoteOptions,
|
note_options: NoteOptions,
|
||||||
cur_acc: &'a KeypairUnowned<'a>,
|
|
||||||
jobs: &'a mut JobsCache,
|
jobs: &'a mut JobsCache,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let reverse = false;
|
let reverse = false;
|
||||||
@@ -45,7 +42,6 @@ impl<'a, 'd> TimelineView<'a, 'd> {
|
|||||||
reverse,
|
reverse,
|
||||||
is_muted,
|
is_muted,
|
||||||
note_context,
|
note_context,
|
||||||
cur_acc,
|
|
||||||
jobs,
|
jobs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -59,7 +55,6 @@ impl<'a, 'd> TimelineView<'a, 'd> {
|
|||||||
self.note_options,
|
self.note_options,
|
||||||
self.is_muted,
|
self.is_muted,
|
||||||
self.note_context,
|
self.note_context,
|
||||||
self.cur_acc,
|
|
||||||
self.jobs,
|
self.jobs,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -79,7 +74,6 @@ fn timeline_ui(
|
|||||||
note_options: NoteOptions,
|
note_options: NoteOptions,
|
||||||
is_muted: &MuteFun,
|
is_muted: &MuteFun,
|
||||||
note_context: &mut NoteContext,
|
note_context: &mut NoteContext,
|
||||||
cur_acc: &KeypairUnowned,
|
|
||||||
jobs: &mut JobsCache,
|
jobs: &mut JobsCache,
|
||||||
) -> Option<NoteAction> {
|
) -> Option<NoteAction> {
|
||||||
//padding(4.0, ui, |ui| ui.heading("Notifications"));
|
//padding(4.0, ui, |ui| ui.heading("Notifications"));
|
||||||
@@ -169,7 +163,6 @@ fn timeline_ui(
|
|||||||
&txn,
|
&txn,
|
||||||
is_muted,
|
is_muted,
|
||||||
note_context,
|
note_context,
|
||||||
cur_acc,
|
|
||||||
jobs,
|
jobs,
|
||||||
)
|
)
|
||||||
.show(ui)
|
.show(ui)
|
||||||
@@ -354,7 +347,6 @@ pub struct TimelineTabView<'a, 'd> {
|
|||||||
txn: &'a Transaction,
|
txn: &'a Transaction,
|
||||||
is_muted: &'a MuteFun,
|
is_muted: &'a MuteFun,
|
||||||
note_context: &'a mut NoteContext<'d>,
|
note_context: &'a mut NoteContext<'d>,
|
||||||
cur_acc: &'a KeypairUnowned<'a>,
|
|
||||||
jobs: &'a mut JobsCache,
|
jobs: &'a mut JobsCache,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,7 +359,6 @@ impl<'a, 'd> TimelineTabView<'a, 'd> {
|
|||||||
txn: &'a Transaction,
|
txn: &'a Transaction,
|
||||||
is_muted: &'a MuteFun,
|
is_muted: &'a MuteFun,
|
||||||
note_context: &'a mut NoteContext<'d>,
|
note_context: &'a mut NoteContext<'d>,
|
||||||
cur_acc: &'a KeypairUnowned<'a>,
|
|
||||||
jobs: &'a mut JobsCache,
|
jobs: &'a mut JobsCache,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@@ -377,7 +368,6 @@ impl<'a, 'd> TimelineTabView<'a, 'd> {
|
|||||||
txn,
|
txn,
|
||||||
is_muted,
|
is_muted,
|
||||||
note_context,
|
note_context,
|
||||||
cur_acc,
|
|
||||||
jobs,
|
jobs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -424,21 +414,10 @@ impl<'a, 'd> TimelineTabView<'a, 'd> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if !muted {
|
if !muted {
|
||||||
let zapping_acc = if self.note_context.current_account_has_wallet {
|
|
||||||
Some(self.cur_acc)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
|
||||||
|
|
||||||
notedeck_ui::padding(8.0, ui, |ui| {
|
notedeck_ui::padding(8.0, ui, |ui| {
|
||||||
let resp = NoteView::new(
|
let resp =
|
||||||
self.note_context,
|
NoteView::new(self.note_context, ¬e, self.note_options, self.jobs)
|
||||||
zapping_acc,
|
.show(ui);
|
||||||
¬e,
|
|
||||||
self.note_options,
|
|
||||||
self.jobs,
|
|
||||||
)
|
|
||||||
.show(ui);
|
|
||||||
|
|
||||||
if let Some(note_action) = resp.action {
|
if let Some(note_action) = resp.action {
|
||||||
action = Some(note_action)
|
action = Some(note_action)
|
||||||
|
|||||||
@@ -211,6 +211,7 @@ impl<'a> DaveUi<'a> {
|
|||||||
) -> Option<NoteAction> {
|
) -> Option<NoteAction> {
|
||||||
let mut note_context = NoteContext {
|
let mut note_context = NoteContext {
|
||||||
ndb: ctx.ndb,
|
ndb: ctx.ndb,
|
||||||
|
accounts: ctx.accounts,
|
||||||
img_cache: ctx.img_cache,
|
img_cache: ctx.img_cache,
|
||||||
note_cache: ctx.note_cache,
|
note_cache: ctx.note_cache,
|
||||||
zaps: ctx.zaps,
|
zaps: ctx.zaps,
|
||||||
@@ -243,7 +244,6 @@ impl<'a> DaveUi<'a> {
|
|||||||
|ui| {
|
|ui| {
|
||||||
notedeck_ui::NoteView::new(
|
notedeck_ui::NoteView::new(
|
||||||
&mut note_context,
|
&mut note_context,
|
||||||
None,
|
|
||||||
¬e,
|
¬e,
|
||||||
NoteOptions::default(),
|
NoteOptions::default(),
|
||||||
jobs,
|
jobs,
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use egui::{Color32, Hyperlink, RichText};
|
use egui::{Color32, Hyperlink, RichText};
|
||||||
use enostr::KeypairUnowned;
|
|
||||||
use nostrdb::{BlockType, Mention, Note, NoteKey, Transaction};
|
use nostrdb::{BlockType, Mention, Note, NoteKey, Transaction};
|
||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
|
|
||||||
@@ -18,7 +17,6 @@ use super::media::{find_renderable_media, image_carousel, RenderableMedia};
|
|||||||
|
|
||||||
pub struct NoteContents<'a, 'd> {
|
pub struct NoteContents<'a, 'd> {
|
||||||
note_context: &'a mut NoteContext<'d>,
|
note_context: &'a mut NoteContext<'d>,
|
||||||
cur_acc: Option<&'a KeypairUnowned<'a>>,
|
|
||||||
txn: &'a Transaction,
|
txn: &'a Transaction,
|
||||||
note: &'a Note<'a>,
|
note: &'a Note<'a>,
|
||||||
options: NoteOptions,
|
options: NoteOptions,
|
||||||
@@ -30,7 +28,6 @@ impl<'a, 'd> NoteContents<'a, 'd> {
|
|||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn new(
|
pub fn new(
|
||||||
note_context: &'a mut NoteContext<'d>,
|
note_context: &'a mut NoteContext<'d>,
|
||||||
cur_acc: Option<&'a KeypairUnowned<'a>>,
|
|
||||||
txn: &'a Transaction,
|
txn: &'a Transaction,
|
||||||
note: &'a Note,
|
note: &'a Note,
|
||||||
options: NoteOptions,
|
options: NoteOptions,
|
||||||
@@ -38,7 +35,6 @@ impl<'a, 'd> NoteContents<'a, 'd> {
|
|||||||
) -> Self {
|
) -> Self {
|
||||||
NoteContents {
|
NoteContents {
|
||||||
note_context,
|
note_context,
|
||||||
cur_acc,
|
|
||||||
txn,
|
txn,
|
||||||
note,
|
note,
|
||||||
options,
|
options,
|
||||||
@@ -53,7 +49,6 @@ impl egui::Widget for &mut NoteContents<'_, '_> {
|
|||||||
let result = render_note_contents(
|
let result = render_note_contents(
|
||||||
ui,
|
ui,
|
||||||
self.note_context,
|
self.note_context,
|
||||||
self.cur_acc,
|
|
||||||
self.txn,
|
self.txn,
|
||||||
self.note,
|
self.note,
|
||||||
self.options,
|
self.options,
|
||||||
@@ -71,7 +66,6 @@ impl egui::Widget for &mut NoteContents<'_, '_> {
|
|||||||
pub fn render_note_preview(
|
pub fn render_note_preview(
|
||||||
ui: &mut egui::Ui,
|
ui: &mut egui::Ui,
|
||||||
note_context: &mut NoteContext,
|
note_context: &mut NoteContext,
|
||||||
cur_acc: Option<&KeypairUnowned>,
|
|
||||||
txn: &Transaction,
|
txn: &Transaction,
|
||||||
id: &[u8; 32],
|
id: &[u8; 32],
|
||||||
parent: NoteKey,
|
parent: NoteKey,
|
||||||
@@ -105,7 +99,7 @@ pub fn render_note_preview(
|
|||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
NoteView::new(note_context, cur_acc, ¬e, note_options, jobs)
|
NoteView::new(note_context, ¬e, note_options, jobs)
|
||||||
.preview_style()
|
.preview_style()
|
||||||
.parent(parent)
|
.parent(parent)
|
||||||
.show(ui)
|
.show(ui)
|
||||||
@@ -116,7 +110,6 @@ pub fn render_note_preview(
|
|||||||
pub fn render_note_contents(
|
pub fn render_note_contents(
|
||||||
ui: &mut egui::Ui,
|
ui: &mut egui::Ui,
|
||||||
note_context: &mut NoteContext,
|
note_context: &mut NoteContext,
|
||||||
cur_acc: Option<&KeypairUnowned>,
|
|
||||||
txn: &Transaction,
|
txn: &Transaction,
|
||||||
note: &Note,
|
note: &Note,
|
||||||
options: NoteOptions,
|
options: NoteOptions,
|
||||||
@@ -275,7 +268,7 @@ pub fn render_note_contents(
|
|||||||
});
|
});
|
||||||
|
|
||||||
let preview_note_action = inline_note.and_then(|(id, _)| {
|
let preview_note_action = inline_note.and_then(|(id, _)| {
|
||||||
render_note_preview(ui, note_context, cur_acc, txn, id, note_key, options, jobs)
|
render_note_preview(ui, note_context, txn, id, note_key, options, jobs)
|
||||||
.action
|
.action
|
||||||
.map(|a| match a {
|
.map(|a| match a {
|
||||||
NoteAction::Note { note_id, .. } => NoteAction::Note {
|
NoteAction::Note { note_id, .. } => NoteAction::Note {
|
||||||
@@ -291,12 +284,11 @@ pub fn render_note_contents(
|
|||||||
ui.add_space(2.0);
|
ui.add_space(2.0);
|
||||||
let carousel_id = egui::Id::new(("carousel", note.key().expect("expected tx note")));
|
let carousel_id = egui::Id::new(("carousel", note.key().expect("expected tx note")));
|
||||||
|
|
||||||
let trusted_media = trust_media_from_pk2(
|
let zapping_acc = {
|
||||||
note_context.ndb,
|
let cur_acc = note_context.accounts.get_selected_account();
|
||||||
txn,
|
cur_acc.wallet.as_ref().map(|_| cur_acc.key.pubkey.bytes())
|
||||||
cur_acc.as_ref().map(|k| k.pubkey.bytes()),
|
};
|
||||||
note.pubkey(),
|
let trusted_media = trust_media_from_pk2(note_context.ndb, txn, zapping_acc, note.pubkey());
|
||||||
);
|
|
||||||
|
|
||||||
media_action = image_carousel(
|
media_action = image_carousel(
|
||||||
ui,
|
ui,
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ use notedeck::{
|
|||||||
|
|
||||||
pub struct NoteView<'a, 'd> {
|
pub struct NoteView<'a, 'd> {
|
||||||
note_context: &'a mut NoteContext<'d>,
|
note_context: &'a mut NoteContext<'d>,
|
||||||
zapping_acc: Option<&'a KeypairUnowned<'a>>,
|
|
||||||
parent: Option<NoteKey>,
|
parent: Option<NoteKey>,
|
||||||
note: &'a nostrdb::Note<'a>,
|
note: &'a nostrdb::Note<'a>,
|
||||||
framed: bool,
|
framed: bool,
|
||||||
@@ -85,7 +84,6 @@ impl egui::Widget for &mut NoteView<'_, '_> {
|
|||||||
impl<'a, 'd> NoteView<'a, 'd> {
|
impl<'a, 'd> NoteView<'a, 'd> {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
note_context: &'a mut NoteContext<'d>,
|
note_context: &'a mut NoteContext<'d>,
|
||||||
zapping_acc: Option<&'a KeypairUnowned<'a>>,
|
|
||||||
note: &'a nostrdb::Note<'a>,
|
note: &'a nostrdb::Note<'a>,
|
||||||
mut flags: NoteOptions,
|
mut flags: NoteOptions,
|
||||||
jobs: &'a mut JobsCache,
|
jobs: &'a mut JobsCache,
|
||||||
@@ -98,7 +96,6 @@ impl<'a, 'd> NoteView<'a, 'd> {
|
|||||||
|
|
||||||
Self {
|
Self {
|
||||||
note_context,
|
note_context,
|
||||||
zapping_acc,
|
|
||||||
parent,
|
parent,
|
||||||
note,
|
note,
|
||||||
flags,
|
flags,
|
||||||
@@ -231,7 +228,6 @@ impl<'a, 'd> NoteView<'a, 'd> {
|
|||||||
|
|
||||||
ui.add(&mut NoteContents::new(
|
ui.add(&mut NoteContents::new(
|
||||||
self.note_context,
|
self.note_context,
|
||||||
self.zapping_acc,
|
|
||||||
txn,
|
txn,
|
||||||
self.note,
|
self.note,
|
||||||
self.flags,
|
self.flags,
|
||||||
@@ -317,14 +313,7 @@ impl<'a, 'd> NoteView<'a, 'd> {
|
|||||||
.text_style(style.text_style()),
|
.text_style(style.text_style()),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
NoteView::new(
|
NoteView::new(self.note_context, ¬e_to_repost, self.flags, self.jobs).show(ui)
|
||||||
self.note_context,
|
|
||||||
self.zapping_acc,
|
|
||||||
¬e_to_repost,
|
|
||||||
self.flags,
|
|
||||||
self.jobs,
|
|
||||||
)
|
|
||||||
.show(ui)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn show_impl(&mut self, ui: &mut egui::Ui) -> NoteResponse {
|
pub fn show_impl(&mut self, ui: &mut egui::Ui) -> NoteResponse {
|
||||||
@@ -440,7 +429,6 @@ impl<'a, 'd> NoteView<'a, 'd> {
|
|||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
note_action = reply_desc(
|
note_action = reply_desc(
|
||||||
ui,
|
ui,
|
||||||
self.zapping_acc,
|
|
||||||
txn,
|
txn,
|
||||||
¬e_reply,
|
¬e_reply,
|
||||||
self.note_context,
|
self.note_context,
|
||||||
@@ -455,32 +443,27 @@ impl<'a, 'd> NoteView<'a, 'd> {
|
|||||||
})
|
})
|
||||||
.inner;
|
.inner;
|
||||||
|
|
||||||
let mut contents = NoteContents::new(
|
let mut contents =
|
||||||
self.note_context,
|
NoteContents::new(self.note_context, txn, self.note, self.flags, self.jobs);
|
||||||
self.zapping_acc,
|
|
||||||
txn,
|
|
||||||
self.note,
|
|
||||||
self.flags,
|
|
||||||
self.jobs,
|
|
||||||
);
|
|
||||||
|
|
||||||
ui.add(&mut contents);
|
ui.add(&mut contents);
|
||||||
|
|
||||||
note_action = contents.action.or(note_action);
|
note_action = contents.action.or(note_action);
|
||||||
|
|
||||||
if self.options().has(NoteOptions::ActionBar) {
|
if self.options().has(NoteOptions::ActionBar) {
|
||||||
note_action = render_note_actionbar(
|
let zapper = {
|
||||||
ui,
|
let cur_acc = self.note_context.accounts.get_selected_account();
|
||||||
self.zapping_acc.as_ref().map(|c| Zapper {
|
let has_wallet = cur_acc.wallet.is_some();
|
||||||
|
|
||||||
|
has_wallet.then_some(Zapper {
|
||||||
zaps: self.note_context.zaps,
|
zaps: self.note_context.zaps,
|
||||||
cur_acc: c,
|
cur_acc: cur_acc.keypair(),
|
||||||
}),
|
})
|
||||||
self.note.id(),
|
};
|
||||||
self.note.pubkey(),
|
note_action =
|
||||||
note_key,
|
render_note_actionbar(ui, zapper, self.note.id(), self.note.pubkey(), note_key)
|
||||||
)
|
.inner
|
||||||
.inner
|
.or(note_action);
|
||||||
.or(note_action);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NoteUiResponse {
|
NoteUiResponse {
|
||||||
@@ -527,7 +510,6 @@ impl<'a, 'd> NoteView<'a, 'd> {
|
|||||||
|
|
||||||
note_action = reply_desc(
|
note_action = reply_desc(
|
||||||
ui,
|
ui,
|
||||||
self.zapping_acc,
|
|
||||||
txn,
|
txn,
|
||||||
¬e_reply,
|
¬e_reply,
|
||||||
self.note_context,
|
self.note_context,
|
||||||
@@ -537,25 +519,25 @@ impl<'a, 'd> NoteView<'a, 'd> {
|
|||||||
.or(note_action.take());
|
.or(note_action.take());
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut contents = NoteContents::new(
|
let mut contents =
|
||||||
self.note_context,
|
NoteContents::new(self.note_context, txn, self.note, self.flags, self.jobs);
|
||||||
self.zapping_acc,
|
|
||||||
txn,
|
|
||||||
self.note,
|
|
||||||
self.flags,
|
|
||||||
self.jobs,
|
|
||||||
);
|
|
||||||
ui.add(&mut contents);
|
ui.add(&mut contents);
|
||||||
|
|
||||||
note_action = contents.action.or(note_action);
|
note_action = contents.action.or(note_action);
|
||||||
|
|
||||||
|
let zapper = {
|
||||||
|
let cur_acc = self.note_context.accounts.get_selected_account();
|
||||||
|
let has_wallet = cur_acc.wallet.is_some();
|
||||||
|
|
||||||
|
has_wallet.then_some(Zapper {
|
||||||
|
zaps: self.note_context.zaps,
|
||||||
|
cur_acc: cur_acc.keypair(),
|
||||||
|
})
|
||||||
|
};
|
||||||
if self.options().has(NoteOptions::ActionBar) {
|
if self.options().has(NoteOptions::ActionBar) {
|
||||||
note_action = render_note_actionbar(
|
note_action = render_note_actionbar(
|
||||||
ui,
|
ui,
|
||||||
self.zapping_acc.as_ref().map(|c| Zapper {
|
zapper,
|
||||||
zaps: self.note_context.zaps,
|
|
||||||
cur_acc: c,
|
|
||||||
}),
|
|
||||||
self.note.id(),
|
self.note.id(),
|
||||||
self.note.pubkey(),
|
self.note.pubkey(),
|
||||||
note_key,
|
note_key,
|
||||||
@@ -774,7 +756,7 @@ fn note_hitbox_clicked(
|
|||||||
|
|
||||||
struct Zapper<'a> {
|
struct Zapper<'a> {
|
||||||
zaps: &'a Zaps,
|
zaps: &'a Zaps,
|
||||||
cur_acc: &'a KeypairUnowned<'a>,
|
cur_acc: KeypairUnowned<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[profiling::function]
|
#[profiling::function]
|
||||||
|
|||||||
@@ -3,14 +3,12 @@ use nostrdb::{Note, NoteReply, Transaction};
|
|||||||
|
|
||||||
use super::NoteOptions;
|
use super::NoteOptions;
|
||||||
use crate::{jobs::JobsCache, note::NoteView, Mention};
|
use crate::{jobs::JobsCache, note::NoteView, Mention};
|
||||||
use enostr::KeypairUnowned;
|
|
||||||
use notedeck::{NoteAction, NoteContext};
|
use notedeck::{NoteAction, NoteContext};
|
||||||
|
|
||||||
#[must_use = "Please handle the resulting note action"]
|
#[must_use = "Please handle the resulting note action"]
|
||||||
#[profiling::function]
|
#[profiling::function]
|
||||||
pub fn reply_desc(
|
pub fn reply_desc(
|
||||||
ui: &mut egui::Ui,
|
ui: &mut egui::Ui,
|
||||||
cur_acc: Option<&KeypairUnowned>,
|
|
||||||
txn: &Transaction,
|
txn: &Transaction,
|
||||||
note_reply: &NoteReply,
|
note_reply: &NoteReply,
|
||||||
note_context: &mut NoteContext,
|
note_context: &mut NoteContext,
|
||||||
@@ -43,7 +41,7 @@ pub fn reply_desc(
|
|||||||
if r.hovered() {
|
if r.hovered() {
|
||||||
r.on_hover_ui_at_pointer(|ui| {
|
r.on_hover_ui_at_pointer(|ui| {
|
||||||
ui.set_max_width(400.0);
|
ui.set_max_width(400.0);
|
||||||
NoteView::new(note_context, cur_acc, note, note_options, jobs)
|
NoteView::new(note_context, note, note_options, jobs)
|
||||||
.actionbar(false)
|
.actionbar(false)
|
||||||
.wide(true)
|
.wide(true)
|
||||||
.show(ui);
|
.show(ui);
|
||||||
|
|||||||
Reference in New Issue
Block a user