add nav drawer router

Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
kernelkind
2025-09-22 12:07:39 -04:00
parent 3540290f0a
commit dd2960d266
2 changed files with 33 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ pub mod profile;
pub mod relay_debug;
pub mod relayspec;
mod result;
mod route;
mod setup;
pub mod storage;
mod style;
@@ -78,6 +79,7 @@ pub use profile::get_profile_url;
pub use relay_debug::RelayDebugView;
pub use relayspec::RelaySpec;
pub use result::Result;
pub use route::DrawerRouter;
pub use storage::{AccountStorage, DataPath, DataPathType, Directory};
pub use style::NotedeckTextStyle;
pub use theme::ColorTheme;

View File

@@ -0,0 +1,31 @@
#[derive(Clone, Debug, Default)]
pub struct DrawerRouter {
pub returning: bool,
pub navigating: bool,
pub drawer_focused: bool,
}
impl DrawerRouter {
pub fn open(&mut self) {
self.navigating = true;
}
pub fn close(&mut self) {
self.returning = true;
}
pub fn closed(&mut self) {
self.clear();
self.drawer_focused = false;
}
fn clear(&mut self) {
self.navigating = false;
self.returning = false;
}
pub fn opened(&mut self) {
self.clear();
self.drawer_focused = true;
}
}