Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
sidebar_ui: Convert module to typescript.
evykassirer860150525c3a
diff --git a/tools/test-js-with-node b/tools/test-js-with-nodeindex aed230bcd61..d80949d188e 100755--- a/tools/test-js-with-node+++ b/tools/test-js-with-node@@ -221,7 +221,7 @@ EXEMPT_FILES = make_set("web/src/settings_user_topics.js","web/src/settings_users.js","web/src/setup.ts",- "web/src/sidebar_ui.js",+ "web/src/sidebar_ui.ts","web/src/spectators.ts","web/src/spoilers.ts","web/src/starred_messages_ui.js",diff --git a/web/src/sidebar_ui.js b/web/src/sidebar_ui.tssimilarity index 91%rename from web/src/sidebar_ui.jsrename to web/src/sidebar_ui.tsindex 44c594da46c..b71e47a954f 100644--- a/web/src/sidebar_ui.js+++ b/web/src/sidebar_ui.ts@@ -15,33 +15,33 @@ import {user_settings} from "./user_settings";export let left_sidebar_expanded_as_overlay = false;export let right_sidebar_expanded_as_overlay = false;-export function hide_userlist_sidebar() {+export function hide_userlist_sidebar(): void {$(".app-main .column-right").removeClass("expanded");right_sidebar_expanded_as_overlay = false;}-export function show_userlist_sidebar() {+export function show_userlist_sidebar(): void {$(".app-main .column-right").addClass("expanded");resize.resize_page_components();right_sidebar_expanded_as_overlay = true;}-export function show_streamlist_sidebar() {+export function show_streamlist_sidebar(): void {$(".app-main .column-left").addClass("expanded");resize.resize_stream_filters_container();left_sidebar_expanded_as_overlay = true;}-export function hide_streamlist_sidebar() {+export function hide_streamlist_sidebar(): void {$(".app-main .column-left").removeClass("expanded");left_sidebar_expanded_as_overlay = false;}-export function any_sidebar_expanded_as_overlay() {+export function any_sidebar_expanded_as_overlay(): boolean {return left_sidebar_expanded_as_overlay || right_sidebar_expanded_as_overlay;}-export function update_invite_user_option() {+export function update_invite_user_option(): void {if (!settings_data.user_can_invite_users_by_email() &&!settings_data.user_can_create_multiuse_invite()@@ -52,12 +52,12 @@ export function update_invite_user_option() {}}-export function hide_all() {+export function hide_all(): void {hide_streamlist_sidebar();hide_userlist_sidebar();}-export function initialize() {+export function initialize(): void {$("body").on("click", ".login_button", (e) => {e.preventDefault();e.stopPropagation();@@ -94,6 +94,10 @@ export function initialize() {return;}+ if (!(e.target instanceof Element)) {+ return;+ }+const $elt = $(e.target);// Since sidebar toggle buttons have their own click handlers, don't handle them here.if (@@ -135,7 +139,7 @@ export function initialize() {);}-export function initialize_left_sidebar() {+export function initialize_left_sidebar(): void {const rendered_sidebar = render_left_sidebar({is_guest: current_user.is_guest,development_environment: page_params.development_environment,@@ -151,7 +155,7 @@ export function initialize_left_sidebar() {$("#left-sidebar-container").html(rendered_sidebar);}-export function initialize_right_sidebar() {+export function initialize_right_sidebar(): void {const rendered_sidebar = render_right_sidebar({realm_rendered_description: page_params.realm_rendered_description,});