diff --git a/src/ui/room.rs b/src/ui/room.rs
index 6ff00d4..3648b46 100644
--- a/src/ui/room.rs
+++ b/src/ui/room.rs
@@ -5,7 +5,6 @@ use crossterm::event::{KeyCode, KeyEvent};
use crossterm::style::{Color, ContentStyle, Stylize};
use parking_lot::FairMutex;
use tokio::sync::mpsc;
-use toss::frame::{Frame, Pos, Size};
use toss::styled::Styled;
use toss::terminal::Terminal;
@@ -16,10 +15,11 @@ use crate::vault::{EuphMsg, EuphVault};
use super::chat::ChatState;
use super::widgets::background::Background;
use super::widgets::empty::Empty;
+use super::widgets::join::{HJoin, Segment, VJoin};
use super::widgets::list::{List, ListState};
use super::widgets::rules::{HRule, VRule};
use super::widgets::text::Text;
-use super::widgets::Widget;
+use super::widgets::BoxedWidget;
use super::{util, UiEvent};
pub struct EuphRoom {
@@ -75,82 +75,43 @@ impl EuphRoom {
}
}
- pub async fn render(&mut self, frame: &mut Frame) {
+ pub async fn widget(&self) -> BoxedWidget {
let status = self.status().await;
match &status {
- Some(Some(Status::Joined(joined))) => {
- self.render_with_nick_list(frame, &status, joined).await
- }
- _ => self.render_without_nick_list(frame, &status).await,
+ Some(Some(Status::Joined(joined))) => self.widget_with_nick_list(&status, joined),
+ _ => self.widget_without_nick_list(&status),
}
}
- async fn render_without_nick_list(
- &mut self,
- frame: &mut Frame,
- status: &Option