feat(icons): filled rail icon for the active app like Teams
- filled/<icon> asset paths serve the Material fill variant, falling back to the outline - rail fill variants for Activity, Chat, Teams, Calendar, Calls, Agents Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -8,7 +8,7 @@ macro_rules! symbols {
8
8
};
9
9
}
10
10
11
const SYMBOLS: [(&str, &[u8]); 200] = symbols![
11
const SYMBOLS: [(&str, &[u8]); 206] = symbols![
12
12
"account_circle",
13
13
"add",
14
14
"alarm",
@@ -35,13 +35,16 @@ const SYMBOLS: [(&str, &[u8]); 200] = symbols![
35
35
"calendar_add_on",
36
36
"calendar_clock",
37
37
"calendar_month",
38
"calendar_month_fill",
38
39
"call",
39
40
"call_end",
41
"call_fill",
40
42
"call_missed",
41
43
"campaign",
42
44
"cancel",
43
45
"cancel_presentation",
44
46
"chat_bubble",
47
"chat_bubble_fill",
45
48
"check",
46
49
"check_circle",
47
50
"chevron_left",
@@ -96,6 +99,7 @@ const SYMBOLS: [(&str, &[u8]); 200] = symbols![
96
99
"grid_off",
97
100
"grid_view",
98
101
"group",
102
"group_fill",
99
103
"headphones",
100
104
"help",
101
105
"home",
@@ -135,6 +139,7 @@ const SYMBOLS: [(&str, &[u8]); 200] = symbols![
135
139
"notification_important_fill",
136
140
"notifications",
137
141
"notifications_active",
142
"notifications_fill",
138
143
"notifications_off",
139
144
"open_in_full",
140
145
"open_in_new",
@@ -168,6 +173,7 @@ const SYMBOLS: [(&str, &[u8]); 200] = symbols![
168
173
"share",
169
174
"shield",
170
175
"smart_toy",
176
"smart_toy_fill",
171
177
"spinner_arc",
172
178
"spinner_track",
173
179
"star",
@@ -387,10 +393,18 @@ fn at_lucide_size(svg: &[u8]) -> Vec<u8> {
387
393
}
388
394
}
389
395
396
pub const FILLED_PREFIX: &str = "filled/";
397
390
398
pub struct AppAssets;
391
399
392
400
impl AssetSource for AppAssets {
393
401
fn load(&self, path: &str) -> Result<Option<Cow<'static, [u8]>>> {
402
if let Some(stem) = path.strip_prefix(FILLED_PREFIX)
403
&& let Some((_, material)) = LUCIDE_AS_MATERIAL.iter().find(|(lucide, _)| lucide.strip_prefix("icons/") == Some(stem))
404
{
405
let filled = material.replace(".svg", "_fill.svg");
406
return Ok(symbol_bytes(&filled).or_else(|| symbol_bytes(material)).map(|bytes| Cow::Owned(at_lucide_size(bytes))));
407
}
394
408
if let Some((_, material)) = LUCIDE_AS_MATERIAL.iter().find(|(lucide, _)| *lucide == path) {
395
409
return Ok(symbol_bytes(material).map(|bytes| Cow::Owned(at_lucide_size(bytes))));
396
410
}
@@ -416,6 +430,14 @@ impl AssetSource for AppAssets {
416
430
mod tests {
417
431
use super::*;
418
432
433
#[test]
434
fn filled_icons_use_the_fill_variant_and_fall_back_to_the_outline() {
435
let filled = AppAssets.load("filled/bell.svg").unwrap().unwrap();
436
let outline = AppAssets.load("icons/bell.svg").unwrap().unwrap();
437
assert_ne!(filled, outline);
438
assert_eq!(AppAssets.load("filled/search.svg").unwrap().unwrap(), AppAssets.load("icons/search.svg").unwrap().unwrap());
439
}
440
419
441
#[test]
420
442
fn every_lucide_icon_we_replace_loads_a_bundled_material_symbol() {
421
443
for (lucide, material) in LUCIDE_AS_MATERIAL {
@@ -8,7 +8,7 @@ macro_rules! symbols {8
};8
};9
}9
}10
10
11
const SYMBOLS: [(&str, &[u8]); 200] = symbols![11
const SYMBOLS: [(&str, &[u8]); 206] = symbols![12
"account_circle",12
"account_circle",13
"add",13
"add",14
"alarm",14
"alarm",@@ -35,13 +35,16 @@ const SYMBOLS: [(&str, &[u8]); 200] = symbols![35
"calendar_add_on",35
"calendar_add_on",36
"calendar_clock",36
"calendar_clock",37
"calendar_month",37
"calendar_month",38
"calendar_month_fill",38
"call",39
"call",39
"call_end",40
"call_end",41
"call_fill",40
"call_missed",42
"call_missed",41
"campaign",43
"campaign",42
"cancel",44
"cancel",43
"cancel_presentation",45
"cancel_presentation",44
"chat_bubble",46
"chat_bubble",47
"chat_bubble_fill",45
"check",48
"check",46
"check_circle",49
"check_circle",47
"chevron_left",50
"chevron_left",@@ -96,6 +99,7 @@ const SYMBOLS: [(&str, &[u8]); 200] = symbols![96
"grid_off",99
"grid_off",97
"grid_view",100
"grid_view",98
"group",101
"group",102
"group_fill",99
"headphones",103
"headphones",100
"help",104
"help",101
"home",105
"home",@@ -135,6 +139,7 @@ const SYMBOLS: [(&str, &[u8]); 200] = symbols![135
"notification_important_fill",139
"notification_important_fill",136
"notifications",140
"notifications",137
"notifications_active",141
"notifications_active",142
"notifications_fill",138
"notifications_off",143
"notifications_off",139
"open_in_full",144
"open_in_full",140
"open_in_new",145
"open_in_new",@@ -168,6 +173,7 @@ const SYMBOLS: [(&str, &[u8]); 200] = symbols![168
"share",173
"share",169
"shield",174
"shield",170
"smart_toy",175
"smart_toy",176
"smart_toy_fill",171
"spinner_arc",177
"spinner_arc",172
"spinner_track",178
"spinner_track",173
"star",179
"star",@@ -387,10 +393,18 @@ fn at_lucide_size(svg: &[u8]) -> Vec<u8> {387
}393
}388
}394
}389
395
396
pub const FILLED_PREFIX: &str = "filled/";397
390
pub struct AppAssets;398
pub struct AppAssets;391
399
392
impl AssetSource for AppAssets {400
impl AssetSource for AppAssets {393
fn load(&self, path: &str) -> Result<Option<Cow<'static, [u8]>>> {401
fn load(&self, path: &str) -> Result<Option<Cow<'static, [u8]>>> {402
if let Some(stem) = path.strip_prefix(FILLED_PREFIX)403
&& let Some((_, material)) = LUCIDE_AS_MATERIAL.iter().find(|(lucide, _)| lucide.strip_prefix("icons/") == Some(stem))404
{405
let filled = material.replace(".svg", "_fill.svg");406
return Ok(symbol_bytes(&filled).or_else(|| symbol_bytes(material)).map(|bytes| Cow::Owned(at_lucide_size(bytes))));407
}394
if let Some((_, material)) = LUCIDE_AS_MATERIAL.iter().find(|(lucide, _)| *lucide == path) {408
if let Some((_, material)) = LUCIDE_AS_MATERIAL.iter().find(|(lucide, _)| *lucide == path) {395
return Ok(symbol_bytes(material).map(|bytes| Cow::Owned(at_lucide_size(bytes))));409
return Ok(symbol_bytes(material).map(|bytes| Cow::Owned(at_lucide_size(bytes))));396
}410
}@@ -416,6 +430,14 @@ impl AssetSource for AppAssets {416
mod tests {430
mod tests {417
use super::*;431
use super::*;418
432
433
#[test]434
fn filled_icons_use_the_fill_variant_and_fall_back_to_the_outline() {435
let filled = AppAssets.load("filled/bell.svg").unwrap().unwrap();436
let outline = AppAssets.load("icons/bell.svg").unwrap().unwrap();437
assert_ne!(filled, outline);438
assert_eq!(AppAssets.load("filled/search.svg").unwrap().unwrap(), AppAssets.load("icons/search.svg").unwrap().unwrap());439
}440
419
#[test]441
#[test]420
fn every_lucide_icon_we_replace_loads_a_bundled_material_symbol() {442
fn every_lucide_icon_we_replace_loads_a_bundled_material_symbol() {421
for (lucide, material) in LUCIDE_AS_MATERIAL {443
for (lucide, material) in LUCIDE_AS_MATERIAL {@@ -23,6 +23,11 @@ pub fn icon(name: IconName, size: f32, color: Hsla) -> Icon {
23
23
Icon::new(name).size(px(size)).text_color(color)
24
24
}
25
25
26
pub fn filled_icon(name: IconName, size: f32, color: Hsla) -> Icon {
27
let path = name.path().replacen("icons/", app_base::assets::FILLED_PREFIX, 1);
28
Icon::empty().path(path).size(px(size)).text_color(color)
29
}
30
26
31
pub fn menu_icon(name: IconName) -> Icon {
27
32
Icon::new(name)
28
33
}
@@ -23,6 +23,11 @@ pub fn icon(name: IconName, size: f32, color: Hsla) -> Icon {23
Icon::new(name).size(px(size)).text_color(color)23
Icon::new(name).size(px(size)).text_color(color)24
}24
}25
25
26
pub fn filled_icon(name: IconName, size: f32, color: Hsla) -> Icon {27
let path = name.path().replacen("icons/", app_base::assets::FILLED_PREFIX, 1);28
Icon::empty().path(path).size(px(size)).text_color(color)29
}30
26
pub fn menu_icon(name: IconName) -> Icon {31
pub fn menu_icon(name: IconName) -> Icon {27
Icon::new(name)32
Icon::new(name)28
}33
}@@ -0,0 +1 @@
1
<svg xmlns="http://www.w3.org/2000/svg" height="20" viewBox="0 -960 960 960" width="20"><path d="M480.21-380.92q-12.9 0-22.25-9.14-9.34-9.13-9.34-22.04 0-12.9 9.13-22.25 9.14-9.34 22.04-9.34 12.9 0 22.25 9.13 9.34 9.14 9.34 22.04 0 12.91-9.13 22.25-9.14 9.35-22.04 9.35Zm-178.25-9.14q-9.34-9.13-9.34-22.04 0-12.9 9.13-22.25 9.14-9.34 22.04-9.34 12.9 0 22.25 9.13 9.34 9.14 9.34 22.04 0 12.91-9.13 22.25-9.14 9.35-22.04 9.35-12.9 0-22.25-9.14Zm334.25 9.14q-12.9 0-22.25-9.14-9.34-9.13-9.34-22.04 0-12.9 9.13-22.25 9.14-9.34 22.04-9.34 12.9 0 22.25 9.13 9.34 9.14 9.34 22.04 0 12.91-9.13 22.25-9.14 9.35-22.04 9.35ZM480.21-240q-12.9 0-22.25-9.14-9.34-9.13-9.34-22.03 0-12.91 9.13-22.25 9.14-9.35 22.04-9.35 12.9 0 22.25 9.14 9.34 9.13 9.34 22.04 0 12.9-9.13 22.24-9.14 9.35-22.04 9.35Zm-178.25-9.14q-9.34-9.13-9.34-22.03 0-12.91 9.13-22.25 9.14-9.35 22.04-9.35 12.9 0 22.25 9.14 9.34 9.13 9.34 22.04 0 12.9-9.13 22.24-9.14 9.35-22.04 9.35-12.9 0-22.25-9.14ZM636.21-240q-12.9 0-22.25-9.14-9.34-9.13-9.34-22.03 0-12.91 9.13-22.25 9.14-9.35 22.04-9.35 12.9 0 22.25 9.14 9.34 9.13 9.34 22.04 0 12.9-9.13 22.24-9.14 9.35-22.04 9.35Zm-407.9 124q-27.01 0-45.66-19Q164-154 164-180.31v-503.38Q164-710 182.65-729q18.65-19 45.66-19h87.38v-100.61h53.54V-748h223.08v-100.61h52V-748h87.38q27.01 0 45.66 19Q796-710 796-683.69v503.38Q796-154 777.35-135q-18.65 19-45.66 19H228.31Zm0-52h503.38q4.62 0 8.46-3.85 3.85-3.84 3.85-8.46v-335.38H216v335.38q0 4.62 3.85 8.46 3.84 3.85 8.46 3.85Z"/></svg>
@@ -0,0 +1 @@1
<svg xmlns="http://www.w3.org/2000/svg" height="20" viewBox="0 -960 960 960" width="20"><path d="M480.21-380.92q-12.9 0-22.25-9.14-9.34-9.13-9.34-22.04 0-12.9 9.13-22.25 9.14-9.34 22.04-9.34 12.9 0 22.25 9.13 9.34 9.14 9.34 22.04 0 12.91-9.13 22.25-9.14 9.35-22.04 9.35Zm-178.25-9.14q-9.34-9.13-9.34-22.04 0-12.9 9.13-22.25 9.14-9.34 22.04-9.34 12.9 0 22.25 9.13 9.34 9.14 9.34 22.04 0 12.91-9.13 22.25-9.14 9.35-22.04 9.35-12.9 0-22.25-9.14Zm334.25 9.14q-12.9 0-22.25-9.14-9.34-9.13-9.34-22.04 0-12.9 9.13-22.25 9.14-9.34 22.04-9.34 12.9 0 22.25 9.13 9.34 9.14 9.34 22.04 0 12.91-9.13 22.25-9.14 9.35-22.04 9.35ZM480.21-240q-12.9 0-22.25-9.14-9.34-9.13-9.34-22.03 0-12.91 9.13-22.25 9.14-9.35 22.04-9.35 12.9 0 22.25 9.14 9.34 9.13 9.34 22.04 0 12.9-9.13 22.24-9.14 9.35-22.04 9.35Zm-178.25-9.14q-9.34-9.13-9.34-22.03 0-12.91 9.13-22.25 9.14-9.35 22.04-9.35 12.9 0 22.25 9.14 9.34 9.13 9.34 22.04 0 12.9-9.13 22.24-9.14 9.35-22.04 9.35-12.9 0-22.25-9.14ZM636.21-240q-12.9 0-22.25-9.14-9.34-9.13-9.34-22.03 0-12.91 9.13-22.25 9.14-9.35 22.04-9.35 12.9 0 22.25 9.14 9.34 9.13 9.34 22.04 0 12.9-9.13 22.24-9.14 9.35-22.04 9.35Zm-407.9 124q-27.01 0-45.66-19Q164-154 164-180.31v-503.38Q164-710 182.65-729q18.65-19 45.66-19h87.38v-100.61h53.54V-748h223.08v-100.61h52V-748h87.38q27.01 0 45.66 19Q796-710 796-683.69v503.38Q796-154 777.35-135q-18.65 19-45.66 19H228.31Zm0-52h503.38q4.62 0 8.46-3.85 3.85-3.84 3.85-8.46v-335.38H216v335.38q0 4.62 3.85 8.46 3.84 3.85 8.46 3.85Z"/></svg>@@ -0,0 +1 @@
1
<svg xmlns="http://www.w3.org/2000/svg" height="20" viewBox="0 -960 960 960" width="20"><path d="M742.61-165q-109.07-9-209.69-57.58-100.61-48.58-182.38-130.34-81.38-81.77-129.46-182.2Q173-635.54 164-744.61q-2-21 12.5-36.7Q191-797 212-797h104.46q18.15 0 31.23 10.89 13.08 10.88 18.23 28.42L386.85-673q2.38 13.38-1.5 26.15-3.89 12.77-12.66 20.77l-92.38 89.93q22.3 41.84 49.46 78.77 27.15 36.92 59.54 69.07 31.92 31.93 69 59.16 37.08 27.23 80.08 49.54l94.76-92.54q8.39-8.77 19.24-11.7 10.84-2.92 24.23-.92l80.07 17.62q18.15 5 28.73 18.46 10.58 13.46 10.58 32V-213q0 21-16.19 35.5-16.2 14.5-37.2 12.5Z"/></svg>
@@ -0,0 +1 @@1
<svg xmlns="http://www.w3.org/2000/svg" height="20" viewBox="0 -960 960 960" width="20"><path d="M742.61-165q-109.07-9-209.69-57.58-100.61-48.58-182.38-130.34-81.38-81.77-129.46-182.2Q173-635.54 164-744.61q-2-21 12.5-36.7Q191-797 212-797h104.46q18.15 0 31.23 10.89 13.08 10.88 18.23 28.42L386.85-673q2.38 13.38-1.5 26.15-3.89 12.77-12.66 20.77l-92.38 89.93q22.3 41.84 49.46 78.77 27.15 36.92 59.54 69.07 31.92 31.93 69 59.16 37.08 27.23 80.08 49.54l94.76-92.54q8.39-8.77 19.24-11.7 10.84-2.92 24.23-.92l80.07 17.62q18.15 5 28.73 18.46 10.58 13.46 10.58 32V-213q0 21-16.19 35.5-16.2 14.5-37.2 12.5Z"/></svg>@@ -0,0 +1 @@
1
<svg xmlns="http://www.w3.org/2000/svg" height="20" viewBox="0 -960 960 960" width="20"><path d="M116-134.46v-645.23q0-27.01 18.65-45.66Q153.3-844 180.31-844h599.38q27.01 0 45.66 18.65Q844-806.7 844-779.69v455.38q0 27.01-18.65 45.66Q806.7-260 779.69-260H241.54L116-134.46Z"/></svg>
@@ -0,0 +1 @@1
<svg xmlns="http://www.w3.org/2000/svg" height="20" viewBox="0 -960 960 960" width="20"><path d="M116-134.46v-645.23q0-27.01 18.65-45.66Q153.3-844 180.31-844h599.38q27.01 0 45.66 18.65Q844-806.7 844-779.69v455.38q0 27.01-18.65 45.66Q806.7-260 779.69-260H241.54L116-134.46Z"/></svg>@@ -0,0 +1 @@
1
<svg xmlns="http://www.w3.org/2000/svg" height="20" viewBox="0 -960 960 960" width="20"><path d="M127.93-219.69v-68.93q0-22.92 10.96-40.19 10.96-17.27 30.65-28.73 49-28.92 103.15-45.54 54.16-16.61 123.23-16.61 69.08 0 123.23 16.61 54.16 16.62 103.16 45.54 19.69 11.46 30.65 28.73 10.96 17.27 10.96 40.19v68.93H127.93Zm607.99 0v-65.85q0-37.38-14.3-68.57-14.31-31.2-37.7-50.73 28.23 8 55.89 19.57 27.65 11.58 54.5 27.73 17 9.54 27.38 28.92 10.38 19.39 10.38 43.08v65.85h-96.15ZM307.96-528.35q-36.03-36.03-36.03-87.96 0-51.92 36.03-87.96 36.04-36.04 87.96-36.04 51.93 0 87.96 36.04 36.04 36.04 36.04 87.96 0 51.93-36.04 87.96-36.03 36.04-87.96 36.04-51.92 0-87.96-36.04Zm333.31 0q-36.04 36.04-87.96 36.04-3.77 0-4.23.46-.47.46-4.23-.38 21.53-25.54 34.3-56.62 12.77-31.07 12.77-67.46 0-36.38-12.96-67.27-12.96-30.88-34.11-56.8 2.61-.08 4.23 0 1.61.07 4.23.07 51.92 0 87.96 36.04 36.03 36.04 36.03 87.96 0 51.93-36.03 87.96Z"/></svg>
@@ -0,0 +1 @@1
<svg xmlns="http://www.w3.org/2000/svg" height="20" viewBox="0 -960 960 960" width="20"><path d="M127.93-219.69v-68.93q0-22.92 10.96-40.19 10.96-17.27 30.65-28.73 49-28.92 103.15-45.54 54.16-16.61 123.23-16.61 69.08 0 123.23 16.61 54.16 16.62 103.16 45.54 19.69 11.46 30.65 28.73 10.96 17.27 10.96 40.19v68.93H127.93Zm607.99 0v-65.85q0-37.38-14.3-68.57-14.31-31.2-37.7-50.73 28.23 8 55.89 19.57 27.65 11.58 54.5 27.73 17 9.54 27.38 28.92 10.38 19.39 10.38 43.08v65.85h-96.15ZM307.96-528.35q-36.03-36.03-36.03-87.96 0-51.92 36.03-87.96 36.04-36.04 87.96-36.04 51.93 0 87.96 36.04 36.04 36.04 36.04 87.96 0 51.93-36.04 87.96-36.03 36.04-87.96 36.04-51.92 0-87.96-36.04Zm333.31 0q-36.04 36.04-87.96 36.04-3.77 0-4.23.46-.47.46-4.23-.38 21.53-25.54 34.3-56.62 12.77-31.07 12.77-67.46 0-36.38-12.96-67.27-12.96-30.88-34.11-56.8 2.61-.08 4.23 0 1.61.07 4.23.07 51.92 0 87.96 36.04 36.03 36.04 36.03 87.96 0 51.93-36.03 87.96Z"/></svg>@@ -0,0 +1 @@
1
<svg xmlns="http://www.w3.org/2000/svg" height="20" viewBox="0 -960 960 960" width="20"><path d="M212-220.62v-51.99h40.31v-258.47q0-84.69 53.31-148.19 53.3-63.5 136.38-76.81V-806q0-15.83 11.07-26.92Q464.14-844 479.95-844q15.82 0 26.93 11.08Q518-821.83 518-806v49.92q83.08 13.31 136.38 76.81 53.31 63.5 53.31 148.19v258.47H748v51.99H212Zm267.72 112.31q-26.64 0-45.33-18.89-18.7-18.89-18.7-45.42h128.62q0 26.93-18.98 45.62-18.97 18.69-45.61 18.69Z"/></svg>
@@ -0,0 +1 @@1
<svg xmlns="http://www.w3.org/2000/svg" height="20" viewBox="0 -960 960 960" width="20"><path d="M212-220.62v-51.99h40.31v-258.47q0-84.69 53.31-148.19 53.3-63.5 136.38-76.81V-806q0-15.83 11.07-26.92Q464.14-844 479.95-844q15.82 0 26.93 11.08Q518-821.83 518-806v49.92q83.08 13.31 136.38 76.81 53.31 63.5 53.31 148.19v258.47H748v51.99H212Zm267.72 112.31q-26.64 0-45.33-18.89-18.7-18.89-18.7-45.42h128.62q0 26.93-18.98 45.62-18.97 18.69-45.61 18.69Z"/></svg>@@ -0,0 +1 @@
1
<svg xmlns="http://www.w3.org/2000/svg" height="20" viewBox="0 -960 960 960" width="20"><path d="M212-404q-31.92 0-53.96-22.04T136-480q0-31.92 22.04-53.96T212-556v-92q0-21.14 15.43-36.57T264-700h140q0-31.92 22.04-53.96T480-776q31.92 0 53.96 22.04T556-700h140q21.14 0 36.57 15.43T748-648v92q31.92 0 53.96 22.04T824-480q0 31.92-22.04 53.96T748-404v188q0 21.14-15.44 36.57T695.96-164H263.72q-21.16 0-36.44-15.43Q212-194.86 212-216v-188Zm174.88-73.07Q398-488.14 398-503.95q0-15.82-11.07-26.93Q375.86-542 360.05-542q-15.82 0-26.93 11.07Q322-519.86 322-504.05q0 15.82 11.07 26.93Q344.14-466 359.95-466q15.82 0 26.93-11.07Zm228 0Q626-488.14 626-503.95q0-15.82-11.07-26.93Q603.86-542 588.05-542q-15.82 0-26.93 11.07Q550-519.86 550-504.05q0 15.82 11.07 26.93Q572.14-466 587.95-466q15.82 0 26.93-11.07ZM346-322h268v-52H346v52Z"/></svg>
@@ -0,0 +1 @@1
<svg xmlns="http://www.w3.org/2000/svg" height="20" viewBox="0 -960 960 960" width="20"><path d="M212-404q-31.92 0-53.96-22.04T136-480q0-31.92 22.04-53.96T212-556v-92q0-21.14 15.43-36.57T264-700h140q0-31.92 22.04-53.96T480-776q31.92 0 53.96 22.04T556-700h140q21.14 0 36.57 15.43T748-648v92q31.92 0 53.96 22.04T824-480q0 31.92-22.04 53.96T748-404v188q0 21.14-15.44 36.57T695.96-164H263.72q-21.16 0-36.44-15.43Q212-194.86 212-216v-188Zm174.88-73.07Q398-488.14 398-503.95q0-15.82-11.07-26.93Q375.86-542 360.05-542q-15.82 0-26.93 11.07Q322-519.86 322-504.05q0 15.82 11.07 26.93Q344.14-466 359.95-466q15.82 0 26.93-11.07Zm228 0Q626-488.14 626-503.95q0-15.82-11.07-26.93Q603.86-542 588.05-542q-15.82 0-26.93 11.07Q550-519.86 550-504.05q0 15.82 11.07 26.93Q572.14-466 587.95-466q15.82 0 26.93-11.07ZM346-322h268v-52H346v52Z"/></svg>@@ -5,7 +5,7 @@ use gpui_kit::*;
5
5
6
6
use super::shortcuts::keys_for_label;
7
7
use super::sidebar::{SidebarTab, SidebarView};
8
use super::widgets::{RAIL_BADGE, badge_pill, icon};
8
use super::widgets::{RAIL_BADGE, badge_pill, filled_icon, icon};
9
9
use crate::activity::ActivityCenter;
10
10
use crate::agents::{AgentRuns, runs_handle};
11
11
use crate::app_state::AppState;
@@ -140,7 +140,7 @@ fn item_element(item: &RailItem, active: bool) -> Stateful<Div> {
140
140
.when(!active, |button| {
141
141
button.hover(|button| button.bg(theme::row_hover()))
142
142
})
143
.child(icon(item.icon, ICON_SIZE, color))
143
.child(if active { filled_icon(item.icon, ICON_SIZE, color) } else { icon(item.icon, ICON_SIZE, color) })
144
144
.child(
145
145
div()
146
146
.max_w(px(RAIL_ITEM_WIDTH - 2. * LABEL_INSET))
@@ -5,7 +5,7 @@ use gpui_kit::*;5
5
6
use super::shortcuts::keys_for_label;6
use super::shortcuts::keys_for_label;7
use super::sidebar::{SidebarTab, SidebarView};7
use super::sidebar::{SidebarTab, SidebarView};8
use super::widgets::{RAIL_BADGE, badge_pill, icon};8
use super::widgets::{RAIL_BADGE, badge_pill, filled_icon, icon};9
use crate::activity::ActivityCenter;9
use crate::activity::ActivityCenter;10
use crate::agents::{AgentRuns, runs_handle};10
use crate::agents::{AgentRuns, runs_handle};11
use crate::app_state::AppState;11
use crate::app_state::AppState;@@ -140,7 +140,7 @@ fn item_element(item: &RailItem, active: bool) -> Stateful<Div> {140
.when(!active, |button| {140
.when(!active, |button| {141
button.hover(|button| button.bg(theme::row_hover()))141
button.hover(|button| button.bg(theme::row_hover()))142
})142
})143
.child(icon(item.icon, ICON_SIZE, color))143
.child(if active { filled_icon(item.icon, ICON_SIZE, color) } else { icon(item.icon, ICON_SIZE, color) })144
.child(144
.child(145
div()145
div()146
.max_w(px(RAIL_ITEM_WIDTH - 2. * LABEL_INSET))146
.max_w(px(RAIL_ITEM_WIDTH - 2. * LABEL_INSET))@@ -75,6 +75,7 @@ const STATS_PERIOD: Duration = Duration::from_millis(200);
75
75
const TICKS_PER_SECOND: u32 = 5;
76
76
const RECONNECT_WINDOW: Duration = Duration::from_secs(30);
77
77
const OUTGOING_TIMEOUT: Duration = Duration::from_secs(90);
78
const SETUP_STEP_TIMEOUT: Duration = Duration::from_secs(30);
78
79
const DIRECT_OUTGOING_TIMEOUT: Duration = Duration::from_secs(185);
79
80
const FAR_FUTURE: Duration = Duration::from_secs(60 * 60 * 24 * 365);
80
81
const DEFAULT_KEEP_ALIVE_SECONDS: u64 = 2700;
@@ -440,7 +441,19 @@ pub async fn run_test_call(
440
441
impl CallEngine {
441
442
pub(crate) async fn run(&self, plan: Plan, options: CallOptions, mut control: CallControl) -> Result<CallReport> {
442
443
let inner = self.inner.as_ref();
443
let _one_call_at_a_time = if options.concurrent { None } else { Some(inner.gate.lock().await) };
444
let _one_call_at_a_time = if options.concurrent {
445
None
446
} else {
447
match control.until_hangup(inner.gate.lock()).await {
448
Ok(guard) => Some(guard),
449
Err(_) => {
450
let mut state = CallState::Idle;
451
advance(&mut state, CallSignal::Dial, &control);
452
advance(&mut state, CallSignal::LocalLeave, &control);
453
return Ok(CallReport::default());
454
}
455
}
456
};
444
457
let _trouter_tab_stays = inner.session.hold_tab(session::App::Teams);
445
458
let timeline = Timeline::new(options.trace);
446
459
let mut report = CallReport::default();
@@ -694,6 +707,16 @@ fn new_media_leg_id() -> String {
694
707
uuid::Uuid::new_v4().simple().to_string().to_uppercase()
695
708
}
696
709
710
async fn setup_step<T, E>(control: &mut CallControl, step: impl std::future::Future<Output = std::result::Result<T, E>>) -> Result<T>
711
where
712
Error: From<E>,
713
{
714
match control.until_hangup(timeout(SETUP_STEP_TIMEOUT, step)).await? {
715
Ok(result) => Ok(result?),
716
Err(_) => Err(Error::Signaling("Teams did not answer in time".into())),
717
}
718
}
719
697
720
async fn next_peer_event(next: &mut Option<NextPeer>) -> Option<PeerEvent> {
698
721
match next {
699
722
Some(next) => next.session.events.recv().await,
@@ -864,9 +887,9 @@ async fn drive(
864
887
let subscribed = control
865
888
.until_hangup(signaling.subscribe_meeting(&participant, &links, meeting))
866
889
.await??;
867
signaling.join_meeting(&subscribed, &invitation).await?
890
setup_step(control, signaling.join_meeting(&subscribed, &invitation)).await?
868
891
}
869
_ => signaling.create_conversation(&invitation).await?,
892
_ => setup_step(control, signaling.create_conversation(&invitation)).await?,
870
893
};
871
894
if spec.is_people() {
872
895
control.send(CallUpdate::Progress(Progress::Calling));
@@ -970,8 +993,10 @@ async fn drive(
970
993
if muted {
971
994
control.send(CallUpdate::Muted(true));
972
995
}
973
if let Err(error) = signaling.update_endpoint_state(&conversation, &participant, initial.endpoint_is_muted).await {
974
timeline.record("updateEndpointState failed", error.to_string());
996
match setup_step(control, signaling.update_endpoint_state(&conversation, &participant, initial.endpoint_is_muted)).await {
997
Err(Error::Cancelled) => return Err(Error::Cancelled),
998
Err(error) => timeline.record("updateEndpointState failed", error.to_string()),
999
Ok(()) => {}
975
1000
}
976
1001
977
1002
let mut stats_tick = interval(STATS_PERIOD);
@@ -3554,6 +3579,16 @@ async fn collect_stats(peer: &PeerConnection, share_mids: &[String]) -> StatsSna
3554
3579
3555
3580
#[cfg(test)]
3556
3581
mod tests {
3582
#[tokio::test(start_paused = true)]
3583
async fn a_hanging_setup_step_ends_on_cancel_or_after_the_step_timeout() {
3584
let (handle, mut control) = crate::control::call_channel();
3585
handle.commands.send(CallCommand::Hangup).unwrap();
3586
let cancelled = setup_step(&mut control, std::future::pending::<std::result::Result<(), Error>>()).await;
3587
assert!(matches!(cancelled, Err(Error::Cancelled)));
3588
let timed_out = setup_step(&mut control, std::future::pending::<std::result::Result<(), Error>>()).await;
3589
assert!(matches!(timed_out, Err(Error::Signaling(_))));
3590
}
3591
3557
3592
use super::*;
3558
3593
3559
3594
#[test]
@@ -75,6 +75,7 @@ const STATS_PERIOD: Duration = Duration::from_millis(200);75
const TICKS_PER_SECOND: u32 = 5;75
const TICKS_PER_SECOND: u32 = 5;76
const RECONNECT_WINDOW: Duration = Duration::from_secs(30);76
const RECONNECT_WINDOW: Duration = Duration::from_secs(30);77
const OUTGOING_TIMEOUT: Duration = Duration::from_secs(90);77
const OUTGOING_TIMEOUT: Duration = Duration::from_secs(90);78
const SETUP_STEP_TIMEOUT: Duration = Duration::from_secs(30);78
const DIRECT_OUTGOING_TIMEOUT: Duration = Duration::from_secs(185);79
const DIRECT_OUTGOING_TIMEOUT: Duration = Duration::from_secs(185);79
const FAR_FUTURE: Duration = Duration::from_secs(60 * 60 * 24 * 365);80
const FAR_FUTURE: Duration = Duration::from_secs(60 * 60 * 24 * 365);80
const DEFAULT_KEEP_ALIVE_SECONDS: u64 = 2700;81
const DEFAULT_KEEP_ALIVE_SECONDS: u64 = 2700;@@ -440,7 +441,19 @@ pub async fn run_test_call(440
impl CallEngine {441
impl CallEngine {441
pub(crate) async fn run(&self, plan: Plan, options: CallOptions, mut control: CallControl) -> Result<CallReport> {442
pub(crate) async fn run(&self, plan: Plan, options: CallOptions, mut control: CallControl) -> Result<CallReport> {442
let inner = self.inner.as_ref();443
let inner = self.inner.as_ref();443
let _one_call_at_a_time = if options.concurrent { None } else { Some(inner.gate.lock().await) };444
let _one_call_at_a_time = if options.concurrent {445
None446
} else {447
match control.until_hangup(inner.gate.lock()).await {448
Ok(guard) => Some(guard),449
Err(_) => {450
let mut state = CallState::Idle;451
advance(&mut state, CallSignal::Dial, &control);452
advance(&mut state, CallSignal::LocalLeave, &control);453
return Ok(CallReport::default());454
}455
}456
};444
let _trouter_tab_stays = inner.session.hold_tab(session::App::Teams);457
let _trouter_tab_stays = inner.session.hold_tab(session::App::Teams);445
let timeline = Timeline::new(options.trace);458
let timeline = Timeline::new(options.trace);446
let mut report = CallReport::default();459
let mut report = CallReport::default();@@ -694,6 +707,16 @@ fn new_media_leg_id() -> String {694
uuid::Uuid::new_v4().simple().to_string().to_uppercase()707
uuid::Uuid::new_v4().simple().to_string().to_uppercase()695
}708
}696
709
710
async fn setup_step<T, E>(control: &mut CallControl, step: impl std::future::Future<Output = std::result::Result<T, E>>) -> Result<T>711
where712
Error: From<E>,713
{714
match control.until_hangup(timeout(SETUP_STEP_TIMEOUT, step)).await? {715
Ok(result) => Ok(result?),716
Err(_) => Err(Error::Signaling("Teams did not answer in time".into())),717
}718
}719
697
async fn next_peer_event(next: &mut Option<NextPeer>) -> Option<PeerEvent> {720
async fn next_peer_event(next: &mut Option<NextPeer>) -> Option<PeerEvent> {698
match next {721
match next {699
Some(next) => next.session.events.recv().await,722
Some(next) => next.session.events.recv().await,@@ -864,9 +887,9 @@ async fn drive(864
let subscribed = control887
let subscribed = control865
.until_hangup(signaling.subscribe_meeting(&participant, &links, meeting))888
.until_hangup(signaling.subscribe_meeting(&participant, &links, meeting))866
.await??;889
.await??;867
signaling.join_meeting(&subscribed, &invitation).await?890
setup_step(control, signaling.join_meeting(&subscribed, &invitation)).await?868
}891
}869
_ => signaling.create_conversation(&invitation).await?,892
_ => setup_step(control, signaling.create_conversation(&invitation)).await?,870
};893
};871
if spec.is_people() {894
if spec.is_people() {872
control.send(CallUpdate::Progress(Progress::Calling));895
control.send(CallUpdate::Progress(Progress::Calling));@@ -970,8 +993,10 @@ async fn drive(970
if muted {993
if muted {971
control.send(CallUpdate::Muted(true));994
control.send(CallUpdate::Muted(true));972
}995
}973
if let Err(error) = signaling.update_endpoint_state(&conversation, &participant, initial.endpoint_is_muted).await {996
match setup_step(control, signaling.update_endpoint_state(&conversation, &participant, initial.endpoint_is_muted)).await {974
timeline.record("updateEndpointState failed", error.to_string());997
Err(Error::Cancelled) => return Err(Error::Cancelled),998
Err(error) => timeline.record("updateEndpointState failed", error.to_string()),999
Ok(()) => {}975
}1000
}976
1001
977
let mut stats_tick = interval(STATS_PERIOD);1002
let mut stats_tick = interval(STATS_PERIOD);@@ -3554,6 +3579,16 @@ async fn collect_stats(peer: &PeerConnection, share_mids: &[String]) -> StatsSna3554
3579
3555
#[cfg(test)]3580
#[cfg(test)]3556
mod tests {3581
mod tests {3582
#[tokio::test(start_paused = true)]3583
async fn a_hanging_setup_step_ends_on_cancel_or_after_the_step_timeout() {3584
let (handle, mut control) = crate::control::call_channel();3585
handle.commands.send(CallCommand::Hangup).unwrap();3586
let cancelled = setup_step(&mut control, std::future::pending::<std::result::Result<(), Error>>()).await;3587
assert!(matches!(cancelled, Err(Error::Cancelled)));3588
let timed_out = setup_step(&mut control, std::future::pending::<std::result::Result<(), Error>>()).await;3589
assert!(matches!(timed_out, Err(Error::Signaling(_))));3590
}3591
3557
use super::*;3592
use super::*;3558
3593
3559
#[test]3594
#[test]