BlueGit

ict rusty-teams

feat(app): flat always-visible toast actions, composer-style reply

- Mark as read and Reply sit flat and right aligned in every toast, so hovering no longer resizes the window.
- No timer bar. The timer still pauses on hover.
- The reply field matches the chat composer: one box, return-key send button inside.

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

metis Daniel Däschle · pushed by metis

Authored 2026-10-07 · 7 weeks ago

Hash
9ae4b0b287399e364463a24a5845ad9048198a7d
Parent
2b7a3021
4 files changed +67 −94
crates/app/src/notify/center.rs +1 −1
@@ -294,7 +294,7 @@ impl NotificationCenter {
294 294 .stack
295 295 .visible()
296 296 .iter()
297 .map(|toast| layout::toast_height(toast, toast.hovered, self.settings.preview))
297 .map(|toast| layout::toast_height(toast, self.settings.preview))
298 298 .collect();
299 299 let hidden = self.stack.hidden_count();
300 300 let slots = layout::stack_slots(area, self.settings.corner, &heights, hidden > 0);
@@ -294,7 +294,7 @@ impl NotificationCenter {
294 .stack
294 .stack
295 .visible()
295 .visible()
296 .iter()
296 .iter()
297 .map(|toast| layout::toast_height(toast, toast.hovered, self.settings.preview))
297 .map(|toast| layout::toast_height(toast, self.settings.preview))
298 .collect();
298 .collect();
299 let hidden = self.stack.hidden_count();
299 let hidden = self.stack.hidden_count();
300 let slots = layout::stack_slots(area, self.settings.corner, &heights, hidden > 0);
300 let slots = layout::stack_slots(area, self.settings.corner, &heights, hidden > 0);
crates/app/src/notify/layout.rs +12 −18
@@ -8,11 +8,13 @@ pub const PILL_HEIGHT: f32 = 32.;
8 8 pub const SIDE_MARGIN: f32 = 16.;
9 9 pub const EDGE_MARGIN: f32 = 12.;
10 10 pub const STACK_GAP: f32 = 8.;
11 pub const ACTION_ROW: f32 = 36.;
11 pub const ACTION_BUTTON: f32 = 28.;
12 pub const SEND_BUTTON: f32 = 32.;
12 13 const BASE_HEIGHT: f32 = 62.;
13 14 const PREVIEW_LINE: f32 = 18.;
14 15 const CHARS_PER_LINE: usize = 40;
15 16 const ACTION_ROW_SPACING: f32 = 4.;
17 const REPLY_FIELD_FRAME: f32 = 14.;
16 18 const REPLY_HINT_ROW: f32 = 20.;
17 19 const REPLY_SPACING: f32 = 8.;
18 20 const CONFIRM_HEIGHT: f32 = 56.;
@@ -32,21 +34,14 @@ fn preview_lines(model: &ToastModel, preview_on: bool) -> usize {
32 34 }
33 35 }
34 36
35 pub fn toast_height(model: &ToastModel, hovered: bool, preview_on: bool) -> f32 {
37 pub fn toast_height(model: &ToastModel, preview_on: bool) -> f32 {
38 let base = BASE_HEIGHT + preview_lines(model, preview_on) as f32 * PREVIEW_LINE;
36 39 match model.reply {
37 40 ReplyState::Sent | ReplyState::Failed => CONFIRM_HEIGHT,
38 41 ReplyState::Open => {
39 let base = BASE_HEIGHT + preview_lines(model, preview_on) as f32 * PREVIEW_LINE;
40 base + REPLY_SPACING + ACTION_ROW + REPLY_HINT_ROW
41 }
42 ReplyState::Closed => {
43 let base = BASE_HEIGHT + preview_lines(model, preview_on) as f32 * PREVIEW_LINE;
44 if hovered {
45 base + ACTION_ROW + ACTION_ROW_SPACING
46 } else {
47 base
48 }
42 base + REPLY_SPACING + SEND_BUTTON + REPLY_FIELD_FRAME + REPLY_HINT_ROW
49 43 }
44 ReplyState::Closed => base + ACTION_ROW_SPACING + ACTION_BUTTON,
50 45 }
51 46 }
52 47
@@ -178,11 +173,10 @@ mod tests {
178 173 hovered: false,
179 174 time: String::new(),
180 175 };
181 let short = toast_height(&model("Hi"), false, true);
182 let long = toast_height(&model(&"x".repeat(200)), false, true);
183 assert!((76. ..=104.).contains(&short));
184 assert!((76. ..=104.).contains(&long));
185 assert!(toast_height(&model("Hi"), true, true) > short);
186 assert_eq!(toast_height(&model(&"x".repeat(200)), false, false), short);
176 let short = toast_height(&model("Hi"), true);
177 let long = toast_height(&model(&"x".repeat(200)), true);
178 assert_eq!(short, 112.);
179 assert_eq!(long, 130.);
180 assert_eq!(toast_height(&model(&"x".repeat(200)), false), short);
187 181 }
188 182 }
@@ -8,11 +8,13 @@ pub const PILL_HEIGHT: f32 = 32.;
8pub const SIDE_MARGIN: f32 = 16.;
8pub const SIDE_MARGIN: f32 = 16.;
9pub const EDGE_MARGIN: f32 = 12.;
9pub const EDGE_MARGIN: f32 = 12.;
10pub const STACK_GAP: f32 = 8.;
10pub const STACK_GAP: f32 = 8.;
11pub const ACTION_ROW: f32 = 36.;
11pub const ACTION_BUTTON: f32 = 28.;
12pub const SEND_BUTTON: f32 = 32.;
12const BASE_HEIGHT: f32 = 62.;
13const BASE_HEIGHT: f32 = 62.;
13const PREVIEW_LINE: f32 = 18.;
14const PREVIEW_LINE: f32 = 18.;
14const CHARS_PER_LINE: usize = 40;
15const CHARS_PER_LINE: usize = 40;
15const ACTION_ROW_SPACING: f32 = 4.;
16const ACTION_ROW_SPACING: f32 = 4.;
17const REPLY_FIELD_FRAME: f32 = 14.;
16const REPLY_HINT_ROW: f32 = 20.;
18const REPLY_HINT_ROW: f32 = 20.;
17const REPLY_SPACING: f32 = 8.;
19const REPLY_SPACING: f32 = 8.;
18const CONFIRM_HEIGHT: f32 = 56.;
20const CONFIRM_HEIGHT: f32 = 56.;
@@ -32,21 +34,14 @@ fn preview_lines(model: &ToastModel, preview_on: bool) -> usize {
32 }
34 }
33}
35}
34
36
35pub fn toast_height(model: &ToastModel, hovered: bool, preview_on: bool) -> f32 {
37pub fn toast_height(model: &ToastModel, preview_on: bool) -> f32 {
38 let base = BASE_HEIGHT + preview_lines(model, preview_on) as f32 * PREVIEW_LINE;
36 match model.reply {
39 match model.reply {
37 ReplyState::Sent | ReplyState::Failed => CONFIRM_HEIGHT,
40 ReplyState::Sent | ReplyState::Failed => CONFIRM_HEIGHT,
38 ReplyState::Open => {
41 ReplyState::Open => {
39 let base = BASE_HEIGHT + preview_lines(model, preview_on) as f32 * PREVIEW_LINE;
42 base + REPLY_SPACING + SEND_BUTTON + REPLY_FIELD_FRAME + REPLY_HINT_ROW
40 base + REPLY_SPACING + ACTION_ROW + REPLY_HINT_ROW
41 }
42 ReplyState::Closed => {
43 let base = BASE_HEIGHT + preview_lines(model, preview_on) as f32 * PREVIEW_LINE;
44 if hovered {
45 base + ACTION_ROW + ACTION_ROW_SPACING
46 } else {
47 base
48 }
49 }
43 }
44 ReplyState::Closed => base + ACTION_ROW_SPACING + ACTION_BUTTON,
50 }
45 }
51}
46}
52
47
@@ -178,11 +173,10 @@ mod tests {
178 hovered: false,
173 hovered: false,
179 time: String::new(),
174 time: String::new(),
180 };
175 };
181 let short = toast_height(&model("Hi"), false, true);
176 let short = toast_height(&model("Hi"), true);
182 let long = toast_height(&model(&"x".repeat(200)), false, true);
177 let long = toast_height(&model(&"x".repeat(200)), true);
183 assert!((76. ..=104.).contains(&short));
178 assert_eq!(short, 112.);
184 assert!((76. ..=104.).contains(&long));
179 assert_eq!(long, 130.);
185 assert!(toast_height(&model("Hi"), true, true) > short);
180 assert_eq!(toast_height(&model(&"x".repeat(200)), false), short);
186 assert_eq!(toast_height(&model(&"x".repeat(200)), false, false), short);
187 }
181 }
188}
182}
crates/app/src/notify/stack.rs +0 −9
@@ -49,21 +49,12 @@ impl ToastTimer {
49 49 }
50 50 }
51 51
52 pub fn is_paused(&self) -> bool {
53 self.paused.is_some()
54 }
55
56 52 fn elapsed(&self, now: Instant) -> Duration {
57 53 self.paused
58 54 .unwrap_or(now)
59 55 .saturating_duration_since(self.started)
60 56 }
61 57
62 pub fn fraction_left(&self, now: Instant) -> f32 {
63 let left = self.duration.saturating_sub(self.elapsed(now));
64 (left.as_secs_f32() / self.duration.as_secs_f32()).clamp(0., 1.)
65 }
66
67 58 pub fn expired(&self, now: Instant) -> bool {
68 59 if self.paused.is_some() {
69 60 return false;
@@ -49,21 +49,12 @@ impl ToastTimer {
49 }
49 }
50 }
50 }
51
51
52 pub fn is_paused(&self) -> bool {
53 self.paused.is_some()
54 }
55
56 fn elapsed(&self, now: Instant) -> Duration {
52 fn elapsed(&self, now: Instant) -> Duration {
57 self.paused
53 self.paused
58 .unwrap_or(now)
54 .unwrap_or(now)
59 .saturating_duration_since(self.started)
55 .saturating_duration_since(self.started)
60 }
56 }
61
57
62 pub fn fraction_left(&self, now: Instant) -> f32 {
63 let left = self.duration.saturating_sub(self.elapsed(now));
64 (left.as_secs_f32() / self.duration.as_secs_f32()).clamp(0., 1.)
65 }
66
67 pub fn expired(&self, now: Instant) -> bool {
58 pub fn expired(&self, now: Instant) -> bool {
68 if self.paused.is_some() {
59 if self.paused.is_some() {
69 return false;
60 return false;
crates/app/src/notify/toast.rs +54 −66
@@ -1,5 +1,3 @@
1 use std::time::Instant;
2
3 1 use gpui_kit::component::{
4 2 h_flex,
5 3 input::{InputEvent, Textarea, TextareaState},
@@ -9,7 +7,7 @@ use gpui_kit::prelude::FluentBuilder as _;
9 7 use gpui_kit::*;
10 8
11 9 use super::center::NotificationCenter;
12 use super::layout::ACTION_ROW;
10 use super::layout::{ACTION_BUTTON, SEND_BUTTON};
13 11 use super::platform;
14 12 use super::rules::ChatKind;
15 13 use super::stack::{ReplyState, ToastModel};
@@ -22,7 +20,6 @@ use crate::theme;
22 20
23 21 const AVATAR_SIZE: f32 = 40.;
24 22 const CLOSE_SIZE: f32 = 24.;
25 const PROGRESS_HEIGHT: f32 = 3.;
26 23 const TOAST_BORDER_MENTION: f32 = 2.;
27 24
28 25 pub struct ToastView {
@@ -43,7 +40,7 @@ impl ToastView {
43 40 ) -> Self {
44 41 let input = cx.new(|cx| {
45 42 TextareaState::new(window, cx)
46 .auto_grow(1, 4)
43 .auto_grow(1, 1)
47 44 .submit_on_enter(true)
48 45 .placeholder("Reply ...")
49 46 });
@@ -116,28 +113,35 @@ impl ToastView {
116 113 }
117 114 }
118 115
119 fn pill_button(label: &'static str, symbol_name: &'static str, accent: bool) -> Stateful<Div> {
116 fn flat_button(
117 label: &'static str,
118 symbol_name: &'static str,
119 accent: bool,
120 mention: bool,
121 ) -> Stateful<Div> {
120 122 let color = if accent {
121 123 theme::accent_text()
122 124 } else {
123 125 theme::text_soft()
124 126 };
127 let hover_fill = if mention {
128 theme::bubble_own()
129 } else {
130 theme::border_strong()
131 };
125 132 h_flex()
126 133 .id(label)
127 .h(px(ACTION_ROW))
128 .px(px(14.))
134 .h(px(ACTION_BUTTON))
135 .px(px(10.))
129 136 .gap(px(6.))
130 137 .items_center()
131 .justify_center()
132 .rounded(px(8.))
133 .border_1()
134 .border_color(theme::border_strong())
138 .rounded(px(6.))
135 139 .cursor_pointer()
136 .text_size(px(13.))
140 .text_size(px(12.5))
137 141 .font_weight(FontWeight::SEMIBOLD)
138 142 .text_color(color)
139 .hover(|button| button.bg(theme::row_hover()))
140 .child(symbol(symbol_name, 18., color))
143 .hover(move |button| button.bg(hover_fill))
144 .child(symbol(symbol_name, 15., color))
141 145 .child(label)
142 146 }
143 147
@@ -278,6 +282,7 @@ impl ToastView {
278 282 .child(
279 283 h_flex()
280 284 .w_full()
285 .h(px(20.))
281 286 .gap(px(8.))
282 287 .items_center()
283 288 .justify_between()
@@ -307,19 +312,22 @@ impl ToastView {
307 312 .child(preview)
308 313 }
309 314
310 fn action_row(&self, cx: &mut Context<Self>) -> Div {
315 fn action_row(&self, mention: bool, cx: &mut Context<Self>) -> Div {
311 316 let id = self.id;
312 317 let center = self.center.clone();
313 318 h_flex()
314 319 .w_full()
315 320 .mt(px(4.))
316 .justify_between()
317 .child(pill_button("Mark as read", "done", false).on_click(move |_, _, cx| {
318 cx.stop_propagation();
319 center.update(cx, |center, cx| center.mark_read(id, cx));
320 }))
321 .gap(px(4.))
322 .justify_end()
323 .child(
324 flat_button("Mark as read", "done", false, mention).on_click(move |_, _, cx| {
325 cx.stop_propagation();
326 center.update(cx, |center, cx| center.mark_read(id, cx));
327 }),
328 )
321 329 .child(
322 pill_button("Reply", "reply", true).on_click(cx.listener(
330 flat_button("Reply", "reply", true, mention).on_click(cx.listener(
323 331 |this, _, window, cx| {
324 332 cx.stop_propagation();
325 333 this.open_reply(window, cx);
@@ -333,19 +341,18 @@ impl ToastView {
333 341 let empty = self.input.read(cx).value().trim().is_empty();
334 342 let send = div()
335 343 .id("toast-send")
336 .size(px(ACTION_ROW))
344 .size(px(SEND_BUTTON))
337 345 .flex_none()
338 346 .flex()
339 347 .items_center()
340 348 .justify_center()
341 349 .rounded(px(8.))
342 .bg(theme::accent())
343 .child(symbol("arrow_upward", 20., theme::on_accent()))
350 .child(symbol("keyboard_return", 20., white()))
344 351 .when(empty, |button| button.opacity(0.4))
345 352 .when(!empty, |button| {
346 353 button
347 354 .cursor_pointer()
348 .hover(|button| button.bg(theme::accent_text()))
355 .hover(|button| button.bg(white().opacity(0.1)))
349 356 .on_click(cx.listener(|this, _, window, cx| {
350 357 cx.stop_propagation();
351 358 this.submit(window, cx);
@@ -364,30 +371,25 @@ impl ToastView {
364 371 .child(
365 372 h_flex()
366 373 .w_full()
367 .h(px(ACTION_ROW))
374 .items_end()
368 375 .gap(px(6.))
369 .items_center()
376 .py(px(6.))
377 .pl(px(12.))
378 .pr(px(6.))
379 .rounded(px(10.))
380 .bg(theme::surface())
381 .border_1()
382 .border_color(if focused {
383 theme::accent()
384 } else {
385 theme::border_strong()
386 })
370 387 .child(
371 div()
372 .flex_1()
373 .min_w_0()
374 .h(px(ACTION_ROW))
375 .px(px(10.))
376 .flex()
377 .items_center()
378 .rounded(px(8.))
379 .bg(theme::surface())
380 .border_1()
381 .border_color(if focused {
382 theme::accent()
383 } else {
384 theme::border_strong()
385 })
386 .child(
387 Textarea::new(&self.input)
388 .appearance(false)
389 .bordered(false),
390 ),
388 div().flex_1().min_w_0().child(
389 Textarea::new(&self.input)
390 .appearance(false)
391 .bordered(false),
392 ),
391 393 )
392 394 .child(send),
393 395 )
@@ -395,9 +397,10 @@ impl ToastView {
395 397 h_flex()
396 398 .h(px(16.))
397 399 .gap(px(12.))
400 .justify_end()
398 401 .text_size(px(11.))
399 402 .text_color(theme::text_muted())
400 .child(hint("Enter", "senden"))
403 .child(hint("Enter", "send"))
401 404 .child(hint("Shift+Enter", "new line"))
402 405 .child(hint("Esc", "close")),
403 406 )
@@ -439,7 +442,7 @@ impl ToastView {
439 442 )
440 443 })
441 444 .when(!sent, |row| {
442 row.child(pill_button("Retry", "reply", true).on_click(cx.listener(
445 row.child(flat_button("Retry", "reply", true, false).on_click(cx.listener(
443 446 |this, _, _, cx| {
444 447 cx.stop_propagation();
445 448 this.retry(cx);
@@ -487,12 +490,6 @@ impl Render for ToastView {
487 490 theme::border_strong()
488 491 };
489 492 let border_width = if mention { TOAST_BORDER_MENTION } else { 1. };
490 let fraction = model.timer.fraction_left(Instant::now());
491 let bar_color = if model.timer.is_paused() {
492 theme::text_faint()
493 } else {
494 theme::accent()
495 };
496 493 let hovered = model.hovered;
497 494 let content = match model.reply {
498 495 ReplyState::Sent | ReplyState::Failed => self.confirmation(&model, cx),
@@ -517,7 +514,7 @@ impl Render for ToastView {
517 514 .child(self.avatar(&model, fill, cx))
518 515 .child(self.body(&model, &text, hovered)),
519 516 )
520 .when(hovered, |column| column.child(self.action_row(cx))),
517 .child(self.action_row(mention, cx)),
521 518 };
522 519 let center = self.center.clone();
523 520 let hover_center = self.center.clone();
@@ -548,15 +545,6 @@ impl Render for ToastView {
548 545 }
549 546 }))
550 547 .child(div().size_full().p(px(12.)).child(content))
551 .child(
552 div()
553 .absolute()
554 .left_0()
555 .bottom_0()
556 .h(px(PROGRESS_HEIGHT))
557 .w(relative(fraction))
558 .bg(bar_color),
559 )
560 548 .into_any_element()
561 549 }
562 550 }
@@ -1,5 +1,3 @@
1use std::time::Instant;
2
3use gpui_kit::component::{
1use gpui_kit::component::{
4 h_flex,
2 h_flex,
5 input::{InputEvent, Textarea, TextareaState},
3 input::{InputEvent, Textarea, TextareaState},
@@ -9,7 +7,7 @@ use gpui_kit::prelude::FluentBuilder as _;
9use gpui_kit::*;
7use gpui_kit::*;
10
8
11use super::center::NotificationCenter;
9use super::center::NotificationCenter;
12use super::layout::ACTION_ROW;
10use super::layout::{ACTION_BUTTON, SEND_BUTTON};
13use super::platform;
11use super::platform;
14use super::rules::ChatKind;
12use super::rules::ChatKind;
15use super::stack::{ReplyState, ToastModel};
13use super::stack::{ReplyState, ToastModel};
@@ -22,7 +20,6 @@ use crate::theme;
22
20
23const AVATAR_SIZE: f32 = 40.;
21const AVATAR_SIZE: f32 = 40.;
24const CLOSE_SIZE: f32 = 24.;
22const CLOSE_SIZE: f32 = 24.;
25const PROGRESS_HEIGHT: f32 = 3.;
26const TOAST_BORDER_MENTION: f32 = 2.;
23const TOAST_BORDER_MENTION: f32 = 2.;
27
24
28pub struct ToastView {
25pub struct ToastView {
@@ -43,7 +40,7 @@ impl ToastView {
43 ) -> Self {
40 ) -> Self {
44 let input = cx.new(|cx| {
41 let input = cx.new(|cx| {
45 TextareaState::new(window, cx)
42 TextareaState::new(window, cx)
46 .auto_grow(1, 4)
43 .auto_grow(1, 1)
47 .submit_on_enter(true)
44 .submit_on_enter(true)
48 .placeholder("Reply ...")
45 .placeholder("Reply ...")
49 });
46 });
@@ -116,28 +113,35 @@ impl ToastView {
116 }
113 }
117}
114}
118
115
119fn pill_button(label: &'static str, symbol_name: &'static str, accent: bool) -> Stateful<Div> {
116fn flat_button(
117 label: &'static str,
118 symbol_name: &'static str,
119 accent: bool,
120 mention: bool,
121) -> Stateful<Div> {
120 let color = if accent {
122 let color = if accent {
121 theme::accent_text()
123 theme::accent_text()
122 } else {
124 } else {
123 theme::text_soft()
125 theme::text_soft()
124 };
126 };
127 let hover_fill = if mention {
128 theme::bubble_own()
129 } else {
130 theme::border_strong()
131 };
125 h_flex()
132 h_flex()
126 .id(label)
133 .id(label)
127 .h(px(ACTION_ROW))
134 .h(px(ACTION_BUTTON))
128 .px(px(14.))
135 .px(px(10.))
129 .gap(px(6.))
136 .gap(px(6.))
130 .items_center()
137 .items_center()
131 .justify_center()
138 .rounded(px(6.))
132 .rounded(px(8.))
133 .border_1()
134 .border_color(theme::border_strong())
135 .cursor_pointer()
139 .cursor_pointer()
136 .text_size(px(13.))
140 .text_size(px(12.5))
137 .font_weight(FontWeight::SEMIBOLD)
141 .font_weight(FontWeight::SEMIBOLD)
138 .text_color(color)
142 .text_color(color)
139 .hover(|button| button.bg(theme::row_hover()))
143 .hover(move |button| button.bg(hover_fill))
140 .child(symbol(symbol_name, 18., color))
144 .child(symbol(symbol_name, 15., color))
141 .child(label)
145 .child(label)
142}
146}
143
147
@@ -278,6 +282,7 @@ impl ToastView {
278 .child(
282 .child(
279 h_flex()
283 h_flex()
280 .w_full()
284 .w_full()
285 .h(px(20.))
281 .gap(px(8.))
286 .gap(px(8.))
282 .items_center()
287 .items_center()
283 .justify_between()
288 .justify_between()
@@ -307,19 +312,22 @@ impl ToastView {
307 .child(preview)
312 .child(preview)
308 }
313 }
309
314
310 fn action_row(&self, cx: &mut Context<Self>) -> Div {
315 fn action_row(&self, mention: bool, cx: &mut Context<Self>) -> Div {
311 let id = self.id;
316 let id = self.id;
312 let center = self.center.clone();
317 let center = self.center.clone();
313 h_flex()
318 h_flex()
314 .w_full()
319 .w_full()
315 .mt(px(4.))
320 .mt(px(4.))
316 .justify_between()
321 .gap(px(4.))
317 .child(pill_button("Mark as read", "done", false).on_click(move |_, _, cx| {
322 .justify_end()
318 cx.stop_propagation();
323 .child(
319 center.update(cx, |center, cx| center.mark_read(id, cx));
324 flat_button("Mark as read", "done", false, mention).on_click(move |_, _, cx| {
320 }))
325 cx.stop_propagation();
326 center.update(cx, |center, cx| center.mark_read(id, cx));
327 }),
328 )
321 .child(
329 .child(
322 pill_button("Reply", "reply", true).on_click(cx.listener(
330 flat_button("Reply", "reply", true, mention).on_click(cx.listener(
323 |this, _, window, cx| {
331 |this, _, window, cx| {
324 cx.stop_propagation();
332 cx.stop_propagation();
325 this.open_reply(window, cx);
333 this.open_reply(window, cx);
@@ -333,19 +341,18 @@ impl ToastView {
333 let empty = self.input.read(cx).value().trim().is_empty();
341 let empty = self.input.read(cx).value().trim().is_empty();
334 let send = div()
342 let send = div()
335 .id("toast-send")
343 .id("toast-send")
336 .size(px(ACTION_ROW))
344 .size(px(SEND_BUTTON))
337 .flex_none()
345 .flex_none()
338 .flex()
346 .flex()
339 .items_center()
347 .items_center()
340 .justify_center()
348 .justify_center()
341 .rounded(px(8.))
349 .rounded(px(8.))
342 .bg(theme::accent())
350 .child(symbol("keyboard_return", 20., white()))
343 .child(symbol("arrow_upward", 20., theme::on_accent()))
344 .when(empty, |button| button.opacity(0.4))
351 .when(empty, |button| button.opacity(0.4))
345 .when(!empty, |button| {
352 .when(!empty, |button| {
346 button
353 button
347 .cursor_pointer()
354 .cursor_pointer()
348 .hover(|button| button.bg(theme::accent_text()))
355 .hover(|button| button.bg(white().opacity(0.1)))
349 .on_click(cx.listener(|this, _, window, cx| {
356 .on_click(cx.listener(|this, _, window, cx| {
350 cx.stop_propagation();
357 cx.stop_propagation();
351 this.submit(window, cx);
358 this.submit(window, cx);
@@ -364,30 +371,25 @@ impl ToastView {
364 .child(
371 .child(
365 h_flex()
372 h_flex()
366 .w_full()
373 .w_full()
367 .h(px(ACTION_ROW))
374 .items_end()
368 .gap(px(6.))
375 .gap(px(6.))
369 .items_center()
376 .py(px(6.))
377 .pl(px(12.))
378 .pr(px(6.))
379 .rounded(px(10.))
380 .bg(theme::surface())
381 .border_1()
382 .border_color(if focused {
383 theme::accent()
384 } else {
385 theme::border_strong()
386 })
370 .child(
387 .child(
371 div()
388 div().flex_1().min_w_0().child(
372 .flex_1()
389 Textarea::new(&self.input)
373 .min_w_0()
390 .appearance(false)
374 .h(px(ACTION_ROW))
391 .bordered(false),
375 .px(px(10.))
392 ),
376 .flex()
377 .items_center()
378 .rounded(px(8.))
379 .bg(theme::surface())
380 .border_1()
381 .border_color(if focused {
382 theme::accent()
383 } else {
384 theme::border_strong()
385 })
386 .child(
387 Textarea::new(&self.input)
388 .appearance(false)
389 .bordered(false),
390 ),
391 )
393 )
392 .child(send),
394 .child(send),
393 )
395 )
@@ -395,9 +397,10 @@ impl ToastView {
395 h_flex()
397 h_flex()
396 .h(px(16.))
398 .h(px(16.))
397 .gap(px(12.))
399 .gap(px(12.))
400 .justify_end()
398 .text_size(px(11.))
401 .text_size(px(11.))
399 .text_color(theme::text_muted())
402 .text_color(theme::text_muted())
400 .child(hint("Enter", "senden"))
403 .child(hint("Enter", "send"))
401 .child(hint("Shift+Enter", "new line"))
404 .child(hint("Shift+Enter", "new line"))
402 .child(hint("Esc", "close")),
405 .child(hint("Esc", "close")),
403 )
406 )
@@ -439,7 +442,7 @@ impl ToastView {
439 )
442 )
440 })
443 })
441 .when(!sent, |row| {
444 .when(!sent, |row| {
442 row.child(pill_button("Retry", "reply", true).on_click(cx.listener(
445 row.child(flat_button("Retry", "reply", true, false).on_click(cx.listener(
443 |this, _, _, cx| {
446 |this, _, _, cx| {
444 cx.stop_propagation();
447 cx.stop_propagation();
445 this.retry(cx);
448 this.retry(cx);
@@ -487,12 +490,6 @@ impl Render for ToastView {
487 theme::border_strong()
490 theme::border_strong()
488 };
491 };
489 let border_width = if mention { TOAST_BORDER_MENTION } else { 1. };
492 let border_width = if mention { TOAST_BORDER_MENTION } else { 1. };
490 let fraction = model.timer.fraction_left(Instant::now());
491 let bar_color = if model.timer.is_paused() {
492 theme::text_faint()
493 } else {
494 theme::accent()
495 };
496 let hovered = model.hovered;
493 let hovered = model.hovered;
497 let content = match model.reply {
494 let content = match model.reply {
498 ReplyState::Sent | ReplyState::Failed => self.confirmation(&model, cx),
495 ReplyState::Sent | ReplyState::Failed => self.confirmation(&model, cx),
@@ -517,7 +514,7 @@ impl Render for ToastView {
517 .child(self.avatar(&model, fill, cx))
514 .child(self.avatar(&model, fill, cx))
518 .child(self.body(&model, &text, hovered)),
515 .child(self.body(&model, &text, hovered)),
519 )
516 )
520 .when(hovered, |column| column.child(self.action_row(cx))),
517 .child(self.action_row(mention, cx)),
521 };
518 };
522 let center = self.center.clone();
519 let center = self.center.clone();
523 let hover_center = self.center.clone();
520 let hover_center = self.center.clone();
@@ -548,15 +545,6 @@ impl Render for ToastView {
548 }
545 }
549 }))
546 }))
550 .child(div().size_full().p(px(12.)).child(content))
547 .child(div().size_full().p(px(12.)).child(content))
551 .child(
552 div()
553 .absolute()
554 .left_0()
555 .bottom_0()
556 .h(px(PROGRESS_HEIGHT))
557 .w(relative(fraction))
558 .bg(bar_color),
559 )
560 .into_any_element()
548 .into_any_element()
561 }
549 }
562}
550}