mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 00:46:03 +00:00
refactor: Extract message_feed_loading module from message_scroll.
This new module allows us to remove dependency on `message_scroll` in `fetch_status` and hence allowing us to migrate it to TypeScript.
This commit is contained in:
41
web/src/message_feed_loading.ts
Normal file
41
web/src/message_feed_loading.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import $ from "jquery";
|
||||
|
||||
import * as loading from "./loading";
|
||||
|
||||
let loading_older_messages_indicator_showing = false;
|
||||
let loading_newer_messages_indicator_showing = false;
|
||||
|
||||
export function show_loading_older(): void {
|
||||
if (!loading_older_messages_indicator_showing) {
|
||||
loading.make_indicator($("#loading_older_messages_indicator"), {abs_positioned: true});
|
||||
loading_older_messages_indicator_showing = true;
|
||||
}
|
||||
}
|
||||
|
||||
export function hide_loading_older(): void {
|
||||
if (loading_older_messages_indicator_showing) {
|
||||
loading.destroy_indicator($("#loading_older_messages_indicator"));
|
||||
loading_older_messages_indicator_showing = false;
|
||||
}
|
||||
}
|
||||
|
||||
export function show_loading_newer(): void {
|
||||
if (!loading_newer_messages_indicator_showing) {
|
||||
$(".bottom-messages-logo").show();
|
||||
loading.make_indicator($("#loading_newer_messages_indicator"), {abs_positioned: true});
|
||||
loading_newer_messages_indicator_showing = true;
|
||||
}
|
||||
}
|
||||
|
||||
export function hide_loading_newer(): void {
|
||||
if (loading_newer_messages_indicator_showing) {
|
||||
$(".bottom-messages-logo").hide();
|
||||
loading.destroy_indicator($("#loading_newer_messages_indicator"));
|
||||
loading_newer_messages_indicator_showing = false;
|
||||
}
|
||||
}
|
||||
|
||||
export function hide_indicators(): void {
|
||||
hide_loading_older();
|
||||
hide_loading_newer();
|
||||
}
|
||||
Reference in New Issue
Block a user