Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2025-02-12 - Status Icon Tooltips
**Learning:** Status icons implemented as `View`s or `LoadingSpinner`s require manual hover detection in the parent widget's `handle_event` method, as they don't automatically support tooltips.
**Action:** Always check `visible()` before dispatching `TooltipAction::HoverIn` to avoid phantom tooltips for hidden elements.
77 changes: 76 additions & 1 deletion src/home/rooms_list_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::mem::discriminant;
use makepad_widgets::*;
use matrix_sdk_ui::sync_service::State;

use crate::{home::navigation_tab_bar::{NavigationBarAction, SelectedTab}, shared::{image_viewer::{ImageViewerAction, ImageViewerError, LoadState}, popup_list::{PopupKind, enqueue_popup_notification}}};
use crate::{home::navigation_tab_bar::{NavigationBarAction, SelectedTab}, shared::{callout_tooltip::{CalloutTooltipOptions, TooltipAction, TooltipPosition}, image_viewer::{ImageViewerAction, ImageViewerError, LoadState}, popup_list::{PopupKind, enqueue_popup_notification}}};

live_design! {
use link::theme::*;
Expand Down Expand Up @@ -142,6 +142,81 @@ impl Widget for RoomsListHeader {
}
}

let loading_spinner = self.view.view(ids!(loading_spinner));
if loading_spinner.visible() {
let area = loading_spinner.area();
match event.hits(cx, area) {
Hit::FingerHoverIn(_) => {
cx.widget_action(
self.widget_uid(),
&scope.path,
TooltipAction::HoverIn {
text: "Syncing...".to_string(),
widget_rect: area.rect(cx),
options: CalloutTooltipOptions {
position: TooltipPosition::Bottom,
..Default::default()
},
},
);
}
Hit::FingerHoverOut(_) => {
cx.widget_action(self.widget_uid(), &scope.path, TooltipAction::HoverOut);
}
_ => {}
}
}

let offline_icon = self.view.view(ids!(offline_icon));
if offline_icon.visible() {
let area = offline_icon.area();
match event.hits(cx, area) {
Hit::FingerHoverIn(_) => {
cx.widget_action(
self.widget_uid(),
&scope.path,
TooltipAction::HoverIn {
text: "Offline".to_string(),
widget_rect: area.rect(cx),
options: CalloutTooltipOptions {
position: TooltipPosition::Bottom,
..Default::default()
},
},
);
}
Hit::FingerHoverOut(_) => {
cx.widget_action(self.widget_uid(), &scope.path, TooltipAction::HoverOut);
}
_ => {}
}
}

let synced_icon = self.view.view(ids!(synced_icon));
if synced_icon.visible() {
let area = synced_icon.area();
match event.hits(cx, area) {
Hit::FingerHoverIn(_) => {
cx.widget_action(
self.widget_uid(),
&scope.path,
TooltipAction::HoverIn {
text: "Synced".to_string(),
widget_rect: area.rect(cx),
options: CalloutTooltipOptions {
position: TooltipPosition::Bottom,
..Default::default()
},
},
);
}
Hit::FingerHoverOut(_) => {
cx.widget_action(self.widget_uid(), &scope.path, TooltipAction::HoverOut);
}
_ => {}
}
}

self.view.handle_event(cx, event, scope);
}

Expand Down