mirror of https://github.com/zulip/zulip.git
views_util: Convert module to typescript.
This commit is contained in:
parent
9366d42f14
commit
16bf8d3df6
|
@ -182,7 +182,6 @@ EXEMPT_FILES = make_set(
|
||||||
"web/src/realm_playground.ts",
|
"web/src/realm_playground.ts",
|
||||||
"web/src/realm_user_settings_defaults.ts",
|
"web/src/realm_user_settings_defaults.ts",
|
||||||
"web/src/recent_view_ui.js",
|
"web/src/recent_view_ui.js",
|
||||||
"web/src/recent_view_util.js",
|
|
||||||
"web/src/reload.js",
|
"web/src/reload.js",
|
||||||
"web/src/reload_setup.js",
|
"web/src/reload_setup.js",
|
||||||
"web/src/reminder.js",
|
"web/src/reminder.js",
|
||||||
|
@ -285,7 +284,7 @@ EXEMPT_FILES = make_set(
|
||||||
"web/src/user_topic_popover.js",
|
"web/src/user_topic_popover.js",
|
||||||
"web/src/user_topics.ts",
|
"web/src/user_topics.ts",
|
||||||
"web/src/user_topics_ui.js",
|
"web/src/user_topics_ui.js",
|
||||||
"web/src/views_util.js",
|
"web/src/views_util.ts",
|
||||||
"web/src/zcommand.ts",
|
"web/src/zcommand.ts",
|
||||||
"web/src/zform.js",
|
"web/src/zform.js",
|
||||||
"web/src/zulip.js",
|
"web/src/zulip.js",
|
||||||
|
|
|
@ -33,7 +33,12 @@ export const COMMON_DROPDOWN_WIDGET_PARAMS = {
|
||||||
disable_for_spectators: true,
|
disable_for_spectators: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function filters_dropdown_options(current_value) {
|
export function filters_dropdown_options(current_value: string | number | undefined): {
|
||||||
|
unique_id: string;
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
bold_current_selection: boolean;
|
||||||
|
}[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
unique_id: FILTERS.FOLLOWED_TOPICS,
|
unique_id: FILTERS.FOLLOWED_TOPICS,
|
||||||
|
@ -58,7 +63,15 @@ export function filters_dropdown_options(current_value) {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function show(opts) {
|
export function show(opts: {
|
||||||
|
highlight_view_in_left_sidebar: () => void;
|
||||||
|
$view: JQuery;
|
||||||
|
update_compose: () => void;
|
||||||
|
is_visible: () => boolean;
|
||||||
|
set_visible: (value: boolean) => void;
|
||||||
|
complete_rerender: () => void;
|
||||||
|
is_recent_view?: boolean;
|
||||||
|
}): void {
|
||||||
if (narrow_state.has_shown_message_list_view) {
|
if (narrow_state.has_shown_message_list_view) {
|
||||||
message_lists.save_pre_narrow_offset_for_reload();
|
message_lists.save_pre_narrow_offset_for_reload();
|
||||||
}
|
}
|
||||||
|
@ -99,10 +112,10 @@ export function show(opts) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hide(opts) {
|
export function hide(opts: {$view: JQuery; set_visible: (value: boolean) => void}): void {
|
||||||
const $focused_element = $(document.activeElement);
|
const active_element = document.activeElement;
|
||||||
if (opts.$view.has($focused_element)) {
|
if (active_element !== null && opts.$view.has(active_element)) {
|
||||||
$focused_element.trigger("blur");
|
$(active_element).trigger("blur");
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#message_feed_container").show();
|
$("#message_feed_container").show();
|
Loading…
Reference in New Issue