Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions apps/web/src/components/sidebar/SidebarThreadRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ import { getTriggerDisplayModelName } from "../chat/providerIconUtils";
import { shouldShowInstanceBadge, type ProviderInstanceEntry } from "../../providerInstances";
import { useThreadRunningTerminalIds } from "../../state/terminalSessions";
import { InlineButton } from "../ui/button";
import { Kbd } from "../ui/kbd";
import { Menu, MenuItem, MenuPopup, MenuSeparator, MenuShortcut, MenuTrigger } from "../ui/menu";
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
import { MiddleTruncate } from "../ui/middle-truncate";
Expand Down Expand Up @@ -150,15 +151,15 @@ function threadTimeTimestamp(thread: SidebarThreadSummary): string {

function JumpHintBadge(props: { label: string }) {
return (
<span
aria-hidden
className="pointer-events-none absolute right-1.5 top-1/2 z-10 inline-flex h-5 -translate-y-1/2 items-center rounded-full border border-border/80 bg-background/95 px-1.5 font-mono text-3xs font-medium tracking-tight text-foreground shadow-sm"
>
<Kbd aria-hidden data-jump-hint>
{props.label}
</span>
</Kbd>
);
}

const JUMP_HINT_SLOT_CLASS_NAME =
"[&>:not([data-jump-hint])]:invisible [&>:not([data-jump-hint])]:absolute";

function WorkingDuration(props: { startedAt: string | null }) {
const startedMs = props.startedAt !== null ? Date.parse(props.startedAt) : Number.NaN;
if (Number.isNaN(startedMs)) return null;
Expand Down Expand Up @@ -931,6 +932,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
// Closing here, not just masking, keeps the menu from reopening when the button returns.
if (snoozeMenuOpenRaw && !showSnoozeButton) setSnoozeMenuOpen(false);
const snoozeMenuOpen = snoozeMenuOpenRaw && showSnoozeButton;
const jumpHintLabel = snoozeMenuOpen ? null : props.jumpLabel;
const handlePrClick = (event: ReactMouseEvent<HTMLElement>, targetUrl?: string) => {
const url = targetUrl ?? pr?.url ?? currentLinkedPr?.url;
if (!url) return;
Expand Down Expand Up @@ -1262,6 +1264,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
className={cn(
"relative ml-auto flex h-6 min-w-8 shrink-0 items-center justify-end",
props.sweepAction !== null && "hidden",
jumpHintLabel && JUMP_HINT_SLOT_CLASS_NAME,
)}
>
<span
Expand Down Expand Up @@ -1372,12 +1375,12 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
<TooltipPopup side="top">Settle thread</TooltipPopup>
</Tooltip>
)}
{jumpHintLabel ? <JumpHintBadge label={jumpHintLabel} /> : null}
</span>
)}
{props.sweepAction !== null ? dragDestination : null}
</div>
{multiline ? metaLine : null}
{props.jumpLabel ? <JumpHintBadge label={props.jumpLabel} /> : null}
</TooltipTrigger>
{detailsTooltip}
</Tooltip>
Expand Down Expand Up @@ -1448,6 +1451,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
className={cn(
"group/sidebar-status-slot relative ml-auto flex h-5 min-w-8 shrink-0 items-stretch justify-end text-xs",
props.sweepAction !== null && "hidden",
jumpHintLabel && JUMP_HINT_SLOT_CLASS_NAME,
)}
>
<span
Expand Down Expand Up @@ -1563,6 +1567,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
) : null}
</span>
) : null}
{jumpHintLabel ? <JumpHintBadge label={jumpHintLabel} /> : null}
</span>
)}
{props.sweepAction !== null ? dragDestination : null}
Expand All @@ -1578,7 +1583,6 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
</div>
{metaLine}
</div>
{props.jumpLabel ? <JumpHintBadge label={props.jumpLabel} /> : null}
</TooltipTrigger>
{detailsTooltip}
</Tooltip>
Expand Down
Loading