From ca7b864261866f9c508468b4ff6124be44d881f1 Mon Sep 17 00:00:00 2001 From: Chili Palmer Date: Sun, 19 Jul 2026 21:46:19 +0200 Subject: [PATCH] Clarify activity bar tooltips --- crates/bds-ui/src/components/inputs.rs | 25 +++++++++++++++++++++++++ crates/bds-ui/src/views/activity_bar.rs | 2 ++ crates/bds-ui/src/views/tab_bar.rs | 16 ++-------------- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/crates/bds-ui/src/components/inputs.rs b/crates/bds-ui/src/components/inputs.rs index 5b6d6ad..6a8257f 100644 --- a/crates/bds-ui/src/components/inputs.rs +++ b/crates/bds-ui/src/components/inputs.rs @@ -41,6 +41,20 @@ pub fn app_theme() -> Theme { ) } +/// Opaque tooltip surface that remains legible over editor and sidebar content. +pub fn tooltip_style(_theme: &Theme) -> container::Style { + container::Style { + background: Some(Background::Color(Color::from_rgb(0.20, 0.20, 0.24))), + border: Border { + color: Color::from_rgb(0.35, 0.35, 0.40), + width: 1.0, + radius: 6.0.into(), + }, + text_color: Some(Color::WHITE), + ..container::Style::default() + } +} + pub fn field_style(_theme: &Theme, status: text_input::Status) -> text_input::Style { let border_color = match status { text_input::Status::Focused => FOCUS_COLOR, @@ -377,4 +391,15 @@ mod tests { .color ); } + + #[test] + fn tooltip_surface_is_opaque_rounded_and_bordered() { + let style = tooltip_style(&app_theme()); + assert!(matches!( + style.background, + Some(Background::Color(color)) if color.a == 1.0 + )); + assert_eq!(style.border.width, 1.0); + assert_eq!(style.border.radius.top_left, 6.0); + } } diff --git a/crates/bds-ui/src/views/activity_bar.rs b/crates/bds-ui/src/views/activity_bar.rs index e8eaf18..8539eeb 100644 --- a/crates/bds-ui/src/views/activity_bar.rs +++ b/crates/bds-ui/src/views/activity_bar.rs @@ -5,6 +5,7 @@ use iced::{Background, Border, Color, Element, Length, Theme}; use bds_core::i18n::UiLocale; use crate::app::Message; +use crate::components::inputs; use crate::i18n::t; use crate::state::navigation::SidebarView; @@ -145,6 +146,7 @@ pub fn view( tooltip::Position::Right, ) .gap(4) + .style(inputs::tooltip_style) .into() }; diff --git a/crates/bds-ui/src/views/tab_bar.rs b/crates/bds-ui/src/views/tab_bar.rs index e65cb69..6ec9c06 100644 --- a/crates/bds-ui/src/views/tab_bar.rs +++ b/crates/bds-ui/src/views/tab_bar.rs @@ -7,6 +7,7 @@ use iced::{Background, Border, Color, Element, Font, Length, Theme}; use bds_core::i18n::UiLocale; use crate::app::Message; +use crate::components::inputs; use crate::i18n::t; use crate::state::tabs::Tab; @@ -79,19 +80,6 @@ fn close_style(_theme: &Theme, status: button::Status) -> button::Style { } } -/// Tooltip style. -fn tooltip_style(_theme: &Theme) -> container::Style { - container::Style { - background: Some(Background::Color(Color::from_rgb(0.20, 0.20, 0.24))), - border: Border { - color: Color::from_rgb(0.35, 0.35, 0.40), - width: 1.0, - radius: 6.0.into(), - }, - ..container::Style::default() - } -} - /// Truncate chat title per tabs.allium: chat_title_max_length = 18. fn truncate_chat_title(title: &str) -> String { if title.chars().count() > CHAT_TITLE_MAX_LEN { @@ -214,7 +202,7 @@ pub fn view(tabs: &[Tab], active_tab: Option<&str>, locale: UiLocale) -> Element Position::Bottom, ) .gap(4) - .style(tooltip_style) + .style(inputs::tooltip_style) .into(); tip