Skip to content

Commit 34f8ea3

Browse files
committed
fix(web): tighten raw command tooltip
1 parent 2a5345f commit 34f8ea3

1 file changed

Lines changed: 24 additions & 16 deletions

File tree

apps/web/src/components/chat/MessagesTimeline.tsx

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import {
4848
type MessagesTimelineRow,
4949
} from "./MessagesTimeline.logic";
5050
import { TerminalContextInlineChip } from "./TerminalContextInlineChip";
51+
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
5152
import {
5253
deriveDisplayedUserMessageState,
5354
type ParsedTerminalContextEntry,
@@ -846,13 +847,11 @@ const SimpleWorkEntryRow = memo(function SimpleWorkEntryRow(props: {
846847
workEntry: TimelineWorkEntry;
847848
}) {
848849
const { workEntry } = props;
849-
const [showRawCommand, setShowRawCommand] = useState(false);
850850
const iconConfig = workToneIcon(workEntry.tone);
851851
const EntryIcon = workEntryIcon(workEntry);
852852
const heading = toolWorkEntryHeading(workEntry);
853853
const preview = workEntryPreview(workEntry);
854854
const rawCommand = workEntryRawCommand(workEntry);
855-
const visiblePreview = showRawCommand && rawCommand ? rawCommand : preview;
856855
const displayText = preview ? `${heading} - ${preview}` : heading;
857856
const hasChangedFiles = (workEntry.changedFiles?.length ?? 0) > 0;
858857
const previewIsChangedFiles = hasChangedFiles && !workEntry.command && !workEntry.detail;
@@ -878,22 +877,31 @@ const SimpleWorkEntryRow = memo(function SimpleWorkEntryRow(props: {
878877
<span className={cn("text-foreground/80", workToneClass(workEntry.tone))}>
879878
{heading}
880879
</span>
881-
{visiblePreview &&
880+
{preview &&
882881
(rawCommand ? (
883-
<span
884-
className="max-w-full cursor-default text-muted-foreground/55 transition-colors hover:text-muted-foreground/75 focus-visible:text-muted-foreground/75"
885-
onBlur={() => setShowRawCommand(false)}
886-
onFocus={() => setShowRawCommand(true)}
887-
onMouseEnter={() => setShowRawCommand(true)}
888-
onMouseLeave={() => setShowRawCommand(false)}
889-
tabIndex={0}
890-
title={showRawCommand ? (rawCommand ?? undefined) : (preview ?? undefined)}
891-
>
892-
{" "}
893-
- {visiblePreview}
894-
</span>
882+
<Tooltip>
883+
<TooltipTrigger
884+
closeDelay={0}
885+
delay={75}
886+
render={
887+
<span className="max-w-full cursor-default text-muted-foreground/55 transition-colors hover:text-muted-foreground/75 focus-visible:text-muted-foreground/75">
888+
{" "}
889+
- {preview}
890+
</span>
891+
}
892+
/>
893+
<TooltipPopup
894+
align="start"
895+
className="max-w-[min(56rem,calc(100vw-2rem))] px-0 py-0"
896+
side="top"
897+
>
898+
<div className="max-w-[min(56rem,calc(100vw-2rem))] overflow-x-auto px-1.5 py-1 font-mono text-[11px] leading-4 whitespace-nowrap">
899+
{rawCommand}
900+
</div>
901+
</TooltipPopup>
902+
</Tooltip>
895903
) : (
896-
<span className="text-muted-foreground/55"> - {visiblePreview}</span>
904+
<span className="text-muted-foreground/55"> - {preview}</span>
897905
))}
898906
</p>
899907
</div>

0 commit comments

Comments
 (0)