feat(client): icon buttons, emoji picker, reactions and a redesigned voice room

- Replace every hand drawn symbol and unicode glyph with Lucide icons via
  Symbol, with tooltips on icon buttons (built-in Tooltip, which does not
  swallow clicks), a proper gear and a clear log-out button for leaving a
  server.
- Center text and controls vertically in channel rows, headers, the user
  panel and friend rows.
- Message actions: quick reactions, add reaction, reply, edit and delete as
  icons. The bar stays visible while the pointer is over its buttons.
- Emoji picker with categories and Russian and English search for the
  composer and for reactions. Reactions are shown under the message and
  toggle on click (ReactionAdd or ReactionRemove).
- Remove the keyboard hint under the composer, add a placeholder and a
  growing editor with emoji and send buttons.
- Voice room: participant cards with avatar and speaking ring, round icon
  controls with off states in red, accent gradient background.
- One AvatarView everywhere (including voice cards and members). The local
  user is listed as online in the member list.
- Real checkbox on the connect screen, theme overlay colour for the trust
  dialog, accent primary button.
- ui_smoke now renders screens in all four themes and checks the member
  status, the action bar and the picker with real pointer input.
This commit is contained in:
Loki 2026-10-25 10:26:02 +01:00
parent 4462ef4708
commit 220af2d6a4
Signed by: boba
GPG key ID: 253067914055423B
24 changed files with 1120 additions and 258 deletions

View file

@ -407,6 +407,35 @@ fn process_net_event(ui: &mut UiState, net: &NetHandle, event: NetEvent) {
}
}
/// Reaction click: removes the local user's reaction when it is already set, adds it otherwise.
pub fn reaction_command(
ui: &UiState,
own_user_id: &str,
channel_id: String,
message_id: String,
emoji: String,
) -> NetCommand {
let already = ui
.messages
.get(&channel_id)
.and_then(|messages| messages.iter().find(|m| m.message_id == message_id))
.and_then(|m| m.reactions.get(&emoji))
.is_some_and(|users| users.iter().any(|u| u == own_user_id));
if already {
NetCommand::ReactionRemove {
channel_id,
message_id,
emoji,
}
} else {
NetCommand::ReactionAdd {
channel_id,
message_id,
emoji,
}
}
}
fn into_msg(m: ChatMsg) -> ChatMessage {
ChatMessage {
message_id: m.message_id,
@ -1070,3 +1099,42 @@ mod voice_pipeline_tests {
assert!(!pipeline_should_stop(Some("a"), None));
}
}
#[cfg(test)]
mod reaction_tests {
use super::*;
fn message_with(reactions: &[(&str, &[&str])]) -> ChatMessage {
ChatMessage {
message_id: "m1".into(),
sender_id: "other".into(),
content: "hi".into(),
timestamp: 0,
edited: false,
reactions: reactions
.iter()
.map(|(emoji, users)| {
(
(*emoji).to_string(),
users.iter().map(|u| (*u).to_string()).collect(),
)
})
.collect(),
reply_to: None,
}
}
#[test]
fn clicking_a_reaction_toggles_the_local_users_vote() {
let mut ui = UiState::default();
ui.messages.insert(
"ch".into(),
vec![message_with(&[("👍", &["me", "x"]), ("🔥", &["x"])])],
);
let command =
|emoji: &str| reaction_command(&ui, "me", "ch".into(), "m1".into(), emoji.into());
assert!(matches!(command("👍"), NetCommand::ReactionRemove { .. }));
assert!(matches!(command("🔥"), NetCommand::ReactionAdd { .. }));
assert!(matches!(command("😀"), NetCommand::ReactionAdd { .. }));
}
}