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 <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2023-02-22 14:03:47 -08:00
parent be0098146c
commit c1675913a2
866 changed files with 978 additions and 993 deletions

41
web/src/reload_state.ts Normal file
View File

@@ -0,0 +1,41 @@
/*
We want his module to load pretty early in the process
of starting the app, so that people.js can load early.
All the heavy lifting for reload logic happens in
reload.js, which has lots of UI dependencies. If we
didn't split out this module, our whole dependency tree
would be kind of upside down.
*/
let reload_in_progress = false;
let reload_pending = false;
export let csrf_failed_handler: (() => void) | undefined;
export function clear_for_testing(): void {
reload_in_progress = false;
reload_pending = false;
csrf_failed_handler = undefined;
}
export function is_pending(): boolean {
return reload_pending;
}
export function is_in_progress(): boolean {
return reload_in_progress;
}
export function set_state_to_pending(): void {
// Why do we never set this back to false?
// Because the reload is gonna happen next. :)
// I was briefly confused by this, hence the comment.
reload_pending = true;
}
export function set_state_to_in_progress(): void {
reload_in_progress = true;
}
export function set_csrf_failed_handler(handler: () => void): void {
csrf_failed_handler = handler;
}