From 1228f83e5006794825a03e1142013943eccf3998 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Mon, 24 Jun 2024 17:11:01 -0700 Subject: [PATCH] refactor: move fixed_window to ui This is a ui module Signed-off-by: William Casarin --- src/lib.rs | 1 - src/{ => ui}/fixed_window.rs | 0 src/ui/global_popup.rs | 10 +++------- src/ui/mod.rs | 2 ++ 4 files changed, 5 insertions(+), 8 deletions(-) rename src/{ => ui}/fixed_window.rs (100%) diff --git a/src/lib.rs b/src/lib.rs index bb1cde9f..ef7425b7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,7 +10,6 @@ mod app_style; mod colors; mod draft; mod filter; -mod fixed_window; mod fonts; mod frame_history; mod images; diff --git a/src/fixed_window.rs b/src/ui/fixed_window.rs similarity index 100% rename from src/fixed_window.rs rename to src/ui/fixed_window.rs diff --git a/src/ui/global_popup.rs b/src/ui/global_popup.rs index d439077d..0e648a61 100644 --- a/src/ui/global_popup.rs +++ b/src/ui/global_popup.rs @@ -3,11 +3,7 @@ use std::{cell::RefCell, rc::Rc}; use egui::Sense; use egui_nav::{Nav, NavAction}; -use crate::{ - fixed_window::{FixedWindow, FixedWindowResponse}, - route::Route, - Damus, -}; +use crate::{route::Route, ui, Damus}; static MARGIN: f32 = 200.0; @@ -25,7 +21,7 @@ impl DesktopGlobalPopup { let app_ctx = Rc::new(RefCell::new(app)); - let resp = FixedWindow::maybe_with_title(title).show(ui, rect, |ui| { + let resp = ui::FixedWindow::maybe_with_title(title).show(ui, rect, |ui| { let nav_response = Nav::new(routes) .title(false) @@ -49,7 +45,7 @@ impl DesktopGlobalPopup { let mut app = app_ctx.borrow_mut(); - if resp == FixedWindowResponse::Closed { + if resp == ui::FixedWindowResponse::Closed { app.global_nav.pop(); app.show_global_popup = false; } diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 7f5bdd54..8e1637ec 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -2,6 +2,7 @@ pub mod account_login_view; pub mod account_management; pub mod account_switcher; pub mod anim; +pub mod fixed_window; pub mod global_popup; pub mod mention; pub mod note; @@ -13,6 +14,7 @@ pub mod username; pub use account_management::AccountManagementView; pub use account_switcher::AccountSelectionWidget; +pub use fixed_window::{FixedWindow, FixedWindowResponse}; pub use global_popup::DesktopGlobalPopup; pub use mention::Mention; pub use note::{BarAction, Note, NoteResponse, PostView};