diff --git a/src/ui.rs b/src/ui.rs index 2c836d3..3047f82 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -24,7 +24,7 @@ pub const COMMAND_MESSAGE_NAME: &str = "console_command"; pub const COMMAND_RESULT_NAME: &str = "console_result"; #[derive(Default, Resource)] -pub(crate) struct ConsoleUiState { +pub struct ConsoleUiState { /// Wherever the console is open or not. pub(crate) open: bool, /// Whether we have set focus this open or not. @@ -36,6 +36,13 @@ pub(crate) struct ConsoleUiState { pub(crate) command: String, } +impl ConsoleUiState { + /// Whether the console is currently open or not + pub fn open(&self) -> bool { + self.open + } +} + fn system_time_to_chrono_utc(t: SystemTime) -> chrono::DateTime { let dur = t.duration_since(web_time::SystemTime::UNIX_EPOCH).unwrap(); let (sec, nsec) = (dur.as_secs() as i64, dur.subsec_nanos());