fix: keep the welcome composer at the bottom

This commit is contained in:
鲨鱼辣椒 committed 2026-09-29 15:50:43 +08:00
1 parent f8a7880da3
commit e812371973
8 files changed
+46 -18

No files matched your search

+6 -5
View File
@@ -7,14 +7,15 @@ export function CodingChatBody({ welcome, hidden, bubble, children }: {
const ref = useRef<HTMLDivElement>(null);
useLayoutEffect(() => {
const body = ref.current;
if (!body || !welcome || hidden || !bubble) return;
const content = body?.querySelector<HTMLElement>('.classroom-chat-view');
if (!body || !content || !welcome || hidden || !bubble) return;
const update = () => {
const area = body.getBoundingClientRect();
const area = content.getBoundingClientRect();
const message = bubble.getBoundingClientRect();
const overlaps = message.height > 0 && message.right > area.left && message.left < area.right && message.bottom > area.top;
// Wide workspaces put the welcome beside the teachers. Compact ones flow below them.
body.style.paddingRight = overlaps && area.width >= 1050 ? `${Math.ceil(area.right - message.left + 24)}px` : '';
body.style.paddingTop = overlaps && area.width < 1050 ? `${Math.ceil(message.bottom - area.top + 24)}px` : '';
content.style.paddingRight = overlaps && area.width >= 1050 ? `${Math.ceil(area.right - message.left + 24)}px` : '';
content.style.paddingTop = overlaps && area.width < 1050 ? `${Math.ceil(message.bottom - area.top + 24)}px` : '';
};
update();
const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(update);
@@ -22,7 +23,7 @@ export function CodingChatBody({ welcome, hidden, bubble, children }: {
window.addEventListener('resize', update);
return () => {
observer?.disconnect(); window.removeEventListener('resize', update);
body.style.paddingRight = ''; body.style.paddingTop = '';
content.style.paddingRight = ''; content.style.paddingTop = '';
};
}, [welcome, hidden, bubble]);
return <div ref={ref} className="coding-chat-body" data-welcome={welcome} hidden={hidden}>{children}</div>;
+1 -2
View File
@@ -835,7 +835,7 @@ export function CodingChatPanel({
</div>
)}
{showWelcome ? <CodingStartHeading /> : targetConversationId
{showWelcome ? <><CodingStartHeading /><CommunityInvitation /></> : targetConversationId
? (
<CodingConversationTimeline
key={targetConversationId}
@@ -965,7 +965,6 @@ export function CodingChatPanel({
}}
/>}
</div>
{showWelcome && <CommunityInvitation />}
</CodingChatBody>
</div>