mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-04 08:28:36 +00:00
fix: reduce mobile gap above composer
This commit is contained in:
parent
4232e8547d
commit
f31a9c4cb0
@ -442,7 +442,10 @@ export const ThreadViewport = forwardRef<ThreadViewportHandle, ThreadViewportPro
|
|||||||
>
|
>
|
||||||
{hasMessages ? (
|
{hasMessages ? (
|
||||||
<div ref={contentRef} className="mx-auto flex min-h-full w-full max-w-[64rem] flex-col">
|
<div ref={contentRef} className="mx-auto flex min-h-full w-full max-w-[64rem] flex-col">
|
||||||
<div className="flex-1 px-3 pb-[calc(5rem+env(safe-area-inset-bottom))] pt-4 sm:px-4">
|
<div
|
||||||
|
data-testid="thread-message-region"
|
||||||
|
className="flex min-h-0 flex-1 flex-col justify-end px-3 pb-4 pt-4 sm:px-4"
|
||||||
|
>
|
||||||
<div className="mx-auto w-full max-w-[49.5rem]">
|
<div className="mx-auto w-full max-w-[49.5rem]">
|
||||||
<ThreadMessages
|
<ThreadMessages
|
||||||
messages={visibleMessages}
|
messages={visibleMessages}
|
||||||
|
|||||||
@ -110,6 +110,21 @@ function ViewportWithPromptNavigator({ messages }: { messages: UIMessage[] }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe("ThreadViewport", () => {
|
describe("ThreadViewport", () => {
|
||||||
|
it("bottom-aligns short history near the composer", () => {
|
||||||
|
render(
|
||||||
|
<ThreadViewport
|
||||||
|
messages={messages}
|
||||||
|
isStreaming={false}
|
||||||
|
composer={<div>composer</div>}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
|
||||||
|
const messageRegion = screen.getByTestId("thread-message-region");
|
||||||
|
expect(messageRegion).toHaveClass("justify-end");
|
||||||
|
expect(messageRegion).toHaveClass("pb-4");
|
||||||
|
expect(messageRegion.className).not.toContain("5rem");
|
||||||
|
});
|
||||||
|
|
||||||
it("keeps the scroll-to-bottom button above a growing composer", () => {
|
it("keeps the scroll-to-bottom button above a growing composer", () => {
|
||||||
const originalResizeObserver = globalThis.ResizeObserver;
|
const originalResizeObserver = globalThis.ResizeObserver;
|
||||||
const resizeObservers: ResizeObserverInstance[] = [];
|
const resizeObservers: ResizeObserverInstance[] = [];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user