Skip to content

Commit

Permalink
refactor: rename widgets to ui
Browse files Browse the repository at this point in the history
consolidate ui related things like widgets into our ui module

Signed-off-by: William Casarin <[email protected]>
  • Loading branch information
jb55 committed Apr 12, 2024
1 parent 9b7c63c commit 4e7d168
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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));
}
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ mod error;
//mod note;
//mod block;
mod abbrev;
mod widgets;
mod fonts;
mod images;
mod result;
Expand Down
6 changes: 6 additions & 0 deletions src/ui.rs → src/ui/mod.rs
Original file line number Diff line number Diff line change
@@ -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>(
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/widgets/note/mod.rs → src/ui/note/mod.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down Expand Up @@ -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),
)
Expand Down Expand Up @@ -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),
);

Expand Down
File renamed without changes.
5 changes: 0 additions & 5 deletions src/widgets/mod.rs

This file was deleted.

0 comments on commit 4e7d168

Please sign in to comment.