mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
js: Convert static/js/panels.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
dc95f06b62
commit
934d4e4e10
@@ -1,11 +1,9 @@
|
||||
"use strict";
|
||||
import {localstorage} from "./localstorage";
|
||||
import * as notifications from "./notifications";
|
||||
import * as unread_ui from "./unread_ui";
|
||||
import * as util from "./util";
|
||||
|
||||
const {localstorage} = require("./localstorage");
|
||||
const notifications = require("./notifications");
|
||||
const unread_ui = require("./unread_ui");
|
||||
const util = require("./util");
|
||||
|
||||
const resize_app = function () {
|
||||
export function resize_app() {
|
||||
const panels_height = $("#panels").height();
|
||||
$("body > .app").height("calc(100% - " + panels_height + "px)");
|
||||
|
||||
@@ -16,9 +14,7 @@ const resize_app = function () {
|
||||
$(".header").height() +
|
||||
Number.parseInt($(".header").css("paddingBottom"), 10);
|
||||
$("#floating_recipient_bar").css("top", frb_top + "px");
|
||||
};
|
||||
|
||||
exports.resize_app = resize_app;
|
||||
}
|
||||
|
||||
const show_step = function ($process, step) {
|
||||
$process
|
||||
@@ -51,7 +47,7 @@ function should_show_notifications(ls) {
|
||||
);
|
||||
}
|
||||
|
||||
exports.check_profile_incomplete = function () {
|
||||
export function check_profile_incomplete() {
|
||||
if (!page_params.is_admin) {
|
||||
return;
|
||||
}
|
||||
@@ -67,24 +63,24 @@ exports.check_profile_incomplete = function () {
|
||||
} else {
|
||||
$("[data-process='profile-incomplete']").hide();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
exports.initialize = function () {
|
||||
export function initialize() {
|
||||
const ls = localstorage();
|
||||
if (page_params.insecure_desktop_app) {
|
||||
exports.open($("[data-process='insecure-desktop-app']"));
|
||||
open($("[data-process='insecure-desktop-app']"));
|
||||
} else if (page_params.warn_no_email === true && page_params.is_admin) {
|
||||
// if email has not been set up and the user is the admin,
|
||||
// display a warning to tell them to set up an email server.
|
||||
exports.open($("[data-process='email-server']"));
|
||||
open($("[data-process='email-server']"));
|
||||
} else if (should_show_notifications(ls)) {
|
||||
exports.open($("[data-process='notifications']"));
|
||||
open($("[data-process='notifications']"));
|
||||
} else if (unread_ui.should_display_bankruptcy_banner()) {
|
||||
exports.open($("[data-process='bankruptcy']"));
|
||||
open($("[data-process='bankruptcy']"));
|
||||
} else {
|
||||
// TODO: This should be restructured with separate check and
|
||||
// show calls.
|
||||
exports.check_profile_incomplete();
|
||||
check_profile_incomplete();
|
||||
}
|
||||
|
||||
// Configure click handlers.
|
||||
@@ -127,12 +123,10 @@ exports.initialize = function () {
|
||||
$(this).click();
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
exports.open = function ($process) {
|
||||
export function open($process) {
|
||||
$("[data-process]").hide();
|
||||
$process.show();
|
||||
resize_app();
|
||||
};
|
||||
|
||||
window.panels = exports;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user