fix(ui): the minimised chat composer docks at the bottom of the screen

This commit is contained in:
sam committed 2026-11-14 11:18:22 +11:00
1 parent 7a9f507e2d
commit 855e8ceb3b
3 files changed
+11 -12

No files matched your search

+1 -1
View File
@@ -143,7 +143,7 @@ const wrapStyle = computed<Record<string, string> | undefined>((): Record<string
if (expanded.value) {
return { left: `${rect.x}px`, top: `${rect.y}px`, width: `${rect.w}px`, height: `${rect.h}px` };
}
const bar = barPlacement(rect, mode.value, vw.value, vh.value);
const bar = barPlacement(rect, mode.value, vw.value);
return { left: `${bar.x}px`, bottom: `${bar.bottom}px`, width: `${bar.w}px` };
});
+5 -5
View File
@@ -115,14 +115,14 @@ export function snapEdge(pointerX: number, vw: number, edge = EDGE): "left" | "r
}
/**
* Where the minimised bar sits: at the bottom edge of the window's rectangle,
* on the side the mode pins to. Returned as a bottom offset so the bar's own
* height never has to be known here.
* Where the minimised bar sits: docked at the bottom of the screen, under the
* window's horizontal position or on the side the mode pins to. Returned as a
* bottom offset so the bar's own height never has to be known here.
*/
export function barPlacement(rect: Rect, mode: DockMode, vw: number, vh: number): { x: number; bottom: number; w: number } {
export function barPlacement(rect: Rect, mode: DockMode, vw: number): { x: number; bottom: number; w: number } {
const w = rect.w;
const x = mode === "left" ? 0 : mode === "right" ? Math.max(0, vw - w) : rect.x;
return { x, bottom: clamp(vh - (rect.y + rect.h), INSET, Math.max(INSET, vh - INSET)), w };
return { x, bottom: INSET, w };
}
/** Pointer travel down on the header that hides the conversation on a phone. */
+5 -6
View File
@@ -130,13 +130,12 @@ test("a pointer near a side edge offers that pinned split, otherwise none", () =
}
});
test("the minimised bar sits at the bottom of the window's rectangle on the pinned side", () => {
// Guards the minimised composer floating mid-page under where the window was.
test("the minimised bar docks at the bottom of the screen on the pinned side", () => {
const rect = { x: 300, y: 100, w: 440, h: 560 };
assert.deepEqual(barPlacement(rect, "float", VW, VH), { x: 300, bottom: 800 - 660, w: 440 });
assert.deepEqual(barPlacement(rect, "left", VW, VH), { x: 0, bottom: 800 - 660, w: 440 });
assert.deepEqual(barPlacement(rect, "right", VW, VH), { x: 1280 - 440, bottom: 800 - 660, w: 440 });
// A window dragged to the bottom keeps the bar fully on screen.
assert.deepEqual(barPlacement({ x: 10, y: 700, w: 440, h: 560 }, "float", VW, VH), { x: 10, bottom: 8, w: 440 });
assert.deepEqual(barPlacement(rect, "float", VW), { x: 300, bottom: 8, w: 440 });
assert.deepEqual(barPlacement(rect, "left", VW), { x: 0, bottom: 8, w: 440 });
assert.deepEqual(barPlacement(rect, "right", VW), { x: 1280 - 440, bottom: 8, w: 440 });
});
test("the old edge-pin preference migrates into the new key and is removed", () => {