zulip/web/src/topic_zoom.js
Anders Kaseorg c1675913a2 web: Move web app to ‘web’ directory.
Ever since we started bundling the app with webpack, there’s been less
and less overlap between our ‘static’ directory (files belonging to
the frontend app) and Django’s interpretation of the ‘static’
directory (files served directly to the web).

Split the app out to its own ‘web’ directory outside of ‘static’, and
remove all the custom collectstatic --ignore rules.  This makes it
much clearer what’s actually being served to the web, and what’s being
bundled by webpack.  It also shrinks the release tarball by 3%.

Signed-off-by: Anders Kaseorg <[email protected]>
2023-02-23 16:04:17 -08:00

70 lines
1.4 KiB
JavaScript

import $ from "jquery";
import * as popovers from "./popovers";
import * as stream_list from "./stream_list";
import * as topic_list from "./topic_list";
let zoomed_in = false;
export function is_zoomed_in() {
return zoomed_in;
}
function zoom_in() {
const stream_id = topic_list.active_stream_id();
popovers.hide_all_except_sidebars();
topic_list.zoom_in();
stream_list.zoom_in_topics({
stream_id,
});
zoomed_in = true;
}
export function zoom_out() {
const $stream_li = topic_list.get_stream_li();
popovers.hide_all_except_sidebars();
topic_list.zoom_out();
stream_list.zoom_out_topics();
if ($stream_li) {
stream_list.scroll_stream_into_view($stream_li);
}
zoomed_in = false;
}
export function clear_topics() {
const $stream_li = topic_list.get_stream_li();
topic_list.close();
if (zoomed_in) {
stream_list.zoom_out_topics();
if ($stream_li) {
stream_list.scroll_stream_into_view($stream_li);
}
}
zoomed_in = false;
}
export function initialize() {
$("#stream_filters").on("click", ".show-more-topics", (e) => {
zoom_in();
e.preventDefault();
e.stopPropagation();
});
$(".show-all-streams").on("click", (e) => {
zoom_out();
e.preventDefault();
e.stopPropagation();
});
}