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: Present one-line topics with conditional tooltip.

Karl Stolley44c0242efa72
diff --git a/web/src/tippyjs.ts b/web/src/tippyjs.ts
index f7c5e5f9281..8644225f81a 100644
--- a/web/src/tippyjs.ts
+++ b/web/src/tippyjs.ts
@@ -1040,6 +1040,25 @@ export function initialize(): void {
},
});
+ tippy.delegate("body", {
+ target: ".recent-view-conversation-link",
+ delay: LONG_HOVER_DELAY,
+ appendTo: () => document.body,
+ placement: "top",
+ onShow(instance) {
+ const name_element = instance.reference;
+ assert(name_element instanceof HTMLElement);
+ // Only show tooltip if the stream or group name is truncated.
+ // See https://stackoverflow.com/questions/21064101/understanding-offsetwidth-clientwidth-scrollwidth-and-height-respectively
+ // for more details.
+ if (name_element.offsetWidth >= name_element.scrollWidth) {
+ return false;
+ }
+
+ return undefined;
+ },
+ });
+
tippy.delegate("body", {
target: "#recipient_box_clear_topic_button",
delay: LONG_HOVER_DELAY,
diff --git a/web/styles/recent_view.css b/web/styles/recent_view.css
index 2cbf1d45f41..238e87e4b7f 100644
--- a/web/styles/recent_view.css
+++ b/web/styles/recent_view.css
@@ -500,6 +500,9 @@
.recent-view-conversation-link {
grid-area: conversation-name;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
}
.recent-view-unread-mention-and-count-wrapper {
diff --git a/web/templates/recent_view_row.hbs b/web/templates/recent_view_row.hbs
index 9797328656e..a7836707fdf 100644
--- a/web/templates/recent_view_row.hbs
+++ b/web/templates/recent_view_row.hbs
@@ -29,7 +29,7 @@
{{#if is_private}}
<a href="{{pm_url}}" class="recent-view-conversation-link recent-view-table-link {{#if is_group}}recent-view-dm-group{{else}}recent-view-dm{{/if}}" tabindex="-1">{{{rendered_pm_with_html}}}</a>
{{else}}
- <a class="recent-view-conversation-link recent-view-table-link {{#if is_empty_string_topic}}empty-topic-display{{/if}}" href="{{topic_url}}" tabindex="-1">{{topic_display_name}}</a>
+ <a class="recent-view-conversation-link recent-view-table-link {{#if is_empty_string_topic}}empty-topic-display{{/if}}" data-tippy-content="{{topic_display_name}}" href="{{topic_url}}" tabindex="-1">{{topic_display_name}}</a>
{{/if}}
<div class="recent-view-unread-mention-and-count-wrapper">
{{#if is_private}}