personal_menu_popover: Convert module to TypeScript.

This commit is contained in:
Varun Singh 2024-10-11 00:49:51 +05:30 committed by Tim Abbott
parent 9d2a82d477
commit f4de1c4313
2 changed files with 7 additions and 7 deletions

View File

@ -172,7 +172,7 @@ EXEMPT_FILES = make_set(
"web/src/overlays.ts",
"web/src/padded_widget.ts",
"web/src/page_params.ts",
"web/src/personal_menu_popover.js",
"web/src/personal_menu_popover.ts",
"web/src/playground_links_popover.ts",
"web/src/plotly.js.d.ts",
"web/src/pm_list.ts",

View File

@ -13,7 +13,7 @@ import {parse_html} from "./ui_util";
import {user_settings} from "./user_settings";
import * as user_status from "./user_status";
export function initialize() {
export function initialize(): void {
popover_menus.register_popover_menu("#personal-menu", {
theme: "popover-menu",
placement: "bottom",
@ -100,12 +100,12 @@ export function initialize() {
e.preventDefault();
});
$popper.one("click", ".open-profile-settings", (e) => {
e.currentTarget.click();
$popper.one("click", ".open-profile-settings", function (this: HTMLElement, e) {
this.click();
popovers.hide_all();
e.preventDefault();
});
instance.popperInstance.update();
void instance.popperInstance?.update();
},
onShow(instance) {
const args = popover_menus_data.get_personal_menu_content_context();
@ -113,12 +113,12 @@ export function initialize() {
},
onHidden(instance) {
instance.destroy();
popover_menus.popover_instances.personal_menu = undefined;
popover_menus.popover_instances.personal_menu = null;
},
});
}
export function toggle() {
export function toggle(): void {
// NOTE: Since to open personal menu, you need to click on your avatar (which calls
// tippyjs.hideAll()), or go via gear menu if using hotkeys, we don't need to
// call tippyjs.hideAll() for it.