From 5f35384c803b88dc54ab73b6c661f09be2f21727 Mon Sep 17 00:00:00 2001 From: Kislay Verma Date: Wed, 3 Apr 2024 19:44:34 +0530 Subject: [PATCH] settings: Move init disable button function. This commit moves the function initialize_disable_btn_hint_popover from stream_ui_updates.js to settings_components.js due to circular dependencies. Added opts parameter to append to the options for the tippy instance. Fixes #27511. Co-authored-by: Angelica Ferlin Co-authored-by: Peterson Linn Co-authored-by: Kislay Verma --- web/src/settings_components.ts | 22 ++++++++++++++++++++++ web/src/stream_ui_updates.js | 24 ++++++------------------ web/src/user_group_edit.js | 5 ++--- web/src/user_profile.js | 4 ++-- 4 files changed, 32 insertions(+), 23 deletions(-) diff --git a/web/src/settings_components.ts b/web/src/settings_components.ts index 2b51860d5d..01b8c6c315 100644 --- a/web/src/settings_components.ts +++ b/web/src/settings_components.ts @@ -1,5 +1,7 @@ import $ from "jquery"; import assert from "minimalistic-assert"; +import type {Props} from "tippy.js"; +import tippy from "tippy.js"; import render_compose_banner from "../templates/compose_banner/compose_banner.hbs"; @@ -918,3 +920,23 @@ function enable_or_disable_save_button($subsection_elem: JQuery): void { $subsection_elem.find(".subsection-changes-save button").prop("disabled", disable_save_btn); } + +export function initialize_disable_btn_hint_popover( + $btn_wrapper: JQuery, + hint_text: string | undefined, + opts: Partial, +): void { + const tippy_opts: Partial = { + animation: false, + hideOnClick: false, + placement: "bottom", + ...opts, + }; + + // If hint_text is undefined, we use the HTML content of a + //