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.

popovers: Convert module to TypeScript.

Anders Kaseorg2163cb77701e
diff --git a/tools/test-js-with-node b/tools/test-js-with-node
index 4aee6b66392..c5cef1c2486 100755
--- a/tools/test-js-with-node
+++ b/tools/test-js-with-node
@@ -162,7 +162,7 @@ EXEMPT_FILES = make_set(
"web/src/poll_widget.js",
"web/src/popover_menus.js",
"web/src/popover_menus_data.js",
- "web/src/popovers.js",
+ "web/src/popovers.ts",
"web/src/read_receipts.js",
"web/src/ready.ts",
"web/src/realm_icon.ts",
diff --git a/web/src/condense.js b/web/src/condense.js
index 452638f4a64..06fc7791e66 100644
--- a/web/src/condense.js
+++ b/web/src/condense.js
@@ -106,7 +106,7 @@ export function toggle_collapse(message) {
if (message.is_me_message) {
// Disabled temporarily because /me messages don't have a
// styling for collapsing /me messages (they only recently
- // added multi-line support). See also popovers.js.
+ // added multi-line support). See also popover_menus_data.js.
return;
}
diff --git a/web/src/popovers.js b/web/src/popovers.ts
similarity index 76%
rename from web/src/popovers.js
rename to web/src/popovers.ts
index 8688bd395cf..3f63997590b 100644
--- a/web/src/popovers.js
+++ b/web/src/popovers.ts
@@ -1,9 +1,9 @@
import $ from "jquery";
import * as tippy from "tippy.js";
-export function any_active() {
+export function any_active(): boolean {
// Checks if there are any interactive tippy instances (= popovers) present.
- const $tippy_instances = $("[data-tippy-root]");
+ const $tippy_instances = $<tippy.PopperElement>("div[data-tippy-root]");
// Tippy instances with `interactive: true` are popovers by definition.
const num_interactive_instances = $tippy_instances.filter(
(_i, elt) => elt._tippy?.props.interactive === true,
@@ -11,7 +11,7 @@ export function any_active() {
return Boolean(num_interactive_instances);
}
-export function hide_all() {
+export function hide_all(): void {
// Hides all tippy instances (tooltips and popovers).
tippy.hideAll();
}