Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
hello: Fix client logos not changing on hello page.
Aman Agrawalcbb09f4ee637
diff --git a/web/src/portico/hello.js b/web/src/portico/hello.jsnew file mode 100644index 00000000000..ac64d3211df--- /dev/null+++ b/web/src/portico/hello.js@@ -0,0 +1,54 @@+// Mark this as a module for ESLint and Webpack.+export {};++function get_new_rand(oldRand, max) {+ const newRand = Math.floor(Math.random() * max);+ return newRand === oldRand ? get_new_rand(newRand, max) : newRand;+}++function get_random_item_from_array(array) {+ return array[Math.floor(Math.random() * array.length)];+}++const current_clint_logo_class_names = new Set([+ "client-logos__logo_akamai",+ "client-logos__logo_tum",+ "client-logos__logo_wikimedia",+ "client-logos__logo_rust",+ "client-logos__logo_dr_on_demand",+ "client-logos__logo_maria",+]);+const future_logo_class_names = new Set([+ "client-logos__logo_pilot",+ "client-logos__logo_recurse",+ "client-logos__logo_level_up",++ "client-logos__logo_layershift",+ "client-logos__logo_julia",+ "client-logos__logo_ucsd",+ "client-logos__logo_lean",+ "client-logos__logo_asciidoc",+]);+let current_clint_logo_class_namesIndex = 0;+function update_client_logo() {+ if (document.hidden) {+ return;+ }+ const logos = [...document.querySelectorAll("[class^='client-logos__']")];+ current_clint_logo_class_namesIndex = get_new_rand(+ current_clint_logo_class_namesIndex,+ logos.length,+ );+ const el = logos[current_clint_logo_class_namesIndex];++ const oldClass = el.className;+ el.className = "";+ current_clint_logo_class_names.delete(oldClass);+ const newClass = get_random_item_from_array([...future_logo_class_names.values()]);+ future_logo_class_names.delete(newClass);+ el.className = newClass;+ current_clint_logo_class_names.add(newClass);+ future_logo_class_names.add(oldClass);+}++setInterval(update_client_logo, 2500);diff --git a/web/src/portico/landing-page.js b/web/src/portico/landing-page.jsindex ff6d3d7eaf2..6f7577ec8d4 100644--- a/web/src/portico/landing-page.js+++ b/web/src/portico/landing-page.js@@ -14,59 +14,6 @@ export function path_parts() {return window.location.pathname.split("/").filter((chunk) => chunk !== "");}-const hello_events = function () {- function get_new_rand(oldRand, max) {- const newRand = Math.floor(Math.random() * max);- return newRand === oldRand ? get_new_rand(newRand, max) : newRand;- }-- function get_random_item_from_array(array) {- return array[Math.floor(Math.random() * array.length)];- }-- const current_clint_logo_class_names = new Set([- "client-logos__logo_akamai",- "client-logos__logo_tum",- "client-logos__logo_wikimedia",- "client-logos__logo_rust",- "client-logos__logo_dr_on_demand",- "client-logos__logo_maria",- ]);- const future_logo_class_names = new Set([- "client-logos__logo_pilot",- "client-logos__logo_recurse",- "client-logos__logo_level_up",-- "client-logos__logo_layershift",- "client-logos__logo_julia",- "client-logos__logo_ucsd",- "client-logos__logo_lean",- "client-logos__logo_asciidoc",- ]);- let current_clint_logo_class_namesIndex = 0;- function update_client_logo() {- if (document.hidden) {- return;- }- const logos = [...document.querySelectorAll("[class^='client-logos__']")];- current_clint_logo_class_namesIndex = get_new_rand(- current_clint_logo_class_namesIndex,- logos.length,- );- const el = logos[current_clint_logo_class_namesIndex];-- const oldClass = el.className;- el.className = "";- current_clint_logo_class_names.delete(oldClass);- const newClass = get_random_item_from_array([...future_logo_class_names.values()]);- future_logo_class_names.delete(newClass);- el.className = newClass;- current_clint_logo_class_names.add(newClass);- future_logo_class_names.add(oldClass);- }- setInterval(update_client_logo, 2500);-};-const apps_events = function () {const info = {windows: {@@ -177,10 +124,6 @@ const events = function () {if (path_parts().includes("apps")) {apps_events();}-- if (path_parts().includes("hello")) {- hello_events();- }};$(() => {diff --git a/web/webpack.assets.json b/web/webpack.assets.jsonindex 28719c7090f..9480ce4d993 100644--- a/web/webpack.assets.json+++ b/web/webpack.assets.json@@ -53,6 +53,7 @@],"landing-page-hello": ["./src/bundles/hello",+ "./src/portico/hello","./src/portico/landing-page","./src/portico/header","./styles/portico/svg_icons.css",