Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

web-ui: center the conversation loading spinner in the pane (#444)

Regan Bellc5fcd96dcc4f
diff --git a/plugins/web-ui/src/shell.css b/plugins/web-ui/src/shell.css
index 71695fce9..f6e600c5e 100644
--- a/plugins/web-ui/src/shell.css
+++ b/plugins/web-ui/src/shell.css
@@ -2799,6 +2799,7 @@ a.chat-row-open {
}
.chat-loading {
flex: 1;
+ grid-row: 1 / -1;
display: flex;
align-items: center;
justify-content: center;
diff --git a/plugins/web-ui/test/loading-pane-centered.test.ts b/plugins/web-ui/test/loading-pane-centered.test.ts
new file mode 100644
index 000000000..5da98ef25
--- /dev/null
+++ b/plugins/web-ui/test/loading-pane-centered.test.ts
@@ -0,0 +1,21 @@
+import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
+import test from "node:test";
+
+const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");
+const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
+
+test("the loading pane renders chat-loading as the shell's only child", () => {
+ const fn = chat.match(/function mountLoadingPane\(\): void \{[\s\S]*?\n {2}\}/)?.[0] ?? "";
+ assert.match(fn, /custom-chat-shell/);
+ assert.match(fn, /chat-loading/);
+});
+
+test("chat-loading spans every shell grid row so the spinner centers vertically", () => {
+ const shell = css.match(/\.custom-chat-shell \{[^}]*\}/)?.[0] ?? "";
+ assert.match(shell, /display: grid;/, "the shell is a grid, so a lone child needs an explicit row span");
+ const block = css.match(/\.chat-loading \{[^}]*\}/)?.[0] ?? "";
+ assert.match(block, /grid-row: 1 \/ -1;/, "without spanning all rows the spinner hugs the top auto row");
+ assert.match(block, /align-items: center;/);
+ assert.match(block, /justify-content: center;/);
+});