fix(web): collapsed composer reserves room for wide send actions (#17016)
This commit is contained in:
1 parent
7b57b723d3
commit
48b71f0eb3
1 file changed
+20
-11
@@ -5220,6 +5220,19 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
|
||||
useLayoutEffect(() => {
|
||||
onRestingChange(isComposerResting);
|
||||
}, [isComposerResting, onRestingChange]);
|
||||
// The resting footer floats over the prompt row, so the row reserves its
|
||||
// measured width. Wide actions like the compact-before-send chip vary too much for a fixed inset.
|
||||
const [restingActionsElement, setRestingActionsElement] = useState<HTMLDivElement | null>(null);
|
||||
const [restingActionsWidth, setRestingActionsWidth] = useState<number | null>(null);
|
||||
useLayoutEffect(() => {
|
||||
if (!isComposerResting || !restingActionsElement) return;
|
||||
const measure = () => setRestingActionsWidth(restingActionsElement.offsetWidth);
|
||||
measure();
|
||||
if (typeof ResizeObserver === "undefined") return;
|
||||
const observer = new ResizeObserver(measure);
|
||||
observer.observe(restingActionsElement);
|
||||
return () => observer.disconnect();
|
||||
}, [isComposerResting, restingActionsElement]);
|
||||
const restingImagePreviewCounts = getRestingComposerImagePreviewCounts(
|
||||
standaloneComposerImages.length,
|
||||
);
|
||||
@@ -7376,17 +7389,12 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
|
||||
)}
|
||||
|
||||
<div
|
||||
className={cn(
|
||||
"relative",
|
||||
isComposerResting && "flex min-w-0 items-center gap-1",
|
||||
isComposerResting &&
|
||||
((settings.contextWindowMeterEnabled && activeContextWindow) ||
|
||||
reserveContextWindowMeter
|
||||
? "pr-28"
|
||||
: showComposerAttachAction
|
||||
? "pr-20"
|
||||
: "pr-12"),
|
||||
)}
|
||||
className={cn("relative", isComposerResting && "flex min-w-0 items-center gap-1")}
|
||||
style={
|
||||
isComposerResting && restingActionsWidth !== null
|
||||
? { paddingRight: `calc(${restingActionsWidth}px + 1rem)` }
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{previewFile ? (
|
||||
<Dialog
|
||||
@@ -7565,6 +7573,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
|
||||
|
||||
{/* Right side: send / stop button */}
|
||||
<div
|
||||
ref={setRestingActionsElement}
|
||||
data-chat-composer-actions="right"
|
||||
data-chat-composer-transition-actions="true"
|
||||
data-chat-composer-primary-actions-compact={
|
||||
|
||||
Reference in new issue
Block a user