introduce NoteContext

Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
kernelkind
2025-03-07 17:02:02 -05:00
parent d85c6043b7
commit a9f473e3c9
12 changed files with 368 additions and 430 deletions

View File

@@ -1,19 +1,15 @@
use enostr::{FilledKeypair, NoteId};
use nostrdb::Ndb;
use notedeck::{Images, NoteCache};
use crate::{
draft::Draft,
ui::{self, note::NoteOptions},
ui::{self},
};
use super::{PostResponse, PostType};
use super::{contents::NoteContext, NoteOptions, PostResponse, PostType};
pub struct QuoteRepostView<'a> {
ndb: &'a Ndb,
pub struct QuoteRepostView<'a, 'd> {
note_context: &'a mut NoteContext<'d>,
poster: FilledKeypair<'a>,
note_cache: &'a mut NoteCache,
img_cache: &'a mut Images,
draft: &'a mut Draft,
quoting_note: &'a nostrdb::Note<'a>,
id_source: Option<egui::Id>,
@@ -21,13 +17,11 @@ pub struct QuoteRepostView<'a> {
note_options: NoteOptions,
}
impl<'a> QuoteRepostView<'a> {
impl<'a, 'd> QuoteRepostView<'a, 'd> {
#[allow(clippy::too_many_arguments)]
pub fn new(
ndb: &'a Ndb,
note_context: &'a mut NoteContext<'d>,
poster: FilledKeypair<'a>,
note_cache: &'a mut NoteCache,
img_cache: &'a mut Images,
draft: &'a mut Draft,
quoting_note: &'a nostrdb::Note<'a>,
inner_rect: egui::Rect,
@@ -35,10 +29,8 @@ impl<'a> QuoteRepostView<'a> {
) -> Self {
let id_source: Option<egui::Id> = None;
QuoteRepostView {
ndb,
note_context,
poster,
note_cache,
img_cache,
draft,
quoting_note,
id_source,
@@ -52,11 +44,9 @@ impl<'a> QuoteRepostView<'a> {
let quoting_note_id = self.quoting_note.id();
let post_resp = ui::PostView::new(
self.ndb,
self.note_context,
self.draft,
PostType::Quote(NoteId::new(quoting_note_id.to_owned())),
self.img_cache,
self.note_cache,
self.poster,
self.inner_rect,
self.note_options,