feat(webui): unify icons and refine interaction feedback (#6074)
* feat(webui): unify product icons and refine interaction feedback * test(webui): align layout and tooltip expectations with icon refresh * test(webui): verify temporary chat uses shared icon controls * fix(webui): toggle workspace access directly and restore send arrow * fix(webui): keep the send control circular * fix(webui): clear workspace toggle background on pointer leave * test(webui): isolate GitHub navigation in star prompt tests * test(webui): prevent external default navigation during star link clicks
This commit is contained in:
1 parent
9dc0abae4f
commit
63bdd40280
59 files changed
+615
-505
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import type { CSSProperties, ReactNode } from "react";
|
||||
import { useRef, useState, type CSSProperties, type ReactNode } from "react";
|
||||
import type { LucideIcon } from "lucide-react";
|
||||
|
||||
import { StreamingLabelSheen } from "@/components/MessageBubble";
|
||||
@@ -40,8 +40,11 @@ export function ActivityStep({
|
||||
markerClassName,
|
||||
style,
|
||||
}: ActivityStepProps) {
|
||||
const lineRef = useRef<HTMLDivElement>(null);
|
||||
const [hintOpen, setHintOpen] = useState(false);
|
||||
const line = (
|
||||
<div
|
||||
ref={lineRef}
|
||||
data-testid="activity-line"
|
||||
tabIndex={typeof label === "string" ? 0 : undefined}
|
||||
className="flex min-w-0 items-center gap-1.5 overflow-hidden whitespace-nowrap"
|
||||
@@ -50,7 +53,7 @@ export function ActivityStep({
|
||||
active={active && animateLabel}
|
||||
className={cn(
|
||||
"min-w-0 flex-1 truncate font-medium",
|
||||
tone === "error" ? "text-destructive/78" : "text-muted-foreground/85",
|
||||
tone === "error" ? "text-destructive/[0.78]" : "text-muted-foreground",
|
||||
labelClassName,
|
||||
)}
|
||||
>
|
||||
@@ -80,15 +83,12 @@ export function ActivityStep({
|
||||
{marker ?? (
|
||||
<span
|
||||
className={cn(
|
||||
"grid h-3.5 w-3.5 place-items-center rounded-full border bg-background transition-colors",
|
||||
tone === "active" && "border-muted-foreground/28 text-muted-foreground/72",
|
||||
tone === "success" && "border-emerald-500/28 text-emerald-500/78",
|
||||
tone === "error" && "border-destructive/30 text-destructive/78",
|
||||
tone === "neutral" && "border-muted-foreground/18 text-muted-foreground/50",
|
||||
"grid h-3.5 w-3.5 place-items-center transition-colors",
|
||||
tone === "error" ? "text-destructive/[0.78]" : "text-muted-foreground",
|
||||
markerClassName,
|
||||
)}
|
||||
>
|
||||
{Icon ? <Icon className="h-2.5 w-2.5" strokeWidth={2.15} /> : null}
|
||||
{Icon ? <Icon className="h-3.5 w-3.5" strokeWidth={1.75} /> : null}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
@@ -96,7 +96,11 @@ export function ActivityStep({
|
||||
<div className={cn("min-w-0", contentClassName)}>
|
||||
{typeof label === "string" ? (
|
||||
<TooltipProvider>
|
||||
<Tooltip>
|
||||
<Tooltip open={hintOpen} onOpenChange={(open) => {
|
||||
const truncated = Array.from(lineRef.current?.querySelectorAll<HTMLElement>(".truncate") ?? [])
|
||||
.some((element) => element.scrollWidth > element.clientWidth);
|
||||
setHintOpen(open && (truncated || tooltipContent !== undefined && tooltipContent !== label));
|
||||
}}>
|
||||
<TooltipTrigger asChild>{line}</TooltipTrigger>
|
||||
<TooltipContent side="top" className="max-w-[min(32rem,calc(100vw-2rem))] whitespace-pre-wrap break-words">
|
||||
{tooltipContent ?? label}
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
import {
|
||||
AlertCircle,
|
||||
FileSearch,
|
||||
FolderOpen,
|
||||
ListTree,
|
||||
MemoryStick,
|
||||
Play,
|
||||
type LucideIcon,
|
||||
} from "lucide-react";
|
||||
DelegationIcon,
|
||||
TaskInspectIcon,
|
||||
TaskMessageIcon,
|
||||
StopIcon,
|
||||
ImageGenerationIcon,
|
||||
ConversationIcon,
|
||||
AutomationsIcon,
|
||||
GoalIcon,
|
||||
FileReadIcon,
|
||||
FileListIcon,
|
||||
MemoryIcon,
|
||||
ToolRunIcon,
|
||||
} from "@/components/icons/product-icons";
|
||||
import { AlertCircle, FileSearch, type LucideIcon } from "lucide-react";
|
||||
import { useMemo } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
@@ -48,14 +54,27 @@ function buildModel(items: GenericToolRunItem[], t: ReturnType<typeof useTransla
|
||||
const presentation = describeGenericToolRun(items, t);
|
||||
return {
|
||||
...presentation,
|
||||
icon: activityIcon(family),
|
||||
icon: activityIcon(family, items[0]),
|
||||
};
|
||||
}
|
||||
|
||||
function activityIcon(family: ToolFamily): LucideIcon {
|
||||
function activityIcon(family: ToolFamily, item: GenericToolRunItem | undefined): LucideIcon {
|
||||
const name = item?.trace.name;
|
||||
const action = item?.trace.fields.find((field) => field.key === "action")?.value.toLowerCase();
|
||||
if (name === "spawn") return DelegationIcon;
|
||||
if (name === "subagent") {
|
||||
if (action === "check") return TaskInspectIcon;
|
||||
if (action === "send") return TaskMessageIcon;
|
||||
if (action === "cancel") return StopIcon;
|
||||
return DelegationIcon;
|
||||
}
|
||||
if (name === "generate_image") return ImageGenerationIcon;
|
||||
if (name === "message") return ConversationIcon;
|
||||
if (name === "cron") return AutomationsIcon;
|
||||
if (name === "create_goal") return GoalIcon;
|
||||
if (family === "content-search" || family === "file-search") return FileSearch;
|
||||
if (family === "list") return ListTree;
|
||||
if (family === "read") return FolderOpen;
|
||||
if (family === "memory") return MemoryStick;
|
||||
return Play;
|
||||
if (family === "list") return FileListIcon;
|
||||
if (family === "read") return FileReadIcon;
|
||||
if (family === "memory") return MemoryIcon;
|
||||
return ToolRunIcon;
|
||||
}
|
||||
@@ -35,11 +35,12 @@ export function ThinkingReasoningShell({
|
||||
const headerClassName = "touch-target inline-flex h-7 min-w-0 items-center gap-1.5 rounded-md px-1.5";
|
||||
const headerContent = (
|
||||
<>
|
||||
<Activity className="h-3.5 w-3.5 shrink-0" strokeWidth={1.5} aria-hidden />
|
||||
<Activity className={cn("h-3.5 w-3.5 shrink-0", active ? "activity-current" : "text-muted-foreground/65")} strokeWidth={1.5} aria-hidden>
|
||||
{active ? <path className="activity-current-trace" pathLength={100} d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2" /> : null}
|
||||
</Activity>
|
||||
<span
|
||||
className={cn(
|
||||
"min-w-0 truncate text-[12px] font-normal leading-4 text-muted-foreground/65",
|
||||
active && "animate-pulse motion-reduce:animate-none",
|
||||
)}
|
||||
>
|
||||
{label}
|
||||
@@ -63,7 +64,7 @@ export function ThinkingReasoningShell({
|
||||
data-contextual-activity-collapse={expanded || undefined}
|
||||
className={cn(
|
||||
headerClassName,
|
||||
"bg-transparent transition-colors hover:bg-muted/60 hover:text-foreground",
|
||||
"bg-transparent transition-colors hover:text-foreground",
|
||||
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
||||
)}
|
||||
onClick={onToggle}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { AlertCircle, Search } from "lucide-react";
|
||||
import {
|
||||
WebSearchIcon,
|
||||
} from "@/components/icons/product-icons";
|
||||
import { AlertCircle } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { ActivityStep } from "@/components/thread/activity/ActivityStep";
|
||||
@@ -17,7 +20,7 @@ export function WebSearchRun({ run, turnActive }: { run: WebSearchRunModel; turn
|
||||
return (
|
||||
<>
|
||||
<ActivityStep
|
||||
icon={status === "error" ? AlertCircle : Search}
|
||||
icon={status === "error" ? AlertCircle : WebSearchIcon}
|
||||
active={active}
|
||||
tone={status === "error" ? "error" : status === "done" ? "success" : "active"}
|
||||
label={label}
|
||||
|
||||
Reference in new issue
Block a user