Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

recent_view: Show channel name tooltip if it is truncated.

Aman Agrawal5cc74a6f4737
diff --git a/web/src/tippyjs.ts b/web/src/tippyjs.ts
index 1b3de53c5fe..f7c5e5f9281 100644
--- a/web/src/tippyjs.ts
+++ b/web/src/tippyjs.ts
@@ -1024,6 +1024,22 @@ export function initialize(): void {
},
});
+ tippy.delegate("body", {
+ target: ".recent-view-channel-name",
+ delay: LONG_HOVER_DELAY,
+ onShow(instance) {
+ // Show channel name tooltip only if it's truncated.
+ if (instance.reference.scrollWidth > instance.reference.clientWidth) {
+ return undefined;
+ }
+ return false;
+ },
+ appendTo: () => document.body,
+ onHidden(instance) {
+ instance.destroy();
+ },
+ });
+
tippy.delegate("body", {
target: "#recipient_box_clear_topic_button",
delay: LONG_HOVER_DELAY,
diff --git a/web/templates/recent_view_row.hbs b/web/templates/recent_view_row.hbs
index 9d306c77684..4041c78ba18 100644
--- a/web/templates/recent_view_row.hbs
+++ b/web/templates/recent_view_row.hbs
@@ -25,7 +25,7 @@
{{#if is_private}}
<a href="{{pm_url}}" class="recent-view-dm-name recent-view-table-link" tabindex="-1">{{t "DM" }}</a>
{{else}}
- <a href="{{topic_url}}" class="recent-view-channel-name recent-view-table-link" tabindex="-1">{{stream_name}}</a>
+ <a href="{{topic_url}}" class="recent-view-channel-name recent-view-table-link" data-tippy-content="{{stream_name}}" tabindex="-1">{{stream_name}}</a>
{{/if}}
<i class="zulip-icon zulip-icon-chevron-right"></i>
{{#if is_private}}