overlays: Extract modal methods in separate file.

This commit is contained in:
Aman Agrawal
2023-10-10 12:25:18 +00:00
committed by Tim Abbott
parent 6713ad9d4d
commit 577a384845
14 changed files with 276 additions and 246 deletions

View File

@@ -6,7 +6,7 @@ import render_dialog_widget from "../templates/dialog_widget.hbs";
import type {AjaxRequestHandler} from "./channel";
import {$t_html} from "./i18n";
import * as loading from "./loading";
import * as overlays from "./overlays";
import * as modals from "./modals";
import * as ui_report from "./ui_report";
/*
@@ -22,7 +22,7 @@ import * as ui_report from "./ui_report";
* to avoid interference from other elements.
*
* 3) For settings, we have a click handler in settings.js
* that will close the dialog via overlays.close_active_modal.
* that will close the dialog via modals.close_active_modal.
*
* 4) We assume that since this is a modal, you will
* only ever have one confirm dialog active at any
@@ -99,7 +99,7 @@ export function show_dialog_spinner(): void {
// Supports a callback to be called once the modal finishes closing.
export function close_modal(on_hidden_callback?: () => void): void {
overlays.close_modal("dialog_widget_modal", {on_hidden: on_hidden_callback});
modals.close_modal("dialog_widget_modal", {on_hidden: on_hidden_callback});
}
export function launch(conf: DialogWidgetConfig): void {
@@ -210,7 +210,7 @@ export function launch(conf: DialogWidgetConfig): void {
conf.on_click(e);
});
overlays.open_modal("dialog_widget_modal", {
modals.open_modal("dialog_widget_modal", {
autoremove: true,
on_show() {
if (conf.focus_submit_on_open) {