mirror of
https://github.com/block/buzz.git
synced 2026-11-05 00:41:28 +00:00
fix(desktop): make pop-out timestamps inert
Co-authored-by: Rizz <302abe414ca6e3134763d2539bfcf145aea2a63fe5f8455204ed602fd40cf381@buzz.block.builderlab.xyz> Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import * as React from "react";
|
||||
|
||||
import { useAppNavigation } from "@/app/navigation/useAppNavigation";
|
||||
import { buildMessageLink } from "@/features/messages/lib/messageLink";
|
||||
import { isAgentActivityWindow } from "@/features/agents/lib/agentActivityWindow";
|
||||
import { cn } from "@/shared/lib/cn";
|
||||
import {
|
||||
formatTranscriptTime,
|
||||
@@ -24,17 +25,20 @@ export function TranscriptTimestamp({
|
||||
}) {
|
||||
const formatted = formatTranscriptTime(timestamp);
|
||||
const { goChannel } = useAppNavigation();
|
||||
const href = messageLink ? buildMessageLink(messageLink) : null;
|
||||
const effectiveMessageLink = isAgentActivityWindow() ? null : messageLink;
|
||||
const href = effectiveMessageLink
|
||||
? buildMessageLink(effectiveMessageLink)
|
||||
: null;
|
||||
const openMessage = React.useCallback(
|
||||
(event: React.MouseEvent<HTMLAnchorElement>) => {
|
||||
if (!messageLink) return;
|
||||
if (!effectiveMessageLink) return;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
void goChannel(messageLink.channelId, {
|
||||
messageId: messageLink.messageId,
|
||||
void goChannel(effectiveMessageLink.channelId, {
|
||||
messageId: effectiveMessageLink.messageId,
|
||||
});
|
||||
},
|
||||
[goChannel, messageLink],
|
||||
[effectiveMessageLink, goChannel],
|
||||
);
|
||||
|
||||
if (!formatted) return null;
|
||||
|
||||
@@ -70,6 +70,7 @@ test("keeps dedicated activity windows pinned to their original channel", async
|
||||
params: {
|
||||
update: {
|
||||
sessionUpdate: "user_message_chunk",
|
||||
messageId: "b".repeat(64),
|
||||
authorPubkey: repositoryOwnerPubkey,
|
||||
content: { type: "text", text: "Please inspect the feed" },
|
||||
},
|
||||
@@ -189,9 +190,20 @@ test("keeps dedicated activity windows pinned to their original channel", async
|
||||
await expect(sentMessage.locator("[data-channel-link]")).toContainText(
|
||||
"general",
|
||||
);
|
||||
const userMessage = panel.getByTestId("transcript-user-message");
|
||||
const userTimestamp = userMessage.locator("span[title]").last();
|
||||
await expect(userTimestamp).toBeVisible();
|
||||
await expect(userTimestamp).toHaveCSS("cursor", "default");
|
||||
await expect(panel.getByTestId("transcript-open-message-link")).toHaveCount(
|
||||
0,
|
||||
);
|
||||
const openedPage = page
|
||||
.context()
|
||||
.waitForEvent("page", { timeout: 500 })
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
await userTimestamp.click({ button: "middle" });
|
||||
expect(await openedPage).toBe(false);
|
||||
await sentMessage.click();
|
||||
await expect(panel).toBeVisible();
|
||||
await expect(page.getByTestId("message-thread-panel")).toHaveCount(0);
|
||||
|
||||
Reference in New Issue
Block a user