refactor: rename ui::Note to ui::NoteView
Easier to jump to when using tags. Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -18,6 +18,7 @@ mod key_parsing;
|
|||||||
mod key_storage;
|
mod key_storage;
|
||||||
pub mod login_manager;
|
pub mod login_manager;
|
||||||
mod macos_key_storage;
|
mod macos_key_storage;
|
||||||
|
mod note;
|
||||||
mod notecache;
|
mod notecache;
|
||||||
mod post;
|
mod post;
|
||||||
mod profile;
|
mod profile;
|
||||||
|
|||||||
@@ -347,7 +347,9 @@ pub fn timeline_view(ui: &mut egui::Ui, app: &mut Damus, timeline: usize) {
|
|||||||
|
|
||||||
ui::padding(8.0, ui, |ui| {
|
ui::padding(8.0, ui, |ui| {
|
||||||
let textmode = app.textmode;
|
let textmode = app.textmode;
|
||||||
let resp = ui::Note::new(app, ¬e).note_previews(!textmode).show(ui);
|
let resp = ui::NoteView::new(app, ¬e)
|
||||||
|
.note_previews(!textmode)
|
||||||
|
.show(ui);
|
||||||
|
|
||||||
if let Some(action) = resp.action {
|
if let Some(action) = resp.action {
|
||||||
debug!("bar action: {:?}", action);
|
debug!("bar action: {:?}", action);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ pub use account_switcher::AccountSelectionWidget;
|
|||||||
pub use fixed_window::{FixedWindow, FixedWindowResponse};
|
pub use fixed_window::{FixedWindow, FixedWindowResponse};
|
||||||
pub use global_popup::DesktopGlobalPopup;
|
pub use global_popup::DesktopGlobalPopup;
|
||||||
pub use mention::Mention;
|
pub use mention::Mention;
|
||||||
pub use note::{BarAction, Note, NoteResponse, PostReplyView, PostView};
|
pub use note::{BarAction, NoteResponse, NoteView, PostReplyView, PostView};
|
||||||
pub use preview::{Preview, PreviewApp, PreviewConfig};
|
pub use preview::{Preview, PreviewApp, PreviewConfig};
|
||||||
pub use profile::{profile_preview_controller, ProfilePic, ProfilePreview};
|
pub use profile::{profile_preview_controller, ProfilePic, ProfilePreview};
|
||||||
pub use relay::RelayView;
|
pub use relay::RelayView;
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ fn render_note_preview(
|
|||||||
ui.visuals().noninteractive().bg_stroke.color,
|
ui.visuals().noninteractive().bg_stroke.color,
|
||||||
))
|
))
|
||||||
.show(ui, |ui| {
|
.show(ui, |ui| {
|
||||||
ui::Note::new(app, ¬e)
|
ui::NoteView::new(app, ¬e)
|
||||||
.actionbar(false)
|
.actionbar(false)
|
||||||
.small_pfp(true)
|
.small_pfp(true)
|
||||||
.note_previews(false)
|
.note_previews(false)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use crate::{colors, notecache::CachedNote, ui, ui::View, Damus};
|
|||||||
use egui::{Label, RichText, Sense};
|
use egui::{Label, RichText, Sense};
|
||||||
use nostrdb::{NoteKey, Transaction};
|
use nostrdb::{NoteKey, Transaction};
|
||||||
|
|
||||||
pub struct Note<'a> {
|
pub struct NoteView<'a> {
|
||||||
app: &'a mut Damus,
|
app: &'a mut Damus,
|
||||||
note: &'a nostrdb::Note<'a>,
|
note: &'a nostrdb::Note<'a>,
|
||||||
flags: NoteOptions,
|
flags: NoteOptions,
|
||||||
@@ -23,7 +23,7 @@ pub struct NoteResponse {
|
|||||||
pub action: Option<BarAction>,
|
pub action: Option<BarAction>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> View for Note<'a> {
|
impl<'a> View for NoteView<'a> {
|
||||||
fn ui(&mut self, ui: &mut egui::Ui) {
|
fn ui(&mut self, ui: &mut egui::Ui) {
|
||||||
self.show(ui);
|
self.show(ui);
|
||||||
}
|
}
|
||||||
@@ -114,10 +114,10 @@ fn reply_desc(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Note<'a> {
|
impl<'a> NoteView<'a> {
|
||||||
pub fn new(app: &'a mut Damus, note: &'a nostrdb::Note<'a>) -> Self {
|
pub fn new(app: &'a mut Damus, note: &'a nostrdb::Note<'a>) -> Self {
|
||||||
let flags = NoteOptions::actionbar | NoteOptions::note_previews;
|
let flags = NoteOptions::actionbar | NoteOptions::note_previews;
|
||||||
Note { app, note, flags }
|
Self { app, note, flags }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn actionbar(mut self, enable: bool) -> Self {
|
pub fn actionbar(mut self, enable: bool) -> Self {
|
||||||
@@ -225,7 +225,7 @@ impl<'a> Note<'a> {
|
|||||||
ui,
|
ui,
|
||||||
egui::Id::new((profile_key, note_key)),
|
egui::Id::new((profile_key, note_key)),
|
||||||
pfp_size,
|
pfp_size,
|
||||||
ui::Note::expand_size(),
|
ui::NoteView::expand_size(),
|
||||||
anim_speed,
|
anim_speed,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -39,13 +39,14 @@ impl<'a> PostReplyView<'a> {
|
|||||||
+ ui::PostView::inner_margin()
|
+ ui::PostView::inner_margin()
|
||||||
+ ui::ProfilePic::small_size() / 2.0;
|
+ ui::ProfilePic::small_size() / 2.0;
|
||||||
|
|
||||||
let note_offset =
|
let note_offset = pfp_offset
|
||||||
pfp_offset - ui::ProfilePic::medium_size() / 2.0 - ui::Note::expand_size() / 2.0;
|
- ui::ProfilePic::medium_size() / 2.0
|
||||||
|
- ui::NoteView::expand_size() / 2.0;
|
||||||
|
|
||||||
egui::Frame::none()
|
egui::Frame::none()
|
||||||
.outer_margin(egui::Margin::same(note_offset))
|
.outer_margin(egui::Margin::same(note_offset))
|
||||||
.show(ui, |ui| {
|
.show(ui, |ui| {
|
||||||
ui::Note::new(self.app, self.note)
|
ui::NoteView::new(self.app, self.note)
|
||||||
.actionbar(false)
|
.actionbar(false)
|
||||||
.medium_pfp(true)
|
.medium_pfp(true)
|
||||||
.show(ui);
|
.show(ui);
|
||||||
@@ -111,7 +112,7 @@ impl<'a> PostReplyView<'a> {
|
|||||||
rect.min.y = avail_rect.min.y
|
rect.min.y = avail_rect.min.y
|
||||||
+ (ui::ProfilePic::medium_size() / 2.0
|
+ (ui::ProfilePic::medium_size() / 2.0
|
||||||
+ ui::ProfilePic::medium_size()
|
+ ui::ProfilePic::medium_size()
|
||||||
+ ui::Note::expand_size() * 2.0)
|
+ ui::NoteView::expand_size() * 2.0)
|
||||||
+ 1.0;
|
+ 1.0;
|
||||||
|
|
||||||
// For some reason we need to nudge the reply line's height a
|
// For some reason we need to nudge the reply line's height a
|
||||||
|
|||||||
Reference in New Issue
Block a user