mirror of
https://github.com/zulip/zulip.git
synced 2025-11-22 15:31:20 +00:00
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:
70
web/src/color_data.ts
Normal file
70
web/src/color_data.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
import _ from "lodash";
|
||||
|
||||
export let unused_colors: string[];
|
||||
|
||||
// These colors are used now for streams.
|
||||
const stream_colors = [
|
||||
"#76ce90",
|
||||
"#fae589",
|
||||
"#a6c7e5",
|
||||
"#e79ab5",
|
||||
"#bfd56f",
|
||||
"#f4ae55",
|
||||
"#b0a5fd",
|
||||
"#addfe5",
|
||||
"#f5ce6e",
|
||||
"#c2726a",
|
||||
"#94c849",
|
||||
"#bd86e5",
|
||||
"#ee7e4a",
|
||||
"#a6dcbf",
|
||||
"#95a5fd",
|
||||
"#53a063",
|
||||
"#9987e1",
|
||||
"#e4523d",
|
||||
"#c2c2c2",
|
||||
"#4f8de4",
|
||||
"#c6a8ad",
|
||||
"#e7cc4d",
|
||||
"#c8bebf",
|
||||
"#a47462",
|
||||
];
|
||||
|
||||
// Shuffle our colors on page load to prevent
|
||||
// bias toward "early" colors.
|
||||
export const colors = _.shuffle(stream_colors);
|
||||
|
||||
export function reset(): void {
|
||||
unused_colors = colors.slice();
|
||||
}
|
||||
|
||||
reset();
|
||||
|
||||
export function claim_color(color: string): void {
|
||||
const i = unused_colors.indexOf(color);
|
||||
|
||||
if (i < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
unused_colors.splice(i, 1);
|
||||
|
||||
if (unused_colors.length === 0) {
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
export function claim_colors(subs: {color: string}[]): void {
|
||||
const colors = new Set(subs.map((sub) => sub.color));
|
||||
for (const color of colors) {
|
||||
claim_color(color);
|
||||
}
|
||||
}
|
||||
|
||||
export function pick_color(): string {
|
||||
const color = unused_colors[0];
|
||||
|
||||
claim_color(color);
|
||||
|
||||
return color;
|
||||
}
|
||||
Reference in New Issue
Block a user