ts: Convert `deprecated_feature_notice` module to TypeScript.

This commit is contained in:
Lalit 2023-05-18 19:52:20 +05:30 committed by Tim Abbott
parent 0216eb8915
commit a2db6df826
2 changed files with 10 additions and 5 deletions

View File

@ -78,7 +78,7 @@ EXEMPT_FILES = make_set(
"web/src/css_variables.js", "web/src/css_variables.js",
"web/src/dark_theme.ts", "web/src/dark_theme.ts",
"web/src/debug.ts", "web/src/debug.ts",
"web/src/deprecated_feature_notice.js", "web/src/deprecated_feature_notice.ts",
"web/src/desktop_integration.js", "web/src/desktop_integration.js",
"web/src/dialog_widget.ts", "web/src/dialog_widget.ts",
"web/src/drafts.js", "web/src/drafts.js",

View File

@ -6,7 +6,10 @@ import * as dialog_widget from "./dialog_widget";
import {$t_html} from "./i18n"; import {$t_html} from "./i18n";
import {localstorage} from "./localstorage"; import {localstorage} from "./localstorage";
export function get_hotkey_deprecation_notice(originalHotkey, replacementHotkey) { export function get_hotkey_deprecation_notice(
originalHotkey: string,
replacementHotkey: string,
): string {
return $t_html( return $t_html(
{ {
defaultMessage: defaultMessage:
@ -16,9 +19,9 @@ export function get_hotkey_deprecation_notice(originalHotkey, replacementHotkey)
); );
} }
let shown_deprecation_notices = []; let shown_deprecation_notices: string[] = [];
export function maybe_show_deprecation_notice(key) { export function maybe_show_deprecation_notice(key: string): void {
let message; let message;
const isCmdOrCtrl = common.has_mac_keyboard() ? "Cmd" : "Ctrl"; const isCmdOrCtrl = common.has_mac_keyboard() ? "Cmd" : "Ctrl";
switch (key) { switch (key) {
@ -56,7 +59,9 @@ export function maybe_show_deprecation_notice(key) {
html_heading: $t_html({defaultMessage: "Deprecation notice"}), html_heading: $t_html({defaultMessage: "Deprecation notice"}),
html_body: message, html_body: message,
html_submit_button: $t_html({defaultMessage: "Got it"}), html_submit_button: $t_html({defaultMessage: "Got it"}),
on_click() {}, on_click() {
return;
},
close_on_submit: true, close_on_submit: true,
focus_submit_on_open: true, focus_submit_on_open: true,
single_footer_button: true, single_footer_button: true,