@@ -280,6 +280,7 @@ fn render_nav_body(
|
||||
note_cache: ctx.note_cache,
|
||||
zaps: ctx.zaps,
|
||||
pool: ctx.pool,
|
||||
job_pool: ctx.job_pool,
|
||||
};
|
||||
match top {
|
||||
Route::Timeline(kind) => render_timeline_route(
|
||||
@@ -292,6 +293,7 @@ fn render_nav_body(
|
||||
depth,
|
||||
ui,
|
||||
&mut note_context,
|
||||
&mut app.jobs,
|
||||
),
|
||||
|
||||
Route::Accounts(amr) => {
|
||||
@@ -348,6 +350,7 @@ fn render_nav_body(
|
||||
¬e,
|
||||
inner_rect,
|
||||
app.note_options,
|
||||
&mut app.jobs,
|
||||
)
|
||||
.id_source(id)
|
||||
.show(ui)
|
||||
@@ -384,6 +387,7 @@ fn render_nav_body(
|
||||
¬e,
|
||||
inner_rect,
|
||||
app.note_options,
|
||||
&mut app.jobs,
|
||||
)
|
||||
.id_source(id)
|
||||
.show(ui)
|
||||
@@ -405,6 +409,7 @@ fn render_nav_body(
|
||||
kp,
|
||||
inner_rect,
|
||||
app.note_options,
|
||||
&mut app.jobs,
|
||||
)
|
||||
.ui(&txn, ui);
|
||||
|
||||
@@ -424,8 +429,7 @@ fn render_nav_body(
|
||||
|
||||
Route::Search => {
|
||||
let id = ui.id().with(("search", depth, col));
|
||||
let navigating = app
|
||||
.columns_mut(ctx.accounts)
|
||||
let navigating = get_active_columns_mut(ctx.accounts, &mut app.decks_cache)
|
||||
.column(col)
|
||||
.router()
|
||||
.navigating;
|
||||
@@ -448,6 +452,7 @@ fn render_nav_body(
|
||||
search_buffer,
|
||||
&mut note_context,
|
||||
&ctx.accounts.get_selected_account().map(|a| (&a.key).into()),
|
||||
&mut app.jobs,
|
||||
)
|
||||
.show(ui, ctx.clipboard)
|
||||
.map(RenderNavAction::NoteAction)
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::{
|
||||
|
||||
use enostr::Pubkey;
|
||||
use notedeck::{Accounts, MuteFun, NoteContext, UnknownIds};
|
||||
use notedeck_ui::NoteOptions;
|
||||
use notedeck_ui::{jobs::JobsCache, NoteOptions};
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn render_timeline_route(
|
||||
@@ -20,6 +20,7 @@ pub fn render_timeline_route(
|
||||
depth: usize,
|
||||
ui: &mut egui::Ui,
|
||||
note_context: &mut NoteContext,
|
||||
jobs: &mut JobsCache,
|
||||
) -> Option<RenderNavAction> {
|
||||
if kind == &TimelineKind::Universe {
|
||||
note_options.set_hide_media(true);
|
||||
@@ -40,6 +41,7 @@ pub fn render_timeline_route(
|
||||
note_context,
|
||||
note_options,
|
||||
&accounts.get_selected_account().map(|a| (&a.key).into()),
|
||||
jobs,
|
||||
)
|
||||
.ui(ui);
|
||||
|
||||
@@ -58,6 +60,7 @@ pub fn render_timeline_route(
|
||||
&accounts.mutefun(),
|
||||
note_options,
|
||||
note_context,
|
||||
jobs,
|
||||
)
|
||||
} else {
|
||||
// we render profiles like timelines if they are at the root
|
||||
@@ -68,6 +71,7 @@ pub fn render_timeline_route(
|
||||
note_context,
|
||||
note_options,
|
||||
&accounts.get_selected_account().map(|a| (&a.key).into()),
|
||||
jobs,
|
||||
)
|
||||
.ui(ui);
|
||||
|
||||
@@ -88,6 +92,7 @@ pub fn render_timeline_route(
|
||||
&accounts.mutefun(),
|
||||
note_context,
|
||||
&accounts.get_selected_account().map(|a| (&a.key).into()),
|
||||
jobs,
|
||||
)
|
||||
.id_source(egui::Id::new(("threadscroll", col)))
|
||||
.ui(ui)
|
||||
@@ -107,6 +112,7 @@ pub fn render_profile_route(
|
||||
is_muted: &MuteFun,
|
||||
note_options: NoteOptions,
|
||||
note_context: &mut NoteContext,
|
||||
jobs: &mut JobsCache,
|
||||
) -> Option<RenderNavAction> {
|
||||
let action = ProfileView::new(
|
||||
pubkey,
|
||||
@@ -117,6 +123,7 @@ pub fn render_profile_route(
|
||||
unknown_ids,
|
||||
is_muted,
|
||||
note_context,
|
||||
jobs,
|
||||
)
|
||||
.ui(ui);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ use egui::{
|
||||
};
|
||||
use enostr::{FilledKeypair, FullKeypair, NoteId, Pubkey, RelayPool};
|
||||
use nostrdb::{Ndb, Transaction};
|
||||
use notedeck_ui::jobs::JobsCache;
|
||||
use notedeck_ui::{
|
||||
gif::{handle_repaint, retrieve_latest_texture},
|
||||
images::render_images,
|
||||
@@ -32,6 +33,7 @@ pub struct PostView<'a, 'd> {
|
||||
id_source: Option<egui::Id>,
|
||||
inner_rect: egui::Rect,
|
||||
note_options: NoteOptions,
|
||||
jobs: &'a mut JobsCache,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -103,6 +105,7 @@ impl<'a, 'd> PostView<'a, 'd> {
|
||||
poster: FilledKeypair<'a>,
|
||||
inner_rect: egui::Rect,
|
||||
note_options: NoteOptions,
|
||||
jobs: &'a mut JobsCache,
|
||||
) -> Self {
|
||||
let id_source: Option<egui::Id> = None;
|
||||
PostView {
|
||||
@@ -113,6 +116,7 @@ impl<'a, 'd> PostView<'a, 'd> {
|
||||
post_type,
|
||||
inner_rect,
|
||||
note_options,
|
||||
jobs,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,6 +349,7 @@ impl<'a, 'd> PostView<'a, 'd> {
|
||||
id.bytes(),
|
||||
nostrdb::NoteKey::new(0),
|
||||
self.note_options,
|
||||
self.jobs,
|
||||
)
|
||||
})
|
||||
.inner
|
||||
@@ -696,6 +701,7 @@ mod preview {
|
||||
pub struct PostPreview {
|
||||
draft: Draft,
|
||||
poster: FullKeypair,
|
||||
jobs: JobsCache,
|
||||
}
|
||||
|
||||
impl PostPreview {
|
||||
@@ -725,6 +731,7 @@ mod preview {
|
||||
PostPreview {
|
||||
draft,
|
||||
poster: FullKeypair::generate(),
|
||||
jobs: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -738,6 +745,7 @@ mod preview {
|
||||
note_cache: app.note_cache,
|
||||
zaps: app.zaps,
|
||||
pool: app.pool,
|
||||
job_pool: app.job_pool,
|
||||
};
|
||||
|
||||
PostView::new(
|
||||
@@ -747,6 +755,7 @@ mod preview {
|
||||
self.poster.to_filled(),
|
||||
ui.available_rect_before_wrap(),
|
||||
NoteOptions::default(),
|
||||
&mut self.jobs,
|
||||
)
|
||||
.ui(&txn, ui);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ use crate::{
|
||||
|
||||
use enostr::{FilledKeypair, NoteId};
|
||||
use notedeck::NoteContext;
|
||||
use notedeck_ui::NoteOptions;
|
||||
use notedeck_ui::{jobs::JobsCache, NoteOptions};
|
||||
|
||||
pub struct QuoteRepostView<'a, 'd> {
|
||||
note_context: &'a mut NoteContext<'d>,
|
||||
@@ -16,6 +16,7 @@ pub struct QuoteRepostView<'a, 'd> {
|
||||
id_source: Option<egui::Id>,
|
||||
inner_rect: egui::Rect,
|
||||
note_options: NoteOptions,
|
||||
jobs: &'a mut JobsCache,
|
||||
}
|
||||
|
||||
impl<'a, 'd> QuoteRepostView<'a, 'd> {
|
||||
@@ -27,6 +28,7 @@ impl<'a, 'd> QuoteRepostView<'a, 'd> {
|
||||
quoting_note: &'a nostrdb::Note<'a>,
|
||||
inner_rect: egui::Rect,
|
||||
note_options: NoteOptions,
|
||||
jobs: &'a mut JobsCache,
|
||||
) -> Self {
|
||||
let id_source: Option<egui::Id> = None;
|
||||
QuoteRepostView {
|
||||
@@ -37,6 +39,7 @@ impl<'a, 'd> QuoteRepostView<'a, 'd> {
|
||||
id_source,
|
||||
inner_rect,
|
||||
note_options,
|
||||
jobs,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +54,7 @@ impl<'a, 'd> QuoteRepostView<'a, 'd> {
|
||||
self.poster,
|
||||
self.inner_rect,
|
||||
self.note_options,
|
||||
self.jobs,
|
||||
)
|
||||
.id_source(id)
|
||||
.ui(self.quoting_note.txn().unwrap(), ui);
|
||||
|
||||
@@ -6,6 +6,7 @@ use crate::ui::{
|
||||
|
||||
use enostr::{FilledKeypair, NoteId};
|
||||
use notedeck::NoteContext;
|
||||
use notedeck_ui::jobs::JobsCache;
|
||||
use notedeck_ui::{NoteOptions, NoteView, ProfilePic};
|
||||
|
||||
pub struct PostReplyView<'a, 'd> {
|
||||
@@ -16,6 +17,7 @@ pub struct PostReplyView<'a, 'd> {
|
||||
id_source: Option<egui::Id>,
|
||||
inner_rect: egui::Rect,
|
||||
note_options: NoteOptions,
|
||||
jobs: &'a mut JobsCache,
|
||||
}
|
||||
|
||||
impl<'a, 'd> PostReplyView<'a, 'd> {
|
||||
@@ -27,6 +29,7 @@ impl<'a, 'd> PostReplyView<'a, 'd> {
|
||||
note: &'a nostrdb::Note<'a>,
|
||||
inner_rect: egui::Rect,
|
||||
note_options: NoteOptions,
|
||||
jobs: &'a mut JobsCache,
|
||||
) -> Self {
|
||||
let id_source: Option<egui::Id> = None;
|
||||
PostReplyView {
|
||||
@@ -37,6 +40,7 @@ impl<'a, 'd> PostReplyView<'a, 'd> {
|
||||
id_source,
|
||||
inner_rect,
|
||||
note_options,
|
||||
jobs,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,6 +75,7 @@ impl<'a, 'd> PostReplyView<'a, 'd> {
|
||||
&Some(self.poster.into()),
|
||||
self.note,
|
||||
self.note_options,
|
||||
self.jobs,
|
||||
)
|
||||
.truncate(false)
|
||||
.selectable_text(true)
|
||||
@@ -93,6 +98,7 @@ impl<'a, 'd> PostReplyView<'a, 'd> {
|
||||
self.poster,
|
||||
self.inner_rect,
|
||||
self.note_options,
|
||||
self.jobs,
|
||||
)
|
||||
.id_source(id)
|
||||
.ui(self.note.txn().unwrap(), ui)
|
||||
|
||||
@@ -15,6 +15,7 @@ use notedeck::{
|
||||
NotedeckTextStyle, UnknownIds,
|
||||
};
|
||||
use notedeck_ui::{
|
||||
jobs::JobsCache,
|
||||
profile::{about_section_widget, banner, display_name_widget},
|
||||
NoteOptions, ProfilePic,
|
||||
};
|
||||
@@ -28,6 +29,7 @@ pub struct ProfileView<'a, 'd> {
|
||||
unknown_ids: &'a mut UnknownIds,
|
||||
is_muted: &'a MuteFun,
|
||||
note_context: &'a mut NoteContext<'d>,
|
||||
jobs: &'a mut JobsCache,
|
||||
}
|
||||
|
||||
pub enum ProfileViewAction {
|
||||
@@ -46,6 +48,7 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
||||
unknown_ids: &'a mut UnknownIds,
|
||||
is_muted: &'a MuteFun,
|
||||
note_context: &'a mut NoteContext<'d>,
|
||||
jobs: &'a mut JobsCache,
|
||||
) -> Self {
|
||||
ProfileView {
|
||||
pubkey,
|
||||
@@ -56,6 +59,7 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
||||
unknown_ids,
|
||||
is_muted,
|
||||
note_context,
|
||||
jobs,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,6 +116,7 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
||||
.accounts
|
||||
.get_selected_account()
|
||||
.map(|a| (&a.key).into()),
|
||||
self.jobs,
|
||||
)
|
||||
.show(ui)
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ use crate::ui::timeline::TimelineTabView;
|
||||
use egui_winit::clipboard::Clipboard;
|
||||
use nostrdb::{Filter, Transaction};
|
||||
use notedeck::{MuteFun, NoteAction, NoteContext, NoteRef};
|
||||
use notedeck_ui::{icons::search_icon, padding, NoteOptions};
|
||||
use notedeck_ui::{icons::search_icon, jobs::JobsCache, padding, NoteOptions};
|
||||
use std::time::{Duration, Instant};
|
||||
use tracing::{error, info, warn};
|
||||
|
||||
@@ -20,6 +20,7 @@ pub struct SearchView<'a, 'd> {
|
||||
is_muted: &'a MuteFun,
|
||||
note_context: &'a mut NoteContext<'d>,
|
||||
cur_acc: &'a Option<KeypairUnowned<'a>>,
|
||||
jobs: &'a mut JobsCache,
|
||||
}
|
||||
|
||||
impl<'a, 'd> SearchView<'a, 'd> {
|
||||
@@ -30,6 +31,7 @@ impl<'a, 'd> SearchView<'a, 'd> {
|
||||
query: &'a mut SearchQueryState,
|
||||
note_context: &'a mut NoteContext<'d>,
|
||||
cur_acc: &'a Option<KeypairUnowned<'a>>,
|
||||
jobs: &'a mut JobsCache,
|
||||
) -> Self {
|
||||
Self {
|
||||
txn,
|
||||
@@ -38,6 +40,7 @@ impl<'a, 'd> SearchView<'a, 'd> {
|
||||
note_options,
|
||||
note_context,
|
||||
cur_acc,
|
||||
jobs,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +84,7 @@ impl<'a, 'd> SearchView<'a, 'd> {
|
||||
self.is_muted,
|
||||
self.note_context,
|
||||
self.cur_acc,
|
||||
self.jobs,
|
||||
)
|
||||
.show(ui)
|
||||
})
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use enostr::KeypairUnowned;
|
||||
use nostrdb::Transaction;
|
||||
use notedeck::{MuteFun, NoteAction, NoteContext, RootNoteId, UnknownIds};
|
||||
use notedeck_ui::jobs::JobsCache;
|
||||
use notedeck_ui::NoteOptions;
|
||||
use tracing::error;
|
||||
|
||||
@@ -16,6 +17,7 @@ pub struct ThreadView<'a, 'd> {
|
||||
is_muted: &'a MuteFun,
|
||||
note_context: &'a mut NoteContext<'d>,
|
||||
cur_acc: &'a Option<KeypairUnowned<'a>>,
|
||||
jobs: &'a mut JobsCache,
|
||||
}
|
||||
|
||||
impl<'a, 'd> ThreadView<'a, 'd> {
|
||||
@@ -28,6 +30,7 @@ impl<'a, 'd> ThreadView<'a, 'd> {
|
||||
is_muted: &'a MuteFun,
|
||||
note_context: &'a mut NoteContext<'d>,
|
||||
cur_acc: &'a Option<KeypairUnowned<'a>>,
|
||||
jobs: &'a mut JobsCache,
|
||||
) -> Self {
|
||||
let id_source = egui::Id::new("threadscroll_threadview");
|
||||
ThreadView {
|
||||
@@ -39,6 +42,7 @@ impl<'a, 'd> ThreadView<'a, 'd> {
|
||||
is_muted,
|
||||
note_context,
|
||||
cur_acc,
|
||||
jobs,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +106,7 @@ impl<'a, 'd> ThreadView<'a, 'd> {
|
||||
self.is_muted,
|
||||
self.note_context,
|
||||
self.cur_acc,
|
||||
self.jobs,
|
||||
)
|
||||
.show(ui)
|
||||
})
|
||||
|
||||
@@ -3,6 +3,7 @@ use egui::{vec2, Direction, Layout, Pos2, Stroke};
|
||||
use egui_tabs::TabColor;
|
||||
use enostr::KeypairUnowned;
|
||||
use nostrdb::Transaction;
|
||||
use notedeck_ui::jobs::JobsCache;
|
||||
use std::f32::consts::PI;
|
||||
use tracing::{error, warn};
|
||||
|
||||
@@ -21,6 +22,7 @@ pub struct TimelineView<'a, 'd> {
|
||||
is_muted: &'a MuteFun,
|
||||
note_context: &'a mut NoteContext<'d>,
|
||||
cur_acc: &'a Option<KeypairUnowned<'a>>,
|
||||
jobs: &'a mut JobsCache,
|
||||
}
|
||||
|
||||
impl<'a, 'd> TimelineView<'a, 'd> {
|
||||
@@ -32,6 +34,7 @@ impl<'a, 'd> TimelineView<'a, 'd> {
|
||||
note_context: &'a mut NoteContext<'d>,
|
||||
note_options: NoteOptions,
|
||||
cur_acc: &'a Option<KeypairUnowned<'a>>,
|
||||
jobs: &'a mut JobsCache,
|
||||
) -> Self {
|
||||
let reverse = false;
|
||||
TimelineView {
|
||||
@@ -42,6 +45,7 @@ impl<'a, 'd> TimelineView<'a, 'd> {
|
||||
is_muted,
|
||||
note_context,
|
||||
cur_acc,
|
||||
jobs,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +59,7 @@ impl<'a, 'd> TimelineView<'a, 'd> {
|
||||
self.is_muted,
|
||||
self.note_context,
|
||||
self.cur_acc,
|
||||
self.jobs,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -74,6 +79,7 @@ fn timeline_ui(
|
||||
is_muted: &MuteFun,
|
||||
note_context: &mut NoteContext,
|
||||
cur_acc: &Option<KeypairUnowned>,
|
||||
jobs: &mut JobsCache,
|
||||
) -> Option<NoteAction> {
|
||||
//padding(4.0, ui, |ui| ui.heading("Notifications"));
|
||||
/*
|
||||
@@ -152,6 +158,7 @@ fn timeline_ui(
|
||||
is_muted,
|
||||
note_context,
|
||||
cur_acc,
|
||||
jobs,
|
||||
)
|
||||
.show(ui)
|
||||
});
|
||||
@@ -323,6 +330,7 @@ pub struct TimelineTabView<'a, 'd> {
|
||||
is_muted: &'a MuteFun,
|
||||
note_context: &'a mut NoteContext<'d>,
|
||||
cur_acc: &'a Option<KeypairUnowned<'a>>,
|
||||
jobs: &'a mut JobsCache,
|
||||
}
|
||||
|
||||
impl<'a, 'd> TimelineTabView<'a, 'd> {
|
||||
@@ -335,6 +343,7 @@ impl<'a, 'd> TimelineTabView<'a, 'd> {
|
||||
is_muted: &'a MuteFun,
|
||||
note_context: &'a mut NoteContext<'d>,
|
||||
cur_acc: &'a Option<KeypairUnowned<'a>>,
|
||||
jobs: &'a mut JobsCache,
|
||||
) -> Self {
|
||||
Self {
|
||||
tab,
|
||||
@@ -344,6 +353,7 @@ impl<'a, 'd> TimelineTabView<'a, 'd> {
|
||||
is_muted,
|
||||
note_context,
|
||||
cur_acc,
|
||||
jobs,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,6 +405,7 @@ impl<'a, 'd> TimelineTabView<'a, 'd> {
|
||||
self.cur_acc,
|
||||
¬e,
|
||||
self.note_options,
|
||||
self.jobs,
|
||||
)
|
||||
.show(ui);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user