More chat icons; message menu inside the bubble
- 18 more icons (gamepad, computer, food, ...) with a test that keeps the server whitelist and the client picker identical. - The ⋯ menu of a message moves into the bubble foot (next to the time); its popup opens upwards inside the bubble and is limited to the bubble's width. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
44dd6978d4
commit
1b3e3af4b7
7 files changed
+180
-22
No files matched your search
@@ -205,6 +205,7 @@ pub const SESSION_COLORS: &[&str] = &["red", "orange", "yellow", "green", "aqua"
|
||||
pub const SESSION_ICONS: &[&str] = &[
|
||||
"robot", "brain", "terminal", "wrench", "gear", "chart", "shield", "image", "music", "cube", "file-text", "folder", "search", "sparkle", "clock", "lock",
|
||||
"users", "toolbox", "plug", "scroll", "eye", "template",
|
||||
"gamepad", "computer", "food", "coffee", "home", "book", "code", "camera", "cart", "heart", "star", "globe", "calendar", "car", "plane", "bulb", "money", "palette",
|
||||
];
|
||||
|
||||
impl Session {
|
||||
@@ -299,3 +300,23 @@ pub fn new_id() -> String {
|
||||
pub fn now_ms() -> i64 {
|
||||
chrono::Utc::now().timestamp_millis()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod icon_tests {
|
||||
use super::*;
|
||||
|
||||
/// The client's picker (ColorSwatches.tsx) and the server's whitelist must list the same names.
|
||||
#[test]
|
||||
fn session_icons_match_the_client() {
|
||||
let ts = include_str!("../../web/src/components/ColorSwatches.tsx");
|
||||
let list = ts.split("SESSION_ICONS = [").nth(1).and_then(|r| r.split("] as const").next()).expect("icon list in ColorSwatches.tsx");
|
||||
let mut client: Vec<&str> = list.split('"').skip(1).step_by(2).collect();
|
||||
let mut server: Vec<&str> = SESSION_ICONS.to_vec();
|
||||
client.sort();
|
||||
server.sort();
|
||||
assert_eq!(client, server);
|
||||
let mut dedup = server.clone();
|
||||
dedup.dedup();
|
||||
assert_eq!(dedup.len(), server.len(), "duplicate icon names");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user