Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions apps/web/src/components/chat/ChatComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
const restingImagePreviewCounts = getRestingComposerImagePreviewCounts(
standaloneComposerImages.length,
);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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={
Expand Down
Loading