Update euphoxide to version with id newtype wrappers
This commit is contained in:
parent
2d88513a28
commit
374c4c4f79
10 changed files with 131 additions and 114 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use std::iter;
|
||||
|
||||
use crossterm::style::{Color, ContentStyle, Stylize};
|
||||
use euphoxide::api::{SessionType, SessionView, UserId};
|
||||
use euphoxide::api::{SessionId, SessionType, SessionView};
|
||||
use euphoxide::conn::Joined;
|
||||
use toss::styled::Styled;
|
||||
|
||||
|
|
@ -12,13 +12,13 @@ use crate::ui::widgets::list::{List, ListState};
|
|||
use crate::ui::widgets::text::Text;
|
||||
use crate::ui::widgets::BoxedWidget;
|
||||
|
||||
pub fn widget(state: &ListState<UserId>, joined: &Joined, focused: bool) -> BoxedWidget {
|
||||
pub fn widget(state: &ListState<SessionId>, joined: &Joined, focused: bool) -> BoxedWidget {
|
||||
let mut list = state.widget().focus(focused);
|
||||
render_rows(&mut list, joined);
|
||||
list.into()
|
||||
}
|
||||
|
||||
fn render_rows(list: &mut List<UserId>, joined: &Joined) {
|
||||
fn render_rows(list: &mut List<SessionId>, joined: &Joined) {
|
||||
let mut people = vec![];
|
||||
let mut bots = vec![];
|
||||
let mut lurkers = vec![];
|
||||
|
|
@ -49,7 +49,7 @@ fn render_rows(list: &mut List<UserId>, joined: &Joined) {
|
|||
}
|
||||
|
||||
fn render_section(
|
||||
list: &mut List<UserId>,
|
||||
list: &mut List<SessionId>,
|
||||
name: &str,
|
||||
sessions: &[&SessionView],
|
||||
own_session: &SessionView,
|
||||
|
|
@ -74,7 +74,7 @@ fn render_section(
|
|||
}
|
||||
}
|
||||
|
||||
fn render_row(list: &mut List<UserId>, session: &SessionView, own_session: &SessionView) {
|
||||
fn render_row(list: &mut List<SessionId>, session: &SessionView, own_session: &SessionView) {
|
||||
let (name, style, style_inv, perms_style_inv) = if session.name.is_empty() {
|
||||
let name = "lurk";
|
||||
let style = ContentStyle::default().grey();
|
||||
|
|
@ -111,7 +111,7 @@ fn render_row(list: &mut List<UserId>, session: &SessionView, own_session: &Sess
|
|||
.then(name, style_inv)
|
||||
.then(perms, perms_style_inv);
|
||||
list.add_sel(
|
||||
session.id.clone(),
|
||||
session.session_id.clone(),
|
||||
Text::new(normal),
|
||||
Background::new(Text::new(selected)).style(style_inv),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue