fix(webui): make chat a FAB-opened panel and stop the topbar clipping
Four P0 defects from the frontend audit, plus the one-line theme fix that was
making every one of them look worse.
Chat is a floating launcher and the panel it opens, not a route
(archie-core-yuvg, archie-core-hesx). /chat rendered an empty page with a
drawer over it, and that drawer hosted the full-page chat workspace: a page
title, a conversations column, a four-control action row and a command-help
column, all inside 440px. Measured at 1440x900, .chat-workspace was 174px wide
holding 270px of content and the composer ran off the viewport.
- The Chat nav entry, the /chat route and the topbar chat icon are gone;
the launcher is the single way in.
- The panel anchors to the launcher and opens leftward from it, sharing its
bottom edge, so the button never moves. No scrim and no scroll lock: the
page stays readable and clickable, which is the point of asking Archie
about the page you are on.
- Conversations became a switcher in a compact bar; personality, provider
and model moved into a disclosure beside it; the empty state and composer
dropped to panel type scale.
- The launcher renders outside .shell because .shell's backdrop-filter is a
containing block for fixed positioning, which otherwise pinned the button
to the scrolling shell instead of the viewport.
- Update-check, Dangerous actions and Reload Telegram left the panel; their
api.* calls are untouched for the rehome to Configuration
(archie-core-tf20).
The topbar no longer clips its utility cluster (archie-core-mkb3). brand, nav
and topbar-end were all flex:none with no wrap above 1220px, and .app sets
overflow:hidden, so between 1221px and ~1582px the avatar, theme toggle and
documentation button were cut off with no way to reach them. The nav is now
the one region allowed to shrink, the search collapses to its icon below
1500px, and the nav wraps to its own row below 1270px where it stops fitting.
Live activity clamps its detail column (archie-core-qo7f). An agent_finish
payload rendered raw turned one row into six viewports and the dashboard into
7,481px. The cell shows the first meaningful line; the full text stays on the
title.
color-scheme is bound to the active theme (archie-core-nm0y), so scrollbars
and native controls stop rendering light inside the dark UI.
This commit is contained in:
1 parent
5baeadd85e
commit
1422dc5955
15 files changed
+729
-465
No files matched your search
@@ -0,0 +1,43 @@
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { activityDetail } from "../src/dashboard/activity-detail.js";
|
||||
|
||||
// Live activity renders whatever the daemon put in an event's detail. An
|
||||
// agent_finish payload is a few thousand characters of transcript, and printed
|
||||
// raw it turned one table row into six viewports (archie-core-qo7f). The cell
|
||||
// shows a single scannable line; the full text stays reachable, never silently
|
||||
// dropped.
|
||||
|
||||
test("a short detail is shown as-is and needs no expansion", () => {
|
||||
assert.deepEqual(activityDetail({ detail: "session-memory" }), {
|
||||
text: "session-memory",
|
||||
full: "session-memory",
|
||||
truncated: false,
|
||||
});
|
||||
});
|
||||
|
||||
test("a long detail is cut to one line and keeps the full text", () => {
|
||||
const long = "x".repeat(5000);
|
||||
const result = activityDetail({ detail: long });
|
||||
assert.equal(result.truncated, true);
|
||||
assert.ok(result.text.length < 200, `cell text is still ${result.text.length} chars`);
|
||||
assert.equal(result.full, long, "full payload was dropped rather than kept");
|
||||
});
|
||||
|
||||
test("a multi-line detail collapses to its first meaningful line", () => {
|
||||
const result = activityDetail({
|
||||
detail: "stage fix: agent parked (gate_parked):\n[golangci-lint] run ./...\nlevel=warning msg=deprecated",
|
||||
});
|
||||
assert.equal(result.text, "stage fix: agent parked (gate_parked):");
|
||||
assert.equal(result.truncated, true);
|
||||
});
|
||||
|
||||
test("leading blank lines do not produce an empty cell", () => {
|
||||
assert.equal(activityDetail({ detail: "\n\n real content\nmore" }).text, "real content");
|
||||
});
|
||||
|
||||
test("message is used when detail is absent, and absence is not an error", () => {
|
||||
assert.equal(activityDetail({ message: "fallback" }).text, "fallback");
|
||||
assert.deepEqual(activityDetail({}), { text: "", full: "", truncated: false });
|
||||
assert.deepEqual(activityDetail(undefined), { text: "", full: "", truncated: false });
|
||||
});
|
||||
+53
-11
@@ -1,25 +1,67 @@
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { render, cleanup } from "@testing-library/preact";
|
||||
import { render } from "@testing-library/preact";
|
||||
import { ChatApp } from "../src/chat/chat.jsx";
|
||||
|
||||
test("ChatApp renders structure with topbar, sidebar, transcript and composer", () => {
|
||||
// ChatApp lives in a ~440px panel hung off the launcher, never on a page of its
|
||||
// own. These tests hold that shape: one column, no page furniture, and the
|
||||
// controls that are not conversation kept out of the reading area
|
||||
// (archie-core-hesx).
|
||||
|
||||
test("the panel is a single column: no page title, no persistent sidebar", () => {
|
||||
const { container, unmount } = render(<ChatApp />);
|
||||
|
||||
assert.equal(container.querySelector(".chat-topbar"), null, "page topbar should be gone");
|
||||
assert.equal(container.querySelector(".chat-kicker"), null, "ARCHIE WORKSPACE kicker should be gone");
|
||||
assert.equal(container.querySelector(".page-title"), null, "the panel header already names Archie");
|
||||
assert.equal(container.querySelector(".chat-sidebar"), null, "conversations should not hold a column");
|
||||
unmount();
|
||||
});
|
||||
|
||||
test("the transcript and composer are the panel's own rows", () => {
|
||||
const { container, unmount } = render(<ChatApp />);
|
||||
|
||||
assert.ok(container.querySelector(".chat-topbar"), "topbar should render");
|
||||
assert.ok(container.querySelector(".chat-sidebar"), "sidebar should render");
|
||||
assert.ok(container.querySelector(".chat-transcript"), "transcript should render");
|
||||
assert.ok(container.querySelector(".chat-composer"), "composer textarea should render");
|
||||
assert.ok(container.querySelector(".chat-sidebar button"), "+ New chat button should exist");
|
||||
assert.ok(container.querySelector(".chat-composer"), "composer should render");
|
||||
unmount();
|
||||
});
|
||||
|
||||
test("ChatApp renders empty state with prompt chips when messages are empty", () => {
|
||||
test("conversations are a switcher in the bar, not a column", () => {
|
||||
const { container, unmount } = render(<ChatApp />);
|
||||
|
||||
const emptyState = container.querySelector(".chat-empty-state");
|
||||
assert.ok(emptyState, "empty state should be present");
|
||||
const prompts = container.querySelectorAll(".chat-prompt");
|
||||
assert.ok(prompts.length >= 3, "should have prompt buttons");
|
||||
const bar = container.querySelector(".chat-bar");
|
||||
assert.ok(bar, "compact bar should render");
|
||||
assert.ok(bar.querySelector(".chat-session-switch"), "session switcher should live in the bar");
|
||||
assert.ok(bar.querySelector(".chat-new"), "new chat should live in the bar");
|
||||
unmount();
|
||||
});
|
||||
|
||||
test("model controls are behind one settings affordance, not laid out inline", () => {
|
||||
const { container, unmount } = render(<ChatApp />);
|
||||
|
||||
const settings = container.querySelector(".chat-settings");
|
||||
assert.ok(settings, "settings popover should render");
|
||||
assert.ok(settings.querySelector('[aria-label="Personality"]'), "personality lives in the popover");
|
||||
assert.ok(settings.querySelector('[aria-label="Model"]'), "model lives in the popover");
|
||||
|
||||
// Closed by default: a 440px panel cannot spend its width on three selects.
|
||||
assert.equal(settings.tagName, "DETAILS");
|
||||
assert.equal(settings.hasAttribute("open"), false);
|
||||
unmount();
|
||||
});
|
||||
|
||||
test("operator panels are not rendered in the chat panel", () => {
|
||||
const { container, unmount } = render(<ChatApp />);
|
||||
|
||||
assert.equal(container.querySelector(".chat-update-panel"), null, "update panel belongs to Configuration");
|
||||
assert.equal(container.querySelector(".chat-dangerous-panel"), null, "dangerous actions belong to Configuration");
|
||||
unmount();
|
||||
});
|
||||
|
||||
test("the empty state still offers its prompts", () => {
|
||||
const { container, unmount } = render(<ChatApp />);
|
||||
|
||||
assert.ok(container.querySelector(".chat-empty-state"), "empty state should be present");
|
||||
assert.ok(container.querySelectorAll(".chat-prompt").length >= 3, "should have prompt buttons");
|
||||
unmount();
|
||||
});
|
||||
@@ -0,0 +1,89 @@
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { waitFor } from "@testing-library/preact";
|
||||
|
||||
// The chat is a FAB-opened panel, not a route. These tests hold that shape:
|
||||
// there is exactly one way in (the floating button), the panel anchors beside
|
||||
// it rather than filling the right edge, and `#/chat` is not a destination.
|
||||
//
|
||||
// main.jsx starts on import and cannot be imported twice, so this file drives
|
||||
// the same live app the routing test does.
|
||||
globalThis.fetch = async () => {
|
||||
throw new Error("no daemon in this test");
|
||||
};
|
||||
|
||||
class InertEventSource {
|
||||
close() {}
|
||||
}
|
||||
globalThis.EventSource = InertEventSource;
|
||||
|
||||
const fab = () => document.querySelector(".chat-fab");
|
||||
const drawer = () => document.querySelector(".chat-drawer");
|
||||
|
||||
async function settle() {
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
}
|
||||
|
||||
test("chat is reachable only from the floating button", async (t) => {
|
||||
document.body.innerHTML = '<div id="app"></div>';
|
||||
location.hash = "#/";
|
||||
await import("../src/main.jsx");
|
||||
await waitFor(() => assert.ok(document.querySelector(".topbar")));
|
||||
|
||||
await t.test("the nav has no Chat entry", () => {
|
||||
const labels = [...document.querySelectorAll("a.nav-item .nav-label")].map((el) => el.textContent);
|
||||
assert.ok(!labels.includes("Chat"), `nav still offers Chat: ${labels.join(", ")}`);
|
||||
assert.equal(document.querySelector('a.nav-item[href="#/chat"]'), null);
|
||||
});
|
||||
|
||||
await t.test("the topbar has no chat icon button", () => {
|
||||
assert.equal(document.querySelector(".topbar .icon-btn-chat"), null);
|
||||
});
|
||||
|
||||
await t.test("the floating button is present and announces its state", () => {
|
||||
assert.ok(fab(), "no .chat-fab rendered");
|
||||
assert.equal(fab().getAttribute("aria-expanded"), "false");
|
||||
assert.ok(fab().getAttribute("aria-controls"), "FAB does not point at the panel it opens");
|
||||
});
|
||||
});
|
||||
|
||||
test("the floating button opens and closes the panel", async () => {
|
||||
assert.ok(fab(), "no .chat-fab rendered");
|
||||
assert.ok(!drawer().classList.contains("is-open"));
|
||||
|
||||
fab().click();
|
||||
await waitFor(() => assert.ok(drawer().classList.contains("is-open")));
|
||||
assert.equal(fab().getAttribute("aria-expanded"), "true");
|
||||
|
||||
// The panel it controls is the one that actually opened.
|
||||
assert.equal(document.getElementById(fab().getAttribute("aria-controls")), drawer());
|
||||
|
||||
fab().click();
|
||||
await waitFor(() => assert.ok(!drawer().classList.contains("is-open")));
|
||||
assert.equal(fab().getAttribute("aria-expanded"), "false");
|
||||
});
|
||||
|
||||
test("Escape closes the panel and returns focus to the button", async () => {
|
||||
fab().click();
|
||||
await waitFor(() => assert.ok(drawer().classList.contains("is-open")));
|
||||
|
||||
// The class lands with the render, but the effect that binds Escape runs
|
||||
// after paint. Pressing the key on each retry means the test waits for the
|
||||
// binding rather than for a guessed number of milliseconds.
|
||||
await waitFor(() => {
|
||||
document.dispatchEvent(new window.KeyboardEvent("keydown", { key: "Escape", bubbles: true }));
|
||||
assert.ok(!drawer().classList.contains("is-open"));
|
||||
});
|
||||
assert.equal(document.activeElement, fab(), "focus was not returned to the launcher");
|
||||
});
|
||||
|
||||
test("#/chat is not a route and does not blank the page", async () => {
|
||||
location.hash = "#/chat";
|
||||
await settle();
|
||||
await waitFor(() => {
|
||||
const main = document.querySelector(".main");
|
||||
assert.ok(main && main.textContent.trim().length > 0, "#/chat rendered an empty page");
|
||||
});
|
||||
// It resolves to the dashboard rather than to a chat page.
|
||||
assert.equal(document.querySelector('a.nav-item[href="#/"]')?.getAttribute("aria-current"), "page");
|
||||
});
|
||||
Reference in new issue
Block a user