mirror of
https://github.com/block/buzz.git
synced 2026-10-30 22:11:36 +00:00
fix(desktop): show full pop-out prompts
Co-authored-by: Rizz <302abe414ca6e3134763d2539bfcf145aea2a63fe5f8455204ed602fd40cf381@buzz.block.builderlab.xyz> Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
This commit is contained in:
@@ -55,7 +55,7 @@ export function CompactMessageSummary({
|
||||
const { openProfilePanel } = useProfilePanel();
|
||||
const isCompactPreview = variant === "compactPreview";
|
||||
const isDedicatedActivityWindow = isAgentActivityWindow();
|
||||
const shouldClampBubble = !isCompactPreview;
|
||||
const shouldClampBubble = !isCompactPreview && !isDedicatedActivityWindow;
|
||||
const effectiveMessageLink = isDedicatedActivityWindow ? null : messageLink;
|
||||
const [bubbleRef, hasBubbleOverflow] =
|
||||
useTranscriptBubbleOverflow(shouldClampBubble);
|
||||
|
||||
@@ -36,7 +36,7 @@ export function UserMessageBubble({
|
||||
const { openProfilePanel } = useProfilePanel();
|
||||
const isCompactPreview = variant === "compactPreview";
|
||||
const isDedicatedActivityWindow = isAgentActivityWindow();
|
||||
const shouldClampBubble = !isCompactPreview;
|
||||
const shouldClampBubble = !isCompactPreview && !isDedicatedActivityWindow;
|
||||
const [bubbleRef, hasBubbleOverflow] =
|
||||
useTranscriptBubbleOverflow(shouldClampBubble);
|
||||
const text = item.text.trim();
|
||||
|
||||
@@ -73,7 +73,10 @@ test("keeps dedicated activity windows pinned to their original channel", async
|
||||
sessionUpdate: "user_message_chunk",
|
||||
messageId: "b".repeat(64),
|
||||
authorPubkey: repositoryOwnerPubkey,
|
||||
content: { type: "text", text: "Please inspect the feed" },
|
||||
content: {
|
||||
type: "text",
|
||||
text: `${Array.from({ length: 11 }, (_, index) => `Prompt line ${index + 1}: inspect every detail in the dedicated activity feed.`).join("\n\n")}\n\nPrompt line 12: FINAL-PROMPT-LINE`,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -210,6 +213,42 @@ test("keeps dedicated activity windows pinned to their original channel", async
|
||||
"general",
|
||||
);
|
||||
const userMessage = panel.getByTestId("transcript-user-message");
|
||||
const userBubble = userMessage.locator(":scope > div > div").first();
|
||||
await expect(userBubble).toContainText("FINAL-PROMPT-LINE");
|
||||
const promptTailGeometry = await userBubble.evaluate((bubble) => {
|
||||
const walker = document.createTreeWalker(bubble, NodeFilter.SHOW_TEXT);
|
||||
let tailNode: Text | null = null;
|
||||
while (walker.nextNode()) {
|
||||
const node = walker.currentNode as Text;
|
||||
if (node.data.includes("FINAL-PROMPT-LINE")) {
|
||||
tailNode = node;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!tailNode)
|
||||
throw new Error("Final prompt line text node was not found.");
|
||||
|
||||
const tailStart = tailNode.data.indexOf("FINAL-PROMPT-LINE");
|
||||
const range = document.createRange();
|
||||
range.setStart(tailNode, tailStart);
|
||||
range.setEnd(tailNode, tailStart + "FINAL-PROMPT-LINE".length);
|
||||
const bubbleRect = bubble.getBoundingClientRect();
|
||||
const tailRect = range.getBoundingClientRect();
|
||||
return {
|
||||
bubbleBottom: bubbleRect.bottom,
|
||||
bubbleTop: bubbleRect.top,
|
||||
overflowY: getComputedStyle(bubble).overflowY,
|
||||
tailBottom: tailRect.bottom,
|
||||
tailTop: tailRect.top,
|
||||
};
|
||||
});
|
||||
expect(promptTailGeometry.overflowY).toBe("visible");
|
||||
expect(promptTailGeometry.tailTop).toBeGreaterThanOrEqual(
|
||||
promptTailGeometry.bubbleTop,
|
||||
);
|
||||
expect(promptTailGeometry.tailBottom).toBeLessThanOrEqual(
|
||||
promptTailGeometry.bubbleBottom + 1,
|
||||
);
|
||||
const userTimestamp = userMessage.locator("span[title]").last();
|
||||
await expect(userTimestamp).toBeVisible();
|
||||
await expect(userTimestamp).toHaveCSS("cursor", "default");
|
||||
|
||||
Reference in New Issue
Block a user