diff --git a/src/ui/euph/popup.rs b/src/ui/euph/popup.rs index d5cbe76..ebf507c 100644 --- a/src/ui/euph/popup.rs +++ b/src/ui/euph/popup.rs @@ -1,37 +1,33 @@ use crossterm::style::Stylize; -use toss::{Style, Styled}; +use toss::widgets::{BoxedAsync, Text}; +use toss::{Style, Styled, WidgetExt}; -use crate::ui::widgets::float::Float; -use crate::ui::widgets::popup::Popup; -use crate::ui::widgets::text::Text; -use crate::ui::widgets::BoxedWidget; +use crate::ui::widgets2::Popup; +use crate::ui::UiError; pub enum RoomPopup { Error { description: String, reason: String }, } impl RoomPopup { - fn server_error_widget(description: &str, reason: &str) -> BoxedWidget { + fn server_error_widget(description: &str, reason: &str) -> BoxedAsync<'static, UiError> { let border_style = Style::new().red().bold(); let text = Styled::new_plain(description) .then_plain("\n\n") .then("Reason:", Style::new().bold()) .then_plain(" ") .then_plain(reason); - Popup::new(Text::new(text)) - .title(("Error", border_style)) - .border(border_style) - .build() + Popup::new(Text::new(text), ("Error", border_style)) + .with_border_style(border_style) + .boxed_async() } - pub fn widget(&self) -> BoxedWidget { - let widget = match self { + pub fn widget(&self) -> BoxedAsync<'static, UiError> { + match self { Self::Error { description, reason, } => Self::server_error_widget(description, reason), - }; - - Float::new(widget).horizontal(0.5).vertical(0.5).into() + } } } diff --git a/src/ui/euph/room.rs b/src/ui/euph/room.rs index 17462fa..1203acb 100644 --- a/src/ui/euph/room.rs +++ b/src/ui/euph/room.rs @@ -16,7 +16,6 @@ use crate::euph; use crate::macros::logging_unwrap; use crate::ui::chat2::{ChatState, Reaction}; use crate::ui::input::{key, InputEvent, KeyBindingsList}; -use crate::ui::widgets::WidgetWrapper; use crate::ui::widgets2::ListState; use crate::ui::{util2, UiError, UiEvent}; use crate::vault::EuphRoomVault; @@ -233,7 +232,7 @@ impl EuphRoom { } for popup in &self.popups { - layers.push(WidgetWrapper::new(popup.widget()).boxed_async()); + layers.push(popup.widget()); } Layer::new(layers).boxed_async()