refactor: rename widgets to ui

consolidate ui related things like widgets into our ui module

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-04-12 16:16:19 -07:00
parent 9b7c63c800
commit 4e7d168d22
7 changed files with 11 additions and 11 deletions

View File

@@ -5,7 +5,7 @@ use crate::frame_history::FrameHistory;
use crate::imgcache::ImageCache;
use crate::notecache::NoteCache;
use crate::timeline;
use crate::widgets;
use crate::ui;
use crate::Result;
use egui::containers::scroll_area::ScrollBarVisibility;
@@ -522,7 +522,7 @@ fn render_notes(ui: &mut egui::Ui, damus: &mut Damus, timeline: usize) {
let num_notes = damus.timelines[timeline].notes.len();
for i in 0..num_notes {
let note = widgets::Note::new(damus, damus.timelines[timeline].notes[i].key, timeline);
let note = ui::Note::new(damus, damus.timelines[timeline].notes[i].key, timeline);
ui.add(note);
ui.add(egui::Separator::default().spacing(0.0));
}

View File

@@ -4,7 +4,6 @@ mod error;
//mod note;
//mod block;
mod abbrev;
mod widgets;
mod fonts;
mod images;
mod result;

View File

@@ -1,3 +1,9 @@
pub mod note;
pub mod username;
pub use note::Note;
pub use username::Username;
use egui::Margin;
pub fn padding<R>(

View File

@@ -1,7 +1,7 @@
pub mod contents;
pub use contents::NoteContents;
use crate::{widgets, Damus};
use crate::{ui, Damus};
use egui::{Color32, Label, RichText, Sense, TextureHandle, Vec2};
use nostrdb::{NoteKey, Transaction};
@@ -65,7 +65,7 @@ impl<'a> Note<'a> {
ui.allocate_rect(rect, Sense::hover());
ui.put(rect, |ui: &mut egui::Ui| {
ui.add(
widgets::Username::new(profile.as_ref().ok(), note.pubkey())
ui::Username::new(profile.as_ref().ok(), note.pubkey())
.abbreviated(8)
.pk_colored(true),
)
@@ -114,7 +114,7 @@ impl<'a> Note<'a> {
ui.horizontal(|ui| {
ui.spacing_mut().item_spacing.x = 2.0;
ui.add(
widgets::Username::new(profile.as_ref().ok(), note.pubkey())
ui::Username::new(profile.as_ref().ok(), note.pubkey())
.abbreviated(20),
);

View File

@@ -1,5 +0,0 @@
pub mod note;
pub mod username;
pub use note::Note;
pub use username::Username;