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.

left sidebar: Improve tooltip for show_all_private_messages.

Hardik Dharmani98176ddb5703
diff --git a/web/src/tippyjs.js b/web/src/tippyjs.js
index d92bcaa782c..fc8b00fec78 100644
--- a/web/src/tippyjs.js
+++ b/web/src/tippyjs.js
@@ -133,6 +133,27 @@ export function initialize() {
},
});
+ // Variant of .tippy-left-sidebar-tooltip configuration. Since
+ // this element doesn't have an always visible label, and
+ // thus hovering it is a way to find out what it does, give
+ // it the faster LONG_HOVER_DELAY.
+ delegate("body", {
+ target: "#show_all_private_messages",
+ placement: "right",
+ delay: LONG_HOVER_DELAY,
+ appendTo: () => document.body,
+ popperOptions: {
+ modifiers: [
+ {
+ name: "flip",
+ options: {
+ fallbackPlacements: "bottom",
+ },
+ },
+ ],
+ },
+ });
+
// The below definitions are for specific tooltips that require
// custom JavaScript code or configuration. Note that since the
// below specify the target directly, elements using those should
@@ -549,15 +570,6 @@ export function initialize() {
appendTo: () => document.body,
});
- delegate("body", {
- target: "#show_all_private_messages",
- placement: "bottom",
- content: $t({
- defaultMessage: "All direct messages (P)",
- }),
- appendTo: () => document.body,
- });
-
delegate("body", {
target: ".view_user_card_tooltip",
content: $t({
diff --git a/web/templates/left_sidebar.hbs b/web/templates/left_sidebar.hbs
index 41b8d9fda23..57a227cc918 100644
--- a/web/templates/left_sidebar.hbs
+++ b/web/templates/left_sidebar.hbs
@@ -77,9 +77,13 @@
<h4 class="sidebar-title toggle_private_messages_section">{{t 'DIRECT MESSAGES' }}</h4>
</span>
<span class="unread_count"></span>
- <a id="show_all_private_messages" href="#narrow/is/private">
+ <a id="show_all_private_messages" href="#narrow/is/private" data-tooltip-template-id="show-all-pms-template">
<i class="fa fa-align-right" aria-label="{{t 'All direct messages' }}"></i>
</a>
+ <template id="show-all-pms-template">
+ {{t 'All direct messages' }}
+ {{tooltip_hotkey_hints "P"}}
+ </template>
</div>
</div>
<a class="zoom-out-hide" id="hide_more_private_messages">