BlueGit

ict rusty-teams

feat(app): centered Neu divider and clickable plain URLs

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-10-07 · 7 weeks ago

Hash
0dbcc7bd987f1514791a3829a234739176aababf
Parent
b7adb9bb
9 files changed +177 −38
crates/app/src/backend.rs +4 −1
@@ -87,7 +87,10 @@ pub fn live_state_for(kind: StatusKind) -> LiveState {
87 87 }
88 88 }
89 89
90 pub fn start(store: Arc<Store>, transport: Arc<dyn Transport>) -> mpsc::UnboundedReceiver<BackendEvent> {
90 pub fn start(
91 store: Arc<Store>,
92 transport: Arc<dyn Transport>,
93 ) -> mpsc::UnboundedReceiver<BackendEvent> {
91 94 let (sender, receiver) = mpsc::unbounded_channel();
92 95 crate::runtime::handle().spawn(supervise(store, transport, sender));
93 96 receiver
@@ -87,7 +87,10 @@ pub fn live_state_for(kind: StatusKind) -> LiveState {
87 }
87 }
88}
88}
89
89
90pub fn start(store: Arc<Store>, transport: Arc<dyn Transport>) -> mpsc::UnboundedReceiver<BackendEvent> {
90pub fn start(
91 store: Arc<Store>,
92 transport: Arc<dyn Transport>,
93) -> mpsc::UnboundedReceiver<BackendEvent> {
91 let (sender, receiver) = mpsc::unbounded_channel();
94 let (sender, receiver) = mpsc::unbounded_channel();
92 crate::runtime::handle().spawn(supervise(store, transport, sender));
95 crate::runtime::handle().spawn(supervise(store, transport, sender));
93 receiver
96 receiver
crates/app/src/demo.rs +3 −1
@@ -342,7 +342,9 @@ pub fn read_message_ids(records: &[MessageRecord]) -> std::collections::HashSet<
342 342 let newest = records.iter().max_by_key(|record| record.created_at);
343 343 records
344 344 .iter()
345 .filter(|record| Some(record.message_id.as_str()) != newest.map(|newest| newest.message_id.as_str()))
345 .filter(|record| {
346 Some(record.message_id.as_str()) != newest.map(|newest| newest.message_id.as_str())
347 })
346 348 .map(|record| record.message_id.clone())
347 349 .collect()
348 350 }
@@ -342,7 +342,9 @@ pub fn read_message_ids(records: &[MessageRecord]) -> std::collections::HashSet<
342 let newest = records.iter().max_by_key(|record| record.created_at);
342 let newest = records.iter().max_by_key(|record| record.created_at);
343 records
343 records
344 .iter()
344 .iter()
345 .filter(|record| Some(record.message_id.as_str()) != newest.map(|newest| newest.message_id.as_str()))
345 .filter(|record| {
346 Some(record.message_id.as_str()) != newest.map(|newest| newest.message_id.as_str())
347 })
346 .map(|record| record.message_id.clone())
348 .map(|record| record.message_id.clone())
347 .collect()
349 .collect()
348}
350}
crates/app/src/frame_log.rs +5 −1
@@ -41,7 +41,11 @@ fn statistics() -> Option<&'static Mutex<FrameStatistics>> {
41 41 }
42 42
43 43 fn append(path: &str, line: &str) {
44 if let Ok(mut file) = std::fs::OpenOptions::new().create(true).append(true).open(path) {
44 if let Ok(mut file) = std::fs::OpenOptions::new()
45 .create(true)
46 .append(true)
47 .open(path)
48 {
45 49 let _ = writeln!(file, "{line}");
46 50 }
47 51 }
@@ -41,7 +41,11 @@ fn statistics() -> Option<&'static Mutex<FrameStatistics>> {
41}
41}
42
42
43fn append(path: &str, line: &str) {
43fn append(path: &str, line: &str) {
44 if let Ok(mut file) = std::fs::OpenOptions::new().create(true).append(true).open(path) {
44 if let Ok(mut file) = std::fs::OpenOptions::new()
45 .create(true)
46 .append(true)
47 .open(path)
48 {
45 let _ = writeln!(file, "{line}");
49 let _ = writeln!(file, "{line}");
46 }
50 }
47}
51}
crates/app/src/main.rs +8 −3
@@ -4,13 +4,13 @@
4 4 )]
5 5
6 6 mod app_state;
7 mod assets;
7 8 mod avatar_image;
8 9 mod backend;
9 10 mod data;
10 11 mod demo;
11 12 mod emoji;
12 13 mod format;
13 mod assets;
14 14 mod frame_log;
15 15 mod fuzzy;
16 16 mod notify;
@@ -111,7 +111,9 @@ fn transport(endpoint: Option<&str>) -> Arc<dyn session::Transport> {
111 111 window_title: format!("{APP_NAME} - Sign in"),
112 112 });
113 113 }
114 Arc::new(session::CdpTransport::new(endpoint.unwrap_or(session::DEFAULT_ENDPOINT)))
114 Arc::new(session::CdpTransport::new(
115 endpoint.unwrap_or(session::DEFAULT_ENDPOINT),
116 ))
115 117 }
116 118
117 119 fn main() {
@@ -128,7 +130,10 @@ fn main() {
128 130 demo::seed(&store);
129 131 store
130 132 } else {
131 let path = arguments.database.clone().unwrap_or_else(|| data_path(DATABASE_FILE));
133 let path = arguments
134 .database
135 .clone()
136 .unwrap_or_else(|| data_path(DATABASE_FILE));
132 137 Store::open(&path).expect("cache database")
133 138 };
134 139 let store = Arc::new(store);
@@ -4,13 +4,13 @@
4)]
4)]
5
5
6mod app_state;
6mod app_state;
7mod assets;
7mod avatar_image;
8mod avatar_image;
8mod backend;
9mod backend;
9mod data;
10mod data;
10mod demo;
11mod demo;
11mod emoji;
12mod emoji;
12mod format;
13mod format;
13mod assets;
14mod frame_log;
14mod frame_log;
15mod fuzzy;
15mod fuzzy;
16mod notify;
16mod notify;
@@ -111,7 +111,9 @@ fn transport(endpoint: Option<&str>) -> Arc<dyn session::Transport> {
111 window_title: format!("{APP_NAME} - Sign in"),
111 window_title: format!("{APP_NAME} - Sign in"),
112 });
112 });
113 }
113 }
114 Arc::new(session::CdpTransport::new(endpoint.unwrap_or(session::DEFAULT_ENDPOINT)))
114 Arc::new(session::CdpTransport::new(
115 endpoint.unwrap_or(session::DEFAULT_ENDPOINT),
116 ))
115}
117}
116
118
117fn main() {
119fn main() {
@@ -128,7 +130,10 @@ fn main() {
128 demo::seed(&store);
130 demo::seed(&store);
129 store
131 store
130 } else {
132 } else {
131 let path = arguments.database.clone().unwrap_or_else(|| data_path(DATABASE_FILE));
133 let path = arguments
134 .database
135 .clone()
136 .unwrap_or_else(|| data_path(DATABASE_FILE));
132 Store::open(&path).expect("cache database")
137 Store::open(&path).expect("cache database")
133 };
138 };
134 let store = Arc::new(store);
139 let store = Arc::new(store);
crates/app/src/render/blocks.rs +137 −1
@@ -4,6 +4,8 @@ use teams_core::Span;
4 4
5 5 pub const MENTION_PAD: char = '\u{2009}';
6 6 pub const IMAGE_PLACEHOLDER: &str = "[image]";
7 const URL_PREFIXES: [&str; 3] = ["https://", "http://", "www."];
8 const TRAILING_PUNCTUATION: &str = ".,;:!?'\"";
7 9
8 10 #[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
9 11 pub struct StyleFlags {
@@ -64,7 +66,11 @@ impl Inline {
64 66
65 67 pub fn with_trailing_room(&self, width_in_spaces: usize) -> Inline {
66 68 let mut padded = self.clone();
67 padded.push(&"\u{2007}".repeat(width_in_spaces), StyleFlags::default(), None);
69 padded.push(
70 &"\u{2007}".repeat(width_in_spaces),
71 StyleFlags::default(),
72 None,
73 );
68 74 padded
69 75 }
70 76
@@ -189,6 +195,9 @@ fn flush(current: &mut Inline, blocks: &mut Vec<Block>, make: fn(Inline) -> Bloc
189 195 fn append_inline(spans: &[Span], style: StyleFlags, link: Option<&str>, out: &mut Inline) {
190 196 for span in spans {
191 197 match span {
198 Span::Text(text) if link.is_none() && !style.code => {
199 push_linkified(text, style, out);
200 }
192 201 Span::Text(text) => out.push(text, style, link),
193 202 Span::Bold(children) => append_inline(
194 203 children,
@@ -257,6 +266,71 @@ fn append_inline(spans: &[Span], style: StyleFlags, link: Option<&str>, out: &mu
257 266 }
258 267 }
259 268
269 fn push_linkified(text: &str, style: StyleFlags, out: &mut Inline) {
270 let mut rest = text;
271 while let Some((start, end)) = find_url(rest) {
272 out.push(&rest[..start], style, None);
273 let visible = &rest[start..end];
274 let target = if visible.starts_with("www.") {
275 format!("https://{visible}")
276 } else {
277 visible.to_owned()
278 };
279 out.push(
280 visible,
281 StyleFlags {
282 link: true,
283 ..style
284 },
285 Some(&target),
286 );
287 rest = &rest[end..];
288 }
289 out.push(rest, style, None);
290 }
291
292 fn find_url(text: &str) -> Option<(usize, usize)> {
293 let mut previous_is_boundary = true;
294 for (start, character) in text.char_indices() {
295 if previous_is_boundary
296 && let Some(prefix) = URL_PREFIXES
297 .iter()
298 .find(|prefix| text[start..].starts_with(**prefix))
299 {
300 let length = text[start..]
301 .find(char::is_whitespace)
302 .unwrap_or(text.len() - start);
303 let end = start + trimmed_url_length(&text[start..start + length]);
304 if end > start + prefix.len() {
305 return Some((start, end));
306 }
307 }
308 previous_is_boundary = !character.is_alphanumeric();
309 }
310 None
311 }
312
313 fn trimmed_url_length(candidate: &str) -> usize {
314 let mut url = candidate;
315 while let Some(last) = url.chars().next_back() {
316 let opener = match last {
317 ')' => Some('('),
318 ']' => Some('['),
319 '}' => Some('{'),
320 _ => None,
321 };
322 let trimmable = match opener {
323 Some(opener) => url.matches(last).count() > url.matches(opener).count(),
324 None => TRAILING_PUNCTUATION.contains(last),
325 };
326 if !trimmable {
327 break;
328 }
329 url = &url[..url.len() - last.len_utf8()];
330 }
331 url.len()
332 }
333
260 334 #[cfg(test)]
261 335 mod tests {
262 336 use super::*;
@@ -305,6 +379,68 @@ mod tests {
305 379 );
306 380 }
307 381
382 fn paragraph_inline(spans: &[Span]) -> Inline {
383 let Block::Paragraph(inline) = layout_blocks(spans).remove(0) else {
384 panic!("paragraph expected")
385 };
386 inline
387 }
388
389 #[test]
390 fn plain_url_at_end_becomes_link() {
391 let inline = paragraph_inline(&[text("see https://example.com/a")]);
392 assert_eq!(
393 inline.links(),
394 vec![(4..25, "https://example.com/a".to_owned())]
395 );
396 assert!(inline.segments[1].style.link);
397 }
398
399 #[test]
400 fn trailing_period_stays_outside_url() {
401 let inline = paragraph_inline(&[text("go to http://example.com. Then")]);
402 assert_eq!(
403 inline.links(),
404 vec![(6..24, "http://example.com".to_owned())]
405 );
406 }
407
408 #[test]
409 fn balanced_parentheses_stay_in_url() {
410 let inline = paragraph_inline(&[text("https://example.com/Rust_(language)")]);
411 assert_eq!(inline.links()[0].1, "https://example.com/Rust_(language)");
412 let wrapped = paragraph_inline(&[text("(see https://example.com)")]);
413 assert_eq!(wrapped.links()[0].1, "https://example.com");
414 }
415
416 #[test]
417 fn www_url_gets_https_target() {
418 let inline = paragraph_inline(&[text("www.example.com!")]);
419 assert_eq!(inline.text, "www.example.com!");
420 assert_eq!(
421 inline.links(),
422 vec![(0..15, "https://www.example.com".to_owned())]
423 );
424 }
425
426 #[test]
427 fn text_without_url_has_no_links() {
428 let inline = paragraph_inline(&[text("no link, just www. and https:// here")]);
429 assert!(inline.links().is_empty());
430 }
431
432 #[test]
433 fn url_inside_link_stays_one_link() {
434 let inline = paragraph_inline(&[Span::Link {
435 url: "https://target.example".into(),
436 children: vec![text("https://shown.example")],
437 }]);
438 assert_eq!(
439 inline.links(),
440 vec![(0..21, "https://target.example".to_owned())]
441 );
442 }
443
308 444 #[test]
309 445 fn mention_gets_an_at_sign_once() {
310 446 let blocks = layout_blocks(&[
@@ -4,6 +4,8 @@ use teams_core::Span;
4
4
5pub const MENTION_PAD: char = '\u{2009}';
5pub const MENTION_PAD: char = '\u{2009}';
6pub const IMAGE_PLACEHOLDER: &str = "[image]";
6pub const IMAGE_PLACEHOLDER: &str = "[image]";
7const URL_PREFIXES: [&str; 3] = ["https://", "http://", "www."];
8const TRAILING_PUNCTUATION: &str = ".,;:!?'\"";
7
9
8#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
10#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
9pub struct StyleFlags {
11pub struct StyleFlags {
@@ -64,7 +66,11 @@ impl Inline {
64
66
65 pub fn with_trailing_room(&self, width_in_spaces: usize) -> Inline {
67 pub fn with_trailing_room(&self, width_in_spaces: usize) -> Inline {
66 let mut padded = self.clone();
68 let mut padded = self.clone();
67 padded.push(&"\u{2007}".repeat(width_in_spaces), StyleFlags::default(), None);
69 padded.push(
70 &"\u{2007}".repeat(width_in_spaces),
71 StyleFlags::default(),
72 None,
73 );
68 padded
74 padded
69 }
75 }
70
76
@@ -189,6 +195,9 @@ fn flush(current: &mut Inline, blocks: &mut Vec<Block>, make: fn(Inline) -> Bloc
189fn append_inline(spans: &[Span], style: StyleFlags, link: Option<&str>, out: &mut Inline) {
195fn append_inline(spans: &[Span], style: StyleFlags, link: Option<&str>, out: &mut Inline) {
190 for span in spans {
196 for span in spans {
191 match span {
197 match span {
198 Span::Text(text) if link.is_none() && !style.code => {
199 push_linkified(text, style, out);
200 }
192 Span::Text(text) => out.push(text, style, link),
201 Span::Text(text) => out.push(text, style, link),
193 Span::Bold(children) => append_inline(
202 Span::Bold(children) => append_inline(
194 children,
203 children,
@@ -257,6 +266,71 @@ fn append_inline(spans: &[Span], style: StyleFlags, link: Option<&str>, out: &mu
257 }
266 }
258}
267}
259
268
269fn push_linkified(text: &str, style: StyleFlags, out: &mut Inline) {
270 let mut rest = text;
271 while let Some((start, end)) = find_url(rest) {
272 out.push(&rest[..start], style, None);
273 let visible = &rest[start..end];
274 let target = if visible.starts_with("www.") {
275 format!("https://{visible}")
276 } else {
277 visible.to_owned()
278 };
279 out.push(
280 visible,
281 StyleFlags {
282 link: true,
283 ..style
284 },
285 Some(&target),
286 );
287 rest = &rest[end..];
288 }
289 out.push(rest, style, None);
290}
291
292fn find_url(text: &str) -> Option<(usize, usize)> {
293 let mut previous_is_boundary = true;
294 for (start, character) in text.char_indices() {
295 if previous_is_boundary
296 && let Some(prefix) = URL_PREFIXES
297 .iter()
298 .find(|prefix| text[start..].starts_with(**prefix))
299 {
300 let length = text[start..]
301 .find(char::is_whitespace)
302 .unwrap_or(text.len() - start);
303 let end = start + trimmed_url_length(&text[start..start + length]);
304 if end > start + prefix.len() {
305 return Some((start, end));
306 }
307 }
308 previous_is_boundary = !character.is_alphanumeric();
309 }
310 None
311}
312
313fn trimmed_url_length(candidate: &str) -> usize {
314 let mut url = candidate;
315 while let Some(last) = url.chars().next_back() {
316 let opener = match last {
317 ')' => Some('('),
318 ']' => Some('['),
319 '}' => Some('{'),
320 _ => None,
321 };
322 let trimmable = match opener {
323 Some(opener) => url.matches(last).count() > url.matches(opener).count(),
324 None => TRAILING_PUNCTUATION.contains(last),
325 };
326 if !trimmable {
327 break;
328 }
329 url = &url[..url.len() - last.len_utf8()];
330 }
331 url.len()
332}
333
260#[cfg(test)]
334#[cfg(test)]
261mod tests {
335mod tests {
262 use super::*;
336 use super::*;
@@ -305,6 +379,68 @@ mod tests {
305 );
379 );
306 }
380 }
307
381
382 fn paragraph_inline(spans: &[Span]) -> Inline {
383 let Block::Paragraph(inline) = layout_blocks(spans).remove(0) else {
384 panic!("paragraph expected")
385 };
386 inline
387 }
388
389 #[test]
390 fn plain_url_at_end_becomes_link() {
391 let inline = paragraph_inline(&[text("see https://example.com/a")]);
392 assert_eq!(
393 inline.links(),
394 vec![(4..25, "https://example.com/a".to_owned())]
395 );
396 assert!(inline.segments[1].style.link);
397 }
398
399 #[test]
400 fn trailing_period_stays_outside_url() {
401 let inline = paragraph_inline(&[text("go to http://example.com. Then")]);
402 assert_eq!(
403 inline.links(),
404 vec![(6..24, "http://example.com".to_owned())]
405 );
406 }
407
408 #[test]
409 fn balanced_parentheses_stay_in_url() {
410 let inline = paragraph_inline(&[text("https://example.com/Rust_(language)")]);
411 assert_eq!(inline.links()[0].1, "https://example.com/Rust_(language)");
412 let wrapped = paragraph_inline(&[text("(see https://example.com)")]);
413 assert_eq!(wrapped.links()[0].1, "https://example.com");
414 }
415
416 #[test]
417 fn www_url_gets_https_target() {
418 let inline = paragraph_inline(&[text("www.example.com!")]);
419 assert_eq!(inline.text, "www.example.com!");
420 assert_eq!(
421 inline.links(),
422 vec![(0..15, "https://www.example.com".to_owned())]
423 );
424 }
425
426 #[test]
427 fn text_without_url_has_no_links() {
428 let inline = paragraph_inline(&[text("no link, just www. and https:// here")]);
429 assert!(inline.links().is_empty());
430 }
431
432 #[test]
433 fn url_inside_link_stays_one_link() {
434 let inline = paragraph_inline(&[Span::Link {
435 url: "https://target.example".into(),
436 children: vec![text("https://shown.example")],
437 }]);
438 assert_eq!(
439 inline.links(),
440 vec![(0..21, "https://target.example".to_owned())]
441 );
442 }
443
308 #[test]
444 #[test]
309 fn mention_gets_an_at_sign_once() {
445 fn mention_gets_an_at_sign_once() {
310 let blocks = layout_blocks(&[
446 let blocks = layout_blocks(&[
crates/app/src/render/elements.rs +4 −4
@@ -145,10 +145,10 @@ fn render_inline_with_chips(inline: &Inline, id: &str, own: bool) -> AnyElement
145 145 format!("{id}-{segment_index}-{word_index}").into(),
146 146 ))
147 147 .whitespace_nowrap()
148 .child(StyledText::new(word.to_owned()).with_highlights([(
149 0..word.len(),
150 highlight_for(segment.style, own),
151 )]));
148 .child(
149 StyledText::new(word.to_owned())
150 .with_highlights([(0..word.len(), highlight_for(segment.style, own))]),
151 );
152 152 if let Some(url) = segment.link.clone() {
153 153 piece = piece
154 154 .cursor_pointer()
@@ -145,10 +145,10 @@ fn render_inline_with_chips(inline: &Inline, id: &str, own: bool) -> AnyElement
145 format!("{id}-{segment_index}-{word_index}").into(),
145 format!("{id}-{segment_index}-{word_index}").into(),
146 ))
146 ))
147 .whitespace_nowrap()
147 .whitespace_nowrap()
148 .child(StyledText::new(word.to_owned()).with_highlights([(
148 .child(
149 0..word.len(),
149 StyledText::new(word.to_owned())
150 highlight_for(segment.style, own),
150 .with_highlights([(0..word.len(), highlight_for(segment.style, own))]),
151 )]));
151 );
152 if let Some(url) = segment.link.clone() {
152 if let Some(url) = segment.link.clone() {
153 piece = piece
153 piece = piece
154 .cursor_pointer()
154 .cursor_pointer()
crates/app/src/views/avatar.rs +6 −8
@@ -81,7 +81,9 @@ pub fn person_avatar(
81 81 }
82 82
83 83 pub fn presence_size(avatar_size: f32) -> f32 {
84 (avatar_size * PRESENCE_RATIO).round().clamp(PRESENCE_MIN, PRESENCE_MAX)
84 (avatar_size * PRESENCE_RATIO)
85 .round()
86 .clamp(PRESENCE_MIN, PRESENCE_MAX)
85 87 }
86 88
87 89 pub fn presence_dot(kind: PresenceKind, ring: Hsla, avatar_size: f32) -> Option<Div> {
@@ -102,13 +104,9 @@ pub fn presence_dot(kind: PresenceKind, ring: Hsla, avatar_size: f32) -> Option<
102 104 .items_center()
103 105 .justify_center();
104 106 center = match kind {
105 PresenceKind::DoNotDisturb => center.child(
106 div()
107 .w(px(inner - 4.))
108 .h(px(2.))
109 .rounded(px(1.))
110 .bg(ring),
111 ),
107 PresenceKind::DoNotDisturb => {
108 center.child(div().w(px(inner - 4.)).h(px(2.)).rounded(px(1.)).bg(ring))
109 }
112 110 PresenceKind::Offline => center.border(px(1.5)).border_color(theme::text_muted()),
113 111 _ => center,
114 112 };
@@ -81,7 +81,9 @@ pub fn person_avatar(
81}
81}
82
82
83pub fn presence_size(avatar_size: f32) -> f32 {
83pub fn presence_size(avatar_size: f32) -> f32 {
84 (avatar_size * PRESENCE_RATIO).round().clamp(PRESENCE_MIN, PRESENCE_MAX)
84 (avatar_size * PRESENCE_RATIO)
85 .round()
86 .clamp(PRESENCE_MIN, PRESENCE_MAX)
85}
87}
86
88
87pub fn presence_dot(kind: PresenceKind, ring: Hsla, avatar_size: f32) -> Option<Div> {
89pub fn presence_dot(kind: PresenceKind, ring: Hsla, avatar_size: f32) -> Option<Div> {
@@ -102,13 +104,9 @@ pub fn presence_dot(kind: PresenceKind, ring: Hsla, avatar_size: f32) -> Option<
102 .items_center()
104 .items_center()
103 .justify_center();
105 .justify_center();
104 center = match kind {
106 center = match kind {
105 PresenceKind::DoNotDisturb => center.child(
107 PresenceKind::DoNotDisturb => {
106 div()
108 center.child(div().w(px(inner - 4.)).h(px(2.)).rounded(px(1.)).bg(ring))
107 .w(px(inner - 4.))
109 }
108 .h(px(2.))
109 .rounded(px(1.))
110 .bg(ring),
111 ),
112 PresenceKind::Offline => center.border(px(1.5)).border_color(theme::text_muted()),
110 PresenceKind::Offline => center.border(px(1.5)).border_color(theme::text_muted()),
113 _ => center,
111 _ => center,
114 };
112 };
crates/app/src/views/message_row.rs +9 −18
@@ -59,38 +59,29 @@ fn reaction_chip(chip: &ReactionChip) -> Div {
59 59 .child(chip.count.to_string())
60 60 }
61 61
62 fn day_separator(label: &str) -> Div {
62 fn labeled_divider(label: &str, line_color: Hsla, text_color: Hsla) -> Div {
63 63 h_flex()
64 64 .w_full()
65 65 .items_center()
66 66 .gap(px(12.))
67 67 .mt(px(14.))
68 68 .mb(px(6.))
69 .child(div().flex_1().h(px(1.)).bg(theme::border()))
69 .child(div().flex_1().h(px(1.)).bg(line_color))
70 70 .child(
71 71 div()
72 72 .text_size(px(11.))
73 .text_color(theme::text_muted())
73 .text_color(text_color)
74 74 .child(label.to_owned()),
75 75 )
76 .child(div().flex_1().h(px(1.)).bg(theme::border()))
76 .child(div().flex_1().h(px(1.)).bg(line_color))
77 }
78
79 fn day_separator(label: &str) -> Div {
80 labeled_divider(label, theme::border(), theme::text_muted())
77 81 }
78 82
79 83 fn new_marker() -> Div {
80 h_flex()
81 .w_full()
82 .items_center()
83 .gap(px(10.))
84 .mt(px(12.))
85 .mb(px(2.))
86 .child(div().flex_1().h(px(1.)).bg(theme::accent()))
87 .child(
88 div()
89 .text_size(px(11.))
90 .font_weight(FontWeight::SEMIBOLD)
91 .text_color(theme::accent_text())
92 .child("New"),
93 )
84 labeled_divider("New", theme::accent(), theme::accent_text())
94 85 }
95 86
96 87 fn bubble(row: &MessageRow, index: usize, own: bool, directory: &Directory, cx: &App) -> Div {
@@ -59,38 +59,29 @@ fn reaction_chip(chip: &ReactionChip) -> Div {
59 .child(chip.count.to_string())
59 .child(chip.count.to_string())
60}
60}
61
61
62fn day_separator(label: &str) -> Div {
62fn labeled_divider(label: &str, line_color: Hsla, text_color: Hsla) -> Div {
63 h_flex()
63 h_flex()
64 .w_full()
64 .w_full()
65 .items_center()
65 .items_center()
66 .gap(px(12.))
66 .gap(px(12.))
67 .mt(px(14.))
67 .mt(px(14.))
68 .mb(px(6.))
68 .mb(px(6.))
69 .child(div().flex_1().h(px(1.)).bg(theme::border()))
69 .child(div().flex_1().h(px(1.)).bg(line_color))
70 .child(
70 .child(
71 div()
71 div()
72 .text_size(px(11.))
72 .text_size(px(11.))
73 .text_color(theme::text_muted())
73 .text_color(text_color)
74 .child(label.to_owned()),
74 .child(label.to_owned()),
75 )
75 )
76 .child(div().flex_1().h(px(1.)).bg(theme::border()))
76 .child(div().flex_1().h(px(1.)).bg(line_color))
77}
78
79fn day_separator(label: &str) -> Div {
80 labeled_divider(label, theme::border(), theme::text_muted())
77}
81}
78
82
79fn new_marker() -> Div {
83fn new_marker() -> Div {
80 h_flex()
84 labeled_divider("New", theme::accent(), theme::accent_text())
81 .w_full()
82 .items_center()
83 .gap(px(10.))
84 .mt(px(12.))
85 .mb(px(2.))
86 .child(div().flex_1().h(px(1.)).bg(theme::accent()))
87 .child(
88 div()
89 .text_size(px(11.))
90 .font_weight(FontWeight::SEMIBOLD)
91 .text_color(theme::accent_text())
92 .child("New"),
93 )
94}
85}
95
86
96fn bubble(row: &MessageRow, index: usize, own: bool, directory: &Directory, cx: &App) -> Div {
87fn bubble(row: &MessageRow, index: usize, own: bool, directory: &Directory, cx: &App) -> Div {
crates/app/src/views/status_bar.rs +1 −1
@@ -3,8 +3,8 @@ use gpui_kit::component::{h_flex, tooltip::Tooltip};
3 3 use gpui_kit::*;
4 4
5 5 use crate::app_state::{AppState, Mode};
6 use crate::format;
7 6 use crate::backend::{ConnectionState, LiveState};
7 use crate::format;
8 8 use crate::theme;
9 9 use crate::updater::{self, UpdateStatus};
10 10
@@ -3,8 +3,8 @@ use gpui_kit::component::{h_flex, tooltip::Tooltip};
3use gpui_kit::*;
3use gpui_kit::*;
4
4
5use crate::app_state::{AppState, Mode};
5use crate::app_state::{AppState, Mode};
6use crate::format;
7use crate::backend::{ConnectionState, LiveState};
6use crate::backend::{ConnectionState, LiveState};
7use crate::format;
8use crate::theme;
8use crate::theme;
9use crate::updater::{self, UpdateStatus};
9use crate::updater::{self, UpdateStatus};
10
10