tooltips: Use tippy to display tooltips.

Fixes: #27817
Co-Authored-By: linn.peterson <linn@pajp.net>
Co-Authored-By: Aman Agrawal <amanagr@zulip.com>
This commit is contained in:
shashank-23002
2024-01-26 14:53:38 +00:00
committed by Tim Abbott
parent b6e2a1b50d
commit d6146d77c1
11 changed files with 31 additions and 12 deletions

View File

@@ -136,6 +136,25 @@ export function initialize(): void {
placement: "bottom",
});
tippy.delegate("body", {
target: "#subscription_overlay .subscription_settings .sub-stream-name",
delay: LONG_HOVER_DELAY,
appendTo: () => document.body,
placement: "top",
onShow(instance) {
const stream_name_element = instance.reference;
assert(stream_name_element instanceof HTMLElement);
// Only show tooltip if the stream name is truncated.
// See https://stackoverflow.com/questions/21064101/understanding-offsetwidth-clientwidth-scrollwidth-and-height-respectively
// for more details.
if (stream_name_element.offsetWidth >= stream_name_element.scrollWidth) {
return false;
}
return undefined;
},
});
tippy.delegate("body", {
target: ".tippy-left-sidebar-tooltip",
placement: "right",