Merge tombstone muted notes #606
Changelog-Changed: Tombstone muted notes
This commit is contained in:
@@ -7,10 +7,11 @@ use crate::{
|
||||
ui::note::NoteOptions,
|
||||
};
|
||||
use egui::containers::scroll_area::ScrollBarVisibility;
|
||||
use egui::{Direction, Layout};
|
||||
use egui::{Color32, Direction, Layout};
|
||||
use egui_tabs::TabColor;
|
||||
use nostrdb::{Ndb, Transaction};
|
||||
use notedeck::{ImageCache, NoteCache};
|
||||
use notedeck::note::root_note_id_from_selected_id;
|
||||
use notedeck::{ImageCache, MuteFun, NoteCache};
|
||||
use tracing::{error, warn};
|
||||
|
||||
pub struct TimelineView<'a> {
|
||||
@@ -21,6 +22,7 @@ pub struct TimelineView<'a> {
|
||||
img_cache: &'a mut ImageCache,
|
||||
note_options: NoteOptions,
|
||||
reverse: bool,
|
||||
is_muted: &'a MuteFun,
|
||||
}
|
||||
|
||||
impl<'a> TimelineView<'a> {
|
||||
@@ -31,6 +33,7 @@ impl<'a> TimelineView<'a> {
|
||||
note_cache: &'a mut NoteCache,
|
||||
img_cache: &'a mut ImageCache,
|
||||
note_options: NoteOptions,
|
||||
is_muted: &'a MuteFun,
|
||||
) -> TimelineView<'a> {
|
||||
let reverse = false;
|
||||
TimelineView {
|
||||
@@ -41,6 +44,7 @@ impl<'a> TimelineView<'a> {
|
||||
img_cache,
|
||||
reverse,
|
||||
note_options,
|
||||
is_muted,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +58,7 @@ impl<'a> TimelineView<'a> {
|
||||
self.img_cache,
|
||||
self.reverse,
|
||||
self.note_options,
|
||||
self.is_muted,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -73,6 +78,7 @@ fn timeline_ui(
|
||||
img_cache: &mut ImageCache,
|
||||
reversed: bool,
|
||||
note_options: NoteOptions,
|
||||
is_muted: &MuteFun,
|
||||
) -> Option<NoteAction> {
|
||||
//padding(4.0, ui, |ui| ui.heading("Notifications"));
|
||||
/*
|
||||
@@ -123,6 +129,7 @@ fn timeline_ui(
|
||||
ndb,
|
||||
note_cache,
|
||||
img_cache,
|
||||
is_muted,
|
||||
)
|
||||
.show(ui)
|
||||
})
|
||||
@@ -224,9 +231,11 @@ pub struct TimelineTabView<'a> {
|
||||
ndb: &'a Ndb,
|
||||
note_cache: &'a mut NoteCache,
|
||||
img_cache: &'a mut ImageCache,
|
||||
is_muted: &'a MuteFun,
|
||||
}
|
||||
|
||||
impl<'a> TimelineTabView<'a> {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
tab: &'a TimelineTab,
|
||||
reversed: bool,
|
||||
@@ -235,6 +244,7 @@ impl<'a> TimelineTabView<'a> {
|
||||
ndb: &'a Ndb,
|
||||
note_cache: &'a mut NoteCache,
|
||||
img_cache: &'a mut ImageCache,
|
||||
is_muted: &'a MuteFun,
|
||||
) -> Self {
|
||||
Self {
|
||||
tab,
|
||||
@@ -244,6 +254,7 @@ impl<'a> TimelineTabView<'a> {
|
||||
ndb,
|
||||
note_cache,
|
||||
img_cache,
|
||||
is_muted,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,6 +262,7 @@ impl<'a> TimelineTabView<'a> {
|
||||
let mut action: Option<NoteAction> = None;
|
||||
let len = self.tab.notes.len();
|
||||
|
||||
let is_muted = self.is_muted;
|
||||
self.tab
|
||||
.list
|
||||
.clone()
|
||||
@@ -275,17 +287,30 @@ impl<'a> TimelineTabView<'a> {
|
||||
};
|
||||
|
||||
ui::padding(8.0, ui, |ui| {
|
||||
let resp = ui::NoteView::new(self.ndb, self.note_cache, self.img_cache, ¬e)
|
||||
.note_options(self.note_options)
|
||||
.show(ui);
|
||||
if let Some(muted_reason) = is_muted(
|
||||
¬e,
|
||||
root_note_id_from_selected_id(
|
||||
self.ndb,
|
||||
self.note_cache,
|
||||
self.txn,
|
||||
note.id(),
|
||||
),
|
||||
) {
|
||||
ui.colored_label(Color32::RED, format!("MUTED {}", muted_reason));
|
||||
} else {
|
||||
let resp =
|
||||
ui::NoteView::new(self.ndb, self.note_cache, self.img_cache, ¬e)
|
||||
.note_options(self.note_options)
|
||||
.show(ui);
|
||||
|
||||
if let Some(note_action) = resp.action {
|
||||
action = Some(note_action)
|
||||
}
|
||||
if let Some(note_action) = resp.action {
|
||||
action = Some(note_action)
|
||||
}
|
||||
|
||||
if let Some(context) = resp.context_selection {
|
||||
context.process(ui, ¬e);
|
||||
}
|
||||
if let Some(context) = resp.context_selection {
|
||||
context.process(ui, ¬e);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
ui::hline(ui);
|
||||
|
||||
Reference in New Issue
Block a user