diff --git a/src/app/browser/window/tab/item/page/status.rs b/src/app/browser/window/tab/item/page/status.rs index d0212a62..bef4d7b7 100644 --- a/src/app/browser/window/tab/item/page/status.rs +++ b/src/app/browser/window/tab/item/page/status.rs @@ -1,6 +1,8 @@ -/// Global dependencies +// Global dependencies use super::client::{status::Gemini, Status as Client}; +use crate::tool::format_time; use gtk::glib::DateTime; +use std::fmt::{Display, Formatter, Result}; /// `Page` status pub enum Status { @@ -44,3 +46,34 @@ impl Status { } } } + +impl Display for Status { + fn fmt(&self, f: &mut Formatter) -> Result { + match self { + Self::Client(client) => { + write!(f, "{client}") + } + Self::Failure { time } => { + write!(f, "[{}] Failure", format_time(time)) + } + Self::Input { time } => { + write!(f, "[{}] Input issue", format_time(time)) + } + Self::Loading { time } => { + write!(f, "[{}] Loading...", format_time(time)) + } + Self::New { time } => { + write!(f, "[{}] New page", format_time(time)) + } + Self::SessionRestore { time } => { + write!(f, "[{}] Session restore...", format_time(time)) + } + Self::SessionRestored { time } => { + write!(f, "[{}] Session restored", format_time(time)) + } + Self::Success { time } => { + write!(f, "[{}] Success", format_time(time)) + } + } + } +}