From 74dd32d52cb55f2696e27cd6b601563bce2a0ce5 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Sun, 30 Mar 2025 18:31:56 -0300 Subject: [PATCH] assistant2: Fix overflowing notification title (#27763) Release Notes: - N/A --- .../assistant2/src/ui/agent_notification.rs | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/crates/assistant2/src/ui/agent_notification.rs b/crates/assistant2/src/ui/agent_notification.rs index 4f2025edb778b594c4fb7d5c7bc8e4f60c183e83..56448b999a5b305332d608616a15f5c447ddee83 100644 --- a/crates/assistant2/src/ui/agent_notification.rs +++ b/crates/assistant2/src/ui/agent_notification.rs @@ -76,6 +76,19 @@ impl Render for AgentNotification { let line_height = window.line_height(); let bg = cx.theme().colors().elevated_surface_background; + let gradient_overflow = || { + div() + .h_full() + .absolute() + .w_8() + .bottom_0() + .right_0() + .bg(linear_gradient( + 90., + linear_color_stop(bg, 1.), + linear_color_stop(bg.opacity(0.2), 0.), + )) + }; h_flex() .id("agent-notification") @@ -107,27 +120,23 @@ impl Render for AgentNotification { v_flex() .child( div() + .relative() .text_size(px(14.)) .text_color(cx.theme().colors().text) - .child(self.title.clone()), + .max_w(px(300.)) + .truncate() + .child(self.title.clone()) + .child(gradient_overflow()), ) .child( div() + .relative() .text_size(px(12.)) .text_color(cx.theme().colors().text_muted) .max_w(px(340.)) .truncate() .child(self.caption.clone()) - .relative() - .child( - div().h_full().absolute().w_8().bottom_0().right_0().bg( - linear_gradient( - 90., - linear_color_stop(bg, 1.), - linear_color_stop(bg.opacity(0.2), 0.), - ), - ), - ), + .child(gradient_overflow()), ), ), )