fix(webui): adapt chat toolbar to available width (#5760)
* fix(webui): float chat controls above the transcript * fix(webui): keep floating controls compact and flat * fix(webui): adapt toolbar placement to conversation width * refactor(webui): simplify responsive toolbar styles
This commit is contained in:
1 parent
95b2346ea5
commit
f611c880f9
6 files changed
+67
-24
No files matched your search
@@ -64,6 +64,7 @@ interface ThreadViewportProps {
|
||||
}
|
||||
|
||||
const NEAR_BOTTOM_PX = 48;
|
||||
const PROMPT_TOP_INSET_PX = 48;
|
||||
const HISTORY_PREFETCH_MIN_PX = 160;
|
||||
const HISTORY_PREFETCH_MAX_PX = 480;
|
||||
const DEFAULT_SCROLL_BUTTON_BOTTOM_PX = 192;
|
||||
@@ -83,6 +84,11 @@ interface HistoryScrollAnchor {
|
||||
|
||||
const THREAD_DISPLAY_UNIT_SELECTOR = "[data-thread-display-unit]";
|
||||
|
||||
function promptTopInset(scroller: HTMLElement): number {
|
||||
const padding = Number.parseFloat(getComputedStyle(scroller).paddingTop);
|
||||
return Number.isFinite(padding) ? padding : PROMPT_TOP_INSET_PX;
|
||||
}
|
||||
|
||||
function historyPrefetchDistance(scroller: HTMLElement): number {
|
||||
return Math.min(
|
||||
HISTORY_PREFETCH_MAX_PX,
|
||||
@@ -297,7 +303,7 @@ export const ThreadViewport = forwardRef<ThreadViewportHandle, ThreadViewportPro
|
||||
promptTop: prompt
|
||||
? Math.min(
|
||||
maxScrollTop,
|
||||
Math.max(0, promptTop(scrollEl, prompt) - 16),
|
||||
Math.max(0, promptTop(scrollEl, prompt) - promptTopInset(scrollEl)),
|
||||
)
|
||||
: null,
|
||||
};
|
||||
@@ -477,7 +483,7 @@ export const ThreadViewport = forwardRef<ThreadViewportHandle, ThreadViewportPro
|
||||
threadMotionRef.current?.navigateHistoryTo(
|
||||
Math.min(
|
||||
maxScrollTop,
|
||||
Math.max(0, promptTop(scrollEl, prompt) - 16),
|
||||
Math.max(0, promptTop(scrollEl, prompt) - promptTopInset(scrollEl)),
|
||||
),
|
||||
);
|
||||
return true;
|
||||
@@ -871,7 +877,7 @@ export const ThreadViewport = forwardRef<ThreadViewportHandle, ThreadViewportPro
|
||||
data-testid="thread-message-region"
|
||||
className={cn(
|
||||
"thread-message-viewport thread-viewport-scrollbar row-start-1 flex min-h-0 min-w-0 flex-col",
|
||||
"scroll-auto justify-start overflow-x-hidden px-3 pb-0 pt-3 sm:px-4",
|
||||
"scroll-auto justify-start overflow-x-hidden px-3 pb-0 pt-[var(--thread-prompt-inset,3rem)] sm:px-4",
|
||||
"[overflow-anchor:none] [scrollbar-width:none]",
|
||||
"[&::-webkit-scrollbar]:hidden",
|
||||
hasVerticalOverflow ? "overflow-y-auto" : "overflow-hidden",
|
||||
@@ -968,11 +974,6 @@ export const ThreadViewport = forwardRef<ThreadViewportHandle, ThreadViewportPro
|
||||
{!hasMessages ? <div ref={bottomRef} aria-hidden className="h-px" /> : null}
|
||||
</div>
|
||||
|
||||
<div
|
||||
aria-hidden
|
||||
className="pointer-events-none absolute inset-x-0 top-0 h-3 bg-gradient-to-b from-background to-transparent"
|
||||
/>
|
||||
|
||||
{hasMessages ? (
|
||||
<PromptRail
|
||||
messages={visibleMessages}
|
||||
|
||||
Reference in new issue
Block a user