navbar_alerts: Move resize_app to resize.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-10-06 23:43:24 -07:00 committed by Tim Abbott
parent 7ffdeecd86
commit 95785739ac
2 changed files with 16 additions and 19 deletions

View File

@ -10,7 +10,6 @@ import render_navbar_alert_wrapper from "../templates/navbar_alerts/navbar_alert
import render_profile_incomplete_alert_content from "../templates/navbar_alerts/profile_incomplete.hbs";
import render_server_needs_upgrade_alert_content from "../templates/navbar_alerts/server_needs_upgrade.hbs";
import * as compose_ui from "./compose_ui";
import * as desktop_notifications from "./desktop_notifications";
import * as keydown_util from "./keydown_util";
import {localstorage} from "./localstorage";
@ -21,22 +20,6 @@ import * as unread_ops from "./unread_ops";
import * as unread_ui from "./unread_ui";
import * as util from "./util";
/* This is called by resize.js, and thus indirectly when we trigger
* resize events in the logic below. */
export function resize_app() {
const navbar_alerts_height = $("#navbar_alerts_wrapper").height();
document.documentElement.style.setProperty(
"--navbar-alerts-wrapper-height",
navbar_alerts_height + "px",
);
// If the compose-box is in expanded state,
// reset its height as well.
if (compose_ui.is_full_size()) {
compose_ui.set_compose_box_top(true);
}
}
const show_step = function ($process, step) {
$process
.find("[data-step]")

View File

@ -3,8 +3,8 @@ import $ from "jquery";
import * as blueslip from "./blueslip";
import * as compose_state from "./compose_state";
import * as compose_ui from "./compose_ui";
import * as message_viewport from "./message_viewport";
import * as navbar_alerts from "./navbar_alerts";
function get_bottom_whitespace_height() {
return message_viewport.height() * 0.4;
@ -144,8 +144,22 @@ export function update_recent_view_filters_height() {
$("html").css("--recent-topics-filters-height", `${recent_view_filters_height}px`);
}
function resize_navbar_alerts() {
const navbar_alerts_height = $("#navbar_alerts_wrapper").height();
document.documentElement.style.setProperty(
"--navbar-alerts-wrapper-height",
navbar_alerts_height + "px",
);
// If the compose-box is in expanded state,
// reset its height as well.
if (compose_ui.is_full_size()) {
compose_ui.set_compose_box_top(true);
}
}
export function resize_page_components() {
navbar_alerts.resize_app();
resize_navbar_alerts();
const h = resize_sidebars();
resize_bottom_whitespace(h);
}