fix(webui): tighten mobile chat layout and soften transcript edges

This commit is contained in:
chengyongru authored and chengyongru committed 2026-10-24 19:29:24 +08:00
1 parent ce885fa31e
commit 8af2d396ab
10 files changed
+183 -26

No files matched your search

+10 -7
View File
@@ -58,9 +58,9 @@ for (const variant of ["hero", "thread"]) for (const width of [280, 320, 390, 60
});
}
for (const variant of ["hero", "thread"]) {
test.describe(`${variant} mobile permission with usage`, () => {
test.use({ viewport: { width: 320, height: 900 }, hasTouch: true, reducedMotion: "reduce" });
for (const variant of ["hero", "thread"]) for (const width of [320, 600]) {
test.describe(`${variant} mobile permission with usage at ${width}px`, () => {
test.use({ viewport: { width, height: 900 }, hasTouch: true, reducedMotion: "reduce" });
test("keeps access on the lower right when context usage appears", async ({ page }) => {
await page.addInitScript(() => localStorage.setItem("nanobot.locale", "en"));
await page.route("**/api/commands", route => route.fulfill({ json: { commands: [] } }));
@@ -69,11 +69,14 @@ for (const variant of ["hero", "thread"]) {
const access = (await page.getByRole("button", { name: "Workspace access mode: Full Access" }).boundingBox())!;
const usage = (await page.getByTestId("composer-context-usage").boundingBox())!;
expect(Math.abs(access.y - workspace.y)).toBeLessThan(1);
expect(usage.y + usage.height).toBeLessThanOrEqual(access.y);
expect(await page.evaluate(() => document.documentElement.scrollWidth > innerWidth)).toBe(false);
await page.getByTestId("composer-context-usage").focus();
expect(Math.abs(usage.y - access.y)).toBeLessThan(1);
expect(workspace.x + workspace.width).toBeLessThanOrEqual(usage.x);
expect(usage.x + usage.width).toBeLessThanOrEqual(access.x);
expect(access.x + access.width).toBeLessThanOrEqual(width);
expect(await page.getByTestId("composer-context-usage").textContent()).toBe("50%");
await page.getByRole("button", { name: "Switch directory" }).focus();
await page.keyboard.press("Tab");
await expect(page.getByRole("button", { name: "Switch directory" })).toBeFocused();
await expect(page.getByTestId("composer-context-usage")).toBeFocused();
await page.keyboard.press("Tab");
await expect(page.getByRole("button", { name: "Workspace access mode: Full Access" })).toBeFocused();
});