diff --git a/docs/webui.md b/docs/webui.md index 043629b07..42dcb05dc 100644 --- a/docs/webui.md +++ b/docs/webui.md @@ -463,6 +463,14 @@ link menu. For in-app actions on touch devices, open the message's existing **Message actions → View links** entry. It lists only the web links rendered in that message, not URLs inside code blocks or file references. Choose a link to copy it, open it externally, or preview it beside the current conversation. +On phone-sized screens, Copy and Message actions sit below the message, leaving +the full text width available. Message actions opens a bottom sheet; close it +with its close button, by tapping outside, or with Escape. Desktop keeps the +hover-triggered message popover. +On desktop, hovering or focusing a message also reveals a short timestamp below +its actions: a 24-hour clock for today, or month/day for every other date. Hover +or focus that label for the full local date and time, including the year. Replies +use their completion timestamp when available, otherwise their creation timestamp. There is no persistent action button beside each link and no custom long-press gesture to interfere with scrolling or text selection. Ordinary clicks still open links in a browser tab. File and session links keep diff --git a/webui/src/components/MessageBubble.tsx b/webui/src/components/MessageBubble.tsx index 5b9e5d1f5..b47c2dbcf 100644 --- a/webui/src/components/MessageBubble.tsx +++ b/webui/src/components/MessageBubble.tsx @@ -120,6 +120,34 @@ function useMessageCopy(content: string) { return { copied, label, onCopy }; } +function messageCopyContent(message: UIMessage, t: (key: string) => string) { + return message.role === "assistant" && message.compactReply === "empty" + ? t("thread.compaction.empty") + : message.role === "assistant" && message.compactReply === "failed" + ? t("thread.compaction.failed") + : message.content; +} + +/** The same copy behavior in the desktop menu and the mobile reply footer. */ +export function MessageCopyButton({ message, className }: { message: UIMessage; className?: string }) { + const { t } = useTranslation(); + const content = messageCopyContent(message, t); + const { copied, label, onCopy } = useMessageCopy(content); + if (!content.trim()) return null; + return {label}; +} + interface MessageBlockMenuActivity { label: string; expanded: boolean; @@ -133,6 +161,7 @@ interface MessageBlockMenuActionsProps { onForkFromHere?: () => void; activity?: MessageBlockMenuActivity; onViewLinks?: () => void; + sheet?: boolean; } /** Actions and metadata shown after opening a visual message block's context panel. */ @@ -142,17 +171,11 @@ export function MessageBlockMenuActions({ onForkFromHere, activity, onViewLinks, + sheet = false, }: MessageBlockMenuActionsProps) { const { t } = useTranslation(); - const content = message.role === "assistant" - ? message.compactReply === "empty" - ? t("thread.compaction.empty") - : message.compactReply === "failed" - ? t("thread.compaction.failed") - : message.content - : message.content; + const content = messageCopyContent(message, t); const hasText = content.trim().length > 0; - const { copied, label: copyLabel, onCopy } = useMessageCopy(content); const showFork = message.role === "assistant" && !message.isStreaming && !isTurnStreaming @@ -175,50 +198,16 @@ export function MessageBlockMenuActions({
- {hasText || showFork || activity ? ( + {(!sheet && hasText) || showFork || activity ? (
- {hasText || showFork ? ( + {(!sheet && hasText) || showFork ? (
- {hasText ? ( - - - - - {copyLabel} - - ) : null} + {!sheet && hasText ? : null} {showFork ? ( @@ -234,9 +223,11 @@ export function MessageBlockMenuActions({ "hover:bg-muted/70 hover:text-foreground active:scale-[0.96]", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", "motion-reduce:transform-none", + sheet && "w-full justify-start gap-2 px-2 text-sm", )} > + {sheet ? {t("message.forkFromHere")} : null} @@ -258,6 +249,7 @@ export function MessageBlockMenuActions({ "text-start text-[11px] leading-4", "text-muted-foreground transition-colors hover:text-foreground", "focus-visible:outline-none", + sheet && "w-full rounded-control text-sm hover:bg-muted/70", )} > {timestampLabel ? (