Move domains in front of room names in the UI
The reasoning behind this change in the room list is that putting the domain (which rarely changes) in front of the room name (which often changes) is a lot more readable. It also moves it away from the status info parentheses, making them more obvious again. The reasoning for the individual room view is consistency. Putting the domain at the end here looked fine, but putting it in front matches the room list and still looks fine.
This commit is contained in:
parent
2d2dab11ba
commit
88ba77b955
3 changed files with 15 additions and 11 deletions
0
cove-config/CONFIG.md
Normal file
0
cove-config/CONFIG.md
Normal file
|
|
@ -287,7 +287,8 @@ impl EuphRoom {
|
||||||
|
|
||||||
async fn status_widget(&self, state: Option<&euph::State>) -> impl Widget<UiError> {
|
async fn status_widget(&self, state: Option<&euph::State>) -> impl Widget<UiError> {
|
||||||
let room_style = Style::new().bold().blue();
|
let room_style = Style::new().bold().blue();
|
||||||
let mut info = Styled::new(format!("&{}", self.name()), room_style);
|
let mut info = Styled::new(format!("{} ", self.domain()), Style::new().grey())
|
||||||
|
.then(format!("&{}", self.name()), room_style);
|
||||||
|
|
||||||
info = match state {
|
info = match state {
|
||||||
None | Some(euph::State::Stopped) => info.then_plain(", archive"),
|
None | Some(euph::State::Stopped) => info.then_plain(", archive"),
|
||||||
|
|
@ -310,8 +311,6 @@ impl EuphRoom {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
info = info.then(format!(" - {}", self.domain()), Style::new().grey());
|
|
||||||
|
|
||||||
let unseen = self.unseen_msgs_count().await;
|
let unseen = self.unseen_msgs_count().await;
|
||||||
if unseen > 0 {
|
if unseen > 0 {
|
||||||
info = info
|
info = info
|
||||||
|
|
|
||||||
|
|
@ -356,10 +356,9 @@ impl Rooms {
|
||||||
|
|
||||||
fn sort_rooms(rooms: &mut [(&RoomIdentifier, Option<&euph::State>, usize)], order: Order) {
|
fn sort_rooms(rooms: &mut [(&RoomIdentifier, Option<&euph::State>, usize)], order: Order) {
|
||||||
match order {
|
match order {
|
||||||
Order::Alphabet => rooms.sort_unstable_by_key(|(id, _, _)| (&id.name, &id.domain)),
|
Order::Alphabet => rooms.sort_unstable_by_key(|(id, _, _)| *id),
|
||||||
Order::Importance => rooms.sort_unstable_by_key(|(id, state, unseen)| {
|
Order::Importance => rooms
|
||||||
(state.is_none(), *unseen == 0, &id.name, &id.domain)
|
.sort_unstable_by_key(|(id, state, unseen)| (state.is_none(), *unseen == 0, *id)),
|
||||||
}),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -379,15 +378,21 @@ impl Rooms {
|
||||||
let id = id.clone();
|
let id = id.clone();
|
||||||
let info = Self::format_room_info(state, unseen);
|
let info = Self::format_room_info(state, unseen);
|
||||||
list_builder.add_sel(id.clone(), move |selected| {
|
list_builder.add_sel(id.clone(), move |selected| {
|
||||||
let style = if selected {
|
let domain_style = if selected {
|
||||||
|
Style::new().black().on_white()
|
||||||
|
} else {
|
||||||
|
Style::new().grey()
|
||||||
|
};
|
||||||
|
|
||||||
|
let room_style = if selected {
|
||||||
Style::new().bold().black().on_white()
|
Style::new().bold().black().on_white()
|
||||||
} else {
|
} else {
|
||||||
Style::new().bold().blue()
|
Style::new().bold().blue()
|
||||||
};
|
};
|
||||||
|
|
||||||
let text = Styled::new(format!("&{}", id.name), style)
|
let text = Styled::new(format!("{} ", id.domain), domain_style)
|
||||||
.and_then(info)
|
.then(format!("&{}", id.name), room_style)
|
||||||
.then(format!(" - {}", id.domain), Style::new().grey());
|
.and_then(info);
|
||||||
|
|
||||||
Text::new(text)
|
Text::new(text)
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue