mirror of
https://github.com/youwen5/iamb.git
synced 2025-06-20 13:49:52 -07:00
Support configuring a user's color and name (#19)
This commit is contained in:
parent
739aab1534
commit
504b520fe1
8 changed files with 343 additions and 98 deletions
|
@ -51,19 +51,16 @@ use modalkit::{
|
|||
},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
base::{
|
||||
ChatStore,
|
||||
IambBufferId,
|
||||
IambId,
|
||||
IambInfo,
|
||||
IambResult,
|
||||
ProgramAction,
|
||||
ProgramContext,
|
||||
ProgramStore,
|
||||
RoomAction,
|
||||
},
|
||||
message::user_style,
|
||||
use crate::base::{
|
||||
ChatStore,
|
||||
IambBufferId,
|
||||
IambId,
|
||||
IambInfo,
|
||||
IambResult,
|
||||
ProgramAction,
|
||||
ProgramContext,
|
||||
ProgramStore,
|
||||
RoomAction,
|
||||
};
|
||||
|
||||
use self::{room::RoomState, welcome::WelcomeState};
|
||||
|
@ -845,15 +842,18 @@ impl ToString for MemberItem {
|
|||
}
|
||||
|
||||
impl ListItem<IambInfo> for MemberItem {
|
||||
fn show(&self, selected: bool, _: &ViewportContext<ListCursor>, _: &mut ProgramStore) -> Text {
|
||||
let mut style = user_style(self.member.user_id().as_str());
|
||||
fn show(
|
||||
&self,
|
||||
selected: bool,
|
||||
_: &ViewportContext<ListCursor>,
|
||||
store: &mut ProgramStore,
|
||||
) -> Text {
|
||||
let mut user = store.application.settings.get_user_span(self.member.user_id());
|
||||
|
||||
if selected {
|
||||
style = style.add_modifier(StyleModifier::REVERSED);
|
||||
user.style = user.style.add_modifier(StyleModifier::REVERSED);
|
||||
}
|
||||
|
||||
let user = Span::styled(self.to_string(), style);
|
||||
|
||||
let state = match self.member.membership() {
|
||||
MembershipState::Ban => Span::raw(" (banned)").into(),
|
||||
MembershipState::Invite => Span::raw(" (invited)").into(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue