mirror of
https://github.com/aljazceru/notedeck.git
synced 2026-01-15 22:34:19 +01:00
@@ -72,18 +72,20 @@ pub fn render_timeline_route(
|
||||
}
|
||||
|
||||
TimelineRoute::Thread(id) => {
|
||||
if let Some(bar_action) =
|
||||
let timeline_response =
|
||||
ui::ThreadView::new(threads, ndb, note_cache, img_cache, id.bytes(), textmode)
|
||||
.id_source(egui::Id::new(("threadscroll", col)))
|
||||
.ui(ui)
|
||||
{
|
||||
.ui(ui);
|
||||
if let Some(bar_action) = timeline_response.bar_action {
|
||||
let txn = Transaction::new(ndb).expect("txn");
|
||||
let mut cur_column = columns.columns_mut();
|
||||
let router = cur_column[col].router_mut();
|
||||
bar_action.execute_and_process_result(ndb, router, threads, note_cache, pool, &txn);
|
||||
}
|
||||
|
||||
None
|
||||
timeline_response
|
||||
.open_profile
|
||||
.map(AfterRouteExecution::OpenProfile)
|
||||
}
|
||||
|
||||
TimelineRoute::Reply(id) => {
|
||||
@@ -164,7 +166,8 @@ pub fn render_profile_route(
|
||||
col: usize,
|
||||
ui: &mut egui::Ui,
|
||||
) -> Option<AfterRouteExecution> {
|
||||
let timeline_response = ProfileView::new(pubkey, id, columns, ndb, note_cache, img_cache).ui(ui);
|
||||
let timeline_response =
|
||||
ProfileView::new(pubkey, id, columns, ndb, note_cache, img_cache).ui(ui);
|
||||
if let Some(bar_action) = timeline_response.bar_action {
|
||||
let txn = nostrdb::Transaction::new(ndb).expect("txn");
|
||||
let mut cur_column = columns.columns_mut();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use crate::{
|
||||
actionbar::BarAction, imgcache::ImageCache, notecache::NoteCache, thread::Threads, ui,
|
||||
actionbar::{BarAction, TimelineResponse}, imgcache::ImageCache, notecache::NoteCache, thread::Threads, ui,
|
||||
};
|
||||
use enostr::Pubkey;
|
||||
use nostrdb::{Ndb, NoteKey, Transaction};
|
||||
use tracing::{error, warn};
|
||||
|
||||
@@ -41,9 +42,10 @@ impl<'a> ThreadView<'a> {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn ui(&mut self, ui: &mut egui::Ui) -> Option<BarAction> {
|
||||
pub fn ui(&mut self, ui: &mut egui::Ui) -> TimelineResponse {
|
||||
let txn = Transaction::new(self.ndb).expect("txn");
|
||||
let mut action: Option<BarAction> = None;
|
||||
let mut open_profile = None;
|
||||
|
||||
let selected_note_key = if let Ok(key) = self
|
||||
.ndb
|
||||
@@ -53,7 +55,7 @@ impl<'a> ThreadView<'a> {
|
||||
key
|
||||
} else {
|
||||
// TODO: render 404 ?
|
||||
return None;
|
||||
return TimelineResponse::default();
|
||||
};
|
||||
|
||||
ui.label(
|
||||
@@ -124,6 +126,9 @@ impl<'a> ThreadView<'a> {
|
||||
if let Some(bar_action) = note_response.action {
|
||||
action = Some(bar_action);
|
||||
}
|
||||
if note_response.clicked_profile {
|
||||
open_profile = Some(Pubkey::new(*note.pubkey()))
|
||||
}
|
||||
|
||||
if let Some(selection) = note_response.context_selection {
|
||||
selection.process(ui, ¬e);
|
||||
@@ -138,6 +143,9 @@ impl<'a> ThreadView<'a> {
|
||||
);
|
||||
});
|
||||
|
||||
action
|
||||
TimelineResponse {
|
||||
bar_action: action,
|
||||
open_profile,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user