introduce the driller

Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
kernelkind
2025-03-07 00:40:24 -05:00
parent 035aa20790
commit 95d618e7fe
11 changed files with 298 additions and 489 deletions

View File

@@ -1,49 +1,38 @@
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::NoteContentsDriller, PostResponse, PostType};
pub struct QuoteRepostView<'a> {
ndb: &'a Ndb,
pub struct QuoteRepostView<'a, 'd> {
driller: &'a mut NoteContentsDriller<'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>,
inner_rect: egui::Rect,
note_options: NoteOptions,
}
impl<'a> QuoteRepostView<'a> {
impl<'a, 'd> QuoteRepostView<'a, 'd> {
#[allow(clippy::too_many_arguments)]
pub fn new(
ndb: &'a Ndb,
driller: &'a mut NoteContentsDriller<'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,
note_options: NoteOptions,
) -> Self {
let id_source: Option<egui::Id> = None;
QuoteRepostView {
ndb,
driller,
poster,
note_cache,
img_cache,
draft,
quoting_note,
id_source,
inner_rect,
note_options,
}
}
@@ -52,14 +41,11 @@ impl<'a> QuoteRepostView<'a> {
let quoting_note_id = self.quoting_note.id();
ui::PostView::new(
self.ndb,
self.driller,
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,
)
.id_source(id)
.ui(self.quoting_note.txn().unwrap(), ui)