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,3 +1,9 @@
|
||||
import {
|
||||
CompletedTaskIcon,
|
||||
WebSearchIcon,
|
||||
McpIcon,
|
||||
ToolRunIcon,
|
||||
} from "@/components/icons/product-icons";
|
||||
import {
|
||||
Fragment,
|
||||
memo,
|
||||
@@ -8,16 +14,7 @@ import {
|
||||
useState,
|
||||
type ReactNode,
|
||||
} from "react";
|
||||
import {
|
||||
CheckCircle2,
|
||||
Clock3,
|
||||
Layers,
|
||||
Search,
|
||||
Server,
|
||||
Terminal,
|
||||
Wrench,
|
||||
type LucideIcon,
|
||||
} from "lucide-react";
|
||||
import { Clock3, Layers, Terminal } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { MarkdownText } from "@/components/MarkdownText";
|
||||
@@ -43,7 +40,6 @@ import { ThinkingReasoningShell } from "@/components/thread/activity/ThinkingRea
|
||||
import { WebActivityRow } from "@/components/thread/activity/WebActivityRow";
|
||||
import {
|
||||
describeTraceLine,
|
||||
type TraceDescription,
|
||||
} from "@/components/thread/activity/trace-activity-model";
|
||||
import { WebSearchRun } from "@/components/thread/activity/WebSearchRun";
|
||||
import { webSearchRunsByTraceLine } from "@/components/thread/activity/web-search-model";
|
||||
@@ -809,11 +805,11 @@ function ActivityTraceRow({
|
||||
const trace = describeTraceLine(line, status, t, state?.result);
|
||||
const rowActive = status === "running" && active;
|
||||
const Icon = trace.icon === "clock" ? Clock3 : (trace.kind === "search"
|
||||
? Search
|
||||
? WebSearchIcon
|
||||
: trace.kind === "done"
|
||||
? CheckCircle2
|
||||
? CompletedTaskIcon
|
||||
: trace.kind === "tool"
|
||||
? Wrench
|
||||
? ToolRunIcon
|
||||
: Layers);
|
||||
if (trace.url && trace.host) {
|
||||
return (
|
||||
@@ -829,7 +825,7 @@ function ActivityTraceRow({
|
||||
}
|
||||
return (
|
||||
<ActivityStep
|
||||
marker={<TraceIconMark trace={trace} fallbackIcon={Icon} active={rowActive} />}
|
||||
icon={Icon}
|
||||
active={rowActive && trace.kind !== "done"}
|
||||
tone={status === "error" ? "error" : status === "done" ? "success" : "active"}
|
||||
label={formatActivityTarget(t, trace.label, trace.detail)}
|
||||
@@ -881,30 +877,6 @@ function toolProgressError(error: unknown): string | undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function TraceIconMark({
|
||||
trace,
|
||||
fallbackIcon: FallbackIcon,
|
||||
active,
|
||||
}: {
|
||||
trace: TraceDescription;
|
||||
fallbackIcon: LucideIcon;
|
||||
active: boolean;
|
||||
}) {
|
||||
return (
|
||||
<FallbackIcon
|
||||
className={cn(
|
||||
"h-3.5 w-3.5 shrink-0",
|
||||
trace.kind === "done"
|
||||
? "text-emerald-500/75"
|
||||
: active
|
||||
? "text-muted-foreground/75"
|
||||
: "text-muted-foreground/45",
|
||||
)}
|
||||
aria-hidden
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const CLI_RUN_TOOL_NAMES = new Set(["run_cli_app", "cli_anything_run"]);
|
||||
const CLI_RUN_STATUS_RANK: Record<CliRunStatus, number> = { running: 1, done: 2, error: 3 };
|
||||
const MCP_RUN_STATUS_RANK: Record<McpRunStatus, number> = { running: 1, done: 2, error: 3 };
|
||||
@@ -1396,7 +1368,7 @@ function McpRunRow({ run, active, preset }: { run: McpRunSummary; active: boolea
|
||||
) : preset ? (
|
||||
mcpPresetInitials(preset).slice(0, 2)
|
||||
) : (
|
||||
<Server className="h-3 w-3" aria-hidden />
|
||||
<McpIcon className="h-3 w-3" aria-hidden />
|
||||
)}
|
||||
</span>
|
||||
)}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import {
|
||||
ModelsIcon,
|
||||
} from "@/components/icons/product-icons";
|
||||
import {
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
@@ -6,7 +9,7 @@ import {
|
||||
type KeyboardEvent,
|
||||
type PointerEvent,
|
||||
} from "react";
|
||||
import { Check, SlidersHorizontal, Sparkles } from "lucide-react";
|
||||
import { Check } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import {
|
||||
@@ -445,7 +448,7 @@ export function ModelPresetBadge({
|
||||
"flex min-h-9 w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-sm font-medium text-muted-foreground hover:text-foreground",
|
||||
)}
|
||||
>
|
||||
<SlidersHorizontal className="size-4 shrink-0" strokeWidth={1.75} />
|
||||
<ModelsIcon className="size-4 shrink-0" strokeWidth={1.75} />
|
||||
<span>{t("thread.composer.manageModels")}</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -456,7 +459,7 @@ export function ModelPresetBadge({
|
||||
|
||||
return (
|
||||
<TooltipProvider>
|
||||
<Tooltip open={tooltipOpen && !open && !motion} onOpenChange={setTooltipOpen}>
|
||||
<Tooltip open={tooltipLabel !== label && tooltipOpen && !open && !motion} onOpenChange={setTooltipOpen}>
|
||||
{badge}
|
||||
<TooltipContent side="top">{tooltipLabel}</TooltipContent>
|
||||
</Tooltip>
|
||||
@@ -637,7 +640,7 @@ export function PresetProviderIcon({
|
||||
)}
|
||||
style={brand ? { backgroundColor: brand.color } : undefined}
|
||||
>
|
||||
{brand ? brand.initials.slice(0, 2) : <Sparkles className="h-3 w-3 text-muted-foreground/65" />}
|
||||
{brand ? brand.initials.slice(0, 2) : <ModelsIcon className="h-3 w-3 text-muted-foreground/65" />}
|
||||
</span>
|
||||
{logoUrl ? (
|
||||
<img
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import {
|
||||
PromptNavigationIcon,
|
||||
} from "@/components/icons/product-icons";
|
||||
import { useMemo, useState } from "react";
|
||||
import { ListTree, Search } from "lucide-react";
|
||||
import { Search } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -53,13 +56,13 @@ export function PromptNavigator({
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className={cn(
|
||||
"host-no-drag h-8 w-8 rounded-full text-muted-foreground/80",
|
||||
"hover:bg-accent/40 hover:text-foreground",
|
||||
"host-no-drag h-8 w-8 rounded-xl text-muted-foreground/80",
|
||||
"hover:text-foreground",
|
||||
)}
|
||||
aria-label={t("thread.promptNavigator.open")}
|
||||
onClick={() => setOpen(true)}
|
||||
>
|
||||
<ListTree className="h-4 w-4" />
|
||||
<PromptNavigationIcon className="h-4 w-4" />
|
||||
</Button>
|
||||
|
||||
<Sheet open={open} onOpenChange={setOpen}>
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import {
|
||||
ResumeIcon,
|
||||
} from "@/components/icons/product-icons";
|
||||
import { useEffect, useState } from "react";
|
||||
import { AlertTriangle, LoaderCircle, RotateCcw, X } from "lucide-react";
|
||||
import { AlertTriangle, LoaderCircle, X } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -97,7 +100,7 @@ export function RecoveryNotice({ state, onContinue, onDismiss }: RecoveryNoticeP
|
||||
disabled={pending !== null}
|
||||
onClick={() => run("continue")}
|
||||
>
|
||||
<RotateCcw className="mr-1 h-3.5 w-3.5" aria-hidden />
|
||||
<ResumeIcon className="mr-1 h-3.5 w-3.5" aria-hidden />
|
||||
{t("recovery.continue", { defaultValue: "Continue" })}
|
||||
</Button>
|
||||
) : null}
|
||||
|
||||
@@ -146,8 +146,8 @@ export function SessionInfoPopover({ client, sessionKey, token, title }: Session
|
||||
size="icon"
|
||||
aria-label={t("thread.header.sessionInfo")}
|
||||
className={cn(
|
||||
"host-no-drag h-8 w-8 rounded-full text-muted-foreground/85",
|
||||
"hover:bg-accent/40 hover:text-foreground",
|
||||
"host-no-drag h-8 w-8 rounded-xl text-muted-foreground/85",
|
||||
"hover:text-foreground",
|
||||
)}
|
||||
>
|
||||
<CalendarClock className="h-4 w-4 stroke-[1.75]" />
|
||||
|
||||
@@ -45,7 +45,7 @@ export function StreamErrorNotice({ error, onDismiss }: StreamErrorNoticeProps)
|
||||
size="icon"
|
||||
onClick={onDismiss}
|
||||
aria-label={t("common.dismiss")}
|
||||
className="h-6 w-6 shrink-0 text-destructive hover:bg-destructive/15 hover:text-destructive"
|
||||
className="h-6 w-6 shrink-0 text-destructive hover:text-destructive"
|
||||
>
|
||||
<X className="h-3.5 w-3.5" />
|
||||
</Button>
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
import {
|
||||
DelegationIcon,
|
||||
StopIcon,
|
||||
QueuedTaskIcon,
|
||||
RunningTaskIcon,
|
||||
StoppingTaskIcon,
|
||||
CompletedTaskIcon,
|
||||
CancelledTaskIcon,
|
||||
IncompleteTaskIcon,
|
||||
InterruptedTaskIcon,
|
||||
ErrorTaskIcon,
|
||||
} from "@/components/icons/product-icons";
|
||||
import { createContext, useContext, useEffect, useId, useLayoutEffect, useRef, useState, type ComponentProps, type ReactNode } from "react";
|
||||
import { Bot, CheckCircle2, ChevronDown, ChevronRight, CircleAlert, CircleMinus, LoaderCircle, Square } from "lucide-react";
|
||||
import { ChevronDown, ChevronRight } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -155,7 +167,7 @@ export function SubagentTasksProvider({ client, sessionKey, token, enabled, live
|
||||
<SheetContent ref={detailPanel} tabIndex={-1}
|
||||
className="w-full gap-0 overflow-hidden border-l p-0 outline-none sm:w-[min(32rem,calc(100vw-1rem))] sm:max-w-none"
|
||||
overlayClassName="bg-black/20 backdrop-blur-[8px]"
|
||||
closeButtonClassName="right-3 top-3 grid h-9 w-9 place-items-center rounded-full hover:bg-muted"
|
||||
closeButtonClassName="right-3 top-3 grid h-9 w-9 place-items-center rounded-full"
|
||||
onOpenAutoFocus={(event) => {
|
||||
event.preventDefault();
|
||||
detailPanel.current?.focus({ preventScroll: true });
|
||||
@@ -195,7 +207,7 @@ export function SubagentTasksProvider({ client, sessionKey, token, enabled, live
|
||||
</div> : null}
|
||||
{selected && (selected.state === "queued" || selected.state === "running") ? <div className="shrink-0 border-t px-5 py-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]">
|
||||
<Button type="button" variant="outline" size="sm" disabled={stoppingId !== null}
|
||||
onClick={() => void stop(selected)}><Square className="mr-2 h-3 w-3" aria-hidden />{t("thread.subagents.stopTask", { label: selected.label })}</Button>
|
||||
onClick={() => void stop(selected)}><StopIcon className="mr-2 h-3 w-3" aria-hidden />{t("thread.subagents.stopTask", { label: selected.label })}</Button>
|
||||
{stopError ? <p role="alert" className="mt-2 text-xs text-destructive">{stopError}</p> : null}
|
||||
</div> : null}
|
||||
</SheetContent>
|
||||
@@ -205,10 +217,14 @@ export function SubagentTasksProvider({ client, sessionKey, token, enabled, live
|
||||
|
||||
function TaskStateIcon({ task }: { task: SubagentTaskSnapshot }) {
|
||||
const className = "h-3.5 w-3.5 shrink-0";
|
||||
if (isActive(task)) return <LoaderCircle className={`${className} animate-spin motion-reduce:animate-none text-muted-foreground`} aria-hidden />;
|
||||
if (task.state === "done") return <CheckCircle2 className={`${className} text-emerald-600 dark:text-emerald-400`} aria-hidden />;
|
||||
if (task.state === "cancelled") return <CircleMinus className={`${className} text-muted-foreground`} aria-hidden />;
|
||||
return <CircleAlert className={`${className} text-destructive`} aria-hidden />;
|
||||
const Icon = {
|
||||
queued: QueuedTaskIcon, running: RunningTaskIcon, stopping: StoppingTaskIcon,
|
||||
done: CompletedTaskIcon, cancelled: CancelledTaskIcon, incomplete: IncompleteTaskIcon,
|
||||
interrupted: InterruptedTaskIcon, error: ErrorTaskIcon,
|
||||
}[task.state];
|
||||
const tone = task.state === "done" ? "text-emerald-600 dark:text-emerald-400"
|
||||
: task.state === "error" || task.state === "incomplete" ? "text-destructive" : "text-muted-foreground";
|
||||
return <Icon className={`${className} ${tone} ${task.state === "running" ? "animate-spin motion-reduce:animate-none" : ""}`} aria-hidden />;
|
||||
}
|
||||
|
||||
function TaskElapsed({ task }: { task: ObservedSubagentTask }) {
|
||||
@@ -295,7 +311,7 @@ function SubagentWork({ tasks, unlinked = false }: { tasks: ObservedSubagentTask
|
||||
<button type="button" aria-expanded={open} aria-controls={rowsId}
|
||||
onClick={() => setExpanded(!open)}
|
||||
className="flex w-full items-center gap-2.5 px-3 py-2.5 text-left text-xs text-muted-foreground hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring">
|
||||
<Bot className="h-3.5 w-3.5 shrink-0" aria-hidden />
|
||||
<DelegationIcon className="h-3.5 w-3.5 shrink-0" aria-hidden />
|
||||
<span className="font-medium">{title}</span>
|
||||
<span className="ml-auto min-w-0 text-right">
|
||||
{summary}{activeCount ? ` · ${t("thread.subagents.running", { count: activeCount })}` : ""}
|
||||
@@ -309,7 +325,7 @@ function SubagentWork({ tasks, unlinked = false }: { tasks: ObservedSubagentTask
|
||||
<TaskButton task={task} />
|
||||
{task.state === "queued" || task.state === "running" ? <Button type="button" variant="ghost" size="icon" className="h-9 w-9 shrink-0"
|
||||
aria-label={t("thread.subagents.stopTask", { label: task.label })} disabled={context.stoppingId !== null}
|
||||
onClick={() => void context.stop(task)}><Square className="h-3 w-3" aria-hidden /></Button> : null}
|
||||
onClick={() => void context.stop(task)}><StopIcon className="h-3 w-3" aria-hidden /></Button> : null}
|
||||
</div>)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,30 @@
|
||||
import {
|
||||
NewChatIcon,
|
||||
CompactIcon,
|
||||
StatusIcon,
|
||||
ModelsIcon,
|
||||
TriggerIcon,
|
||||
DreamLogIcon,
|
||||
PromptTemplateIcon,
|
||||
PairingIcon,
|
||||
ToolRunIcon,
|
||||
ActivityIcon,
|
||||
ArchiveIcon,
|
||||
SkillsIcon,
|
||||
MemoryIcon,
|
||||
HelpIcon,
|
||||
HistoryIcon,
|
||||
ConversationIcon,
|
||||
VoiceIcon,
|
||||
AttachIcon,
|
||||
RestartIcon,
|
||||
RestrictedAccessIcon,
|
||||
DreamIcon,
|
||||
StopIcon,
|
||||
EditIcon,
|
||||
GoalIcon,
|
||||
RestoreMemoryIcon,
|
||||
} from "@/components/icons/product-icons";
|
||||
import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
@@ -20,32 +47,16 @@ import {
|
||||
} from "@/components/CliAppMentionText";
|
||||
import { INLINE_TOKEN_HIGHLIGHT_COLOR } from "@/components/InlineTokenHighlight";
|
||||
import {
|
||||
Activity,
|
||||
Archive,
|
||||
ArrowUp,
|
||||
BookOpen,
|
||||
Brain,
|
||||
ChevronDown,
|
||||
ChevronUp,
|
||||
CircleHelp,
|
||||
CornerDownRight,
|
||||
FileText,
|
||||
GripVertical,
|
||||
History,
|
||||
ImageIcon,
|
||||
Loader2,
|
||||
MessageCircle,
|
||||
Mic,
|
||||
Plus,
|
||||
Quote,
|
||||
RotateCw,
|
||||
Shield,
|
||||
Sparkles,
|
||||
Square,
|
||||
SquarePen,
|
||||
Target,
|
||||
Trash2,
|
||||
Undo2,
|
||||
X,
|
||||
type LucideIcon,
|
||||
} from "lucide-react";
|
||||
@@ -64,7 +75,7 @@ import {
|
||||
TooltipTrigger,
|
||||
} from "@/components/ui/tooltip";
|
||||
import {
|
||||
WorkspaceAccessMenu,
|
||||
WorkspaceAccessToggle,
|
||||
WorkspaceProjectPicker,
|
||||
} from "@/components/thread/WorkspaceControls";
|
||||
import {
|
||||
@@ -243,18 +254,30 @@ interface ThreadComposerProps {
|
||||
}
|
||||
|
||||
const COMMAND_ICONS: Record<string, LucideIcon> = {
|
||||
activity: Activity,
|
||||
archive: Archive,
|
||||
"book-open": BookOpen,
|
||||
brain: Brain,
|
||||
"circle-help": CircleHelp,
|
||||
history: History,
|
||||
"rotate-cw": RotateCw,
|
||||
shield: Shield,
|
||||
sparkles: Sparkles,
|
||||
square: Square,
|
||||
"square-pen": SquarePen,
|
||||
"undo-2": Undo2,
|
||||
activity: ActivityIcon,
|
||||
archive: ArchiveIcon,
|
||||
"book-open": SkillsIcon,
|
||||
brain: MemoryIcon,
|
||||
"circle-help": HelpIcon,
|
||||
history: HistoryIcon,
|
||||
"rotate-cw": RestartIcon,
|
||||
shield: RestrictedAccessIcon,
|
||||
sparkles: DreamIcon,
|
||||
square: StopIcon,
|
||||
"square-pen": EditIcon,
|
||||
"undo-2": RestoreMemoryIcon,
|
||||
zap: TriggerIcon,
|
||||
"file-text": PromptTemplateIcon,
|
||||
wrench: ToolRunIcon,
|
||||
};
|
||||
|
||||
const BUILTIN_COMMAND_ICONS: Record<string, LucideIcon> = {
|
||||
"/new": NewChatIcon, "/compact": CompactIcon, "/stop": StopIcon,
|
||||
"/restart": RestartIcon, "/status": StatusIcon, "/model": ModelsIcon,
|
||||
"/history": HistoryIcon, "/goal": GoalIcon, "/trigger": TriggerIcon,
|
||||
"/dream": DreamIcon, "/dream-log": DreamLogIcon, "/dream-restore": RestoreMemoryIcon,
|
||||
"/dream-prompt": PromptTemplateIcon, "/evaluator-prompt": PromptTemplateIcon,
|
||||
"/skill": SkillsIcon, "/help": HelpIcon, "/pairing": PairingIcon,
|
||||
};
|
||||
|
||||
const SLASH_PALETTE_GAP_PX = 8;
|
||||
@@ -840,7 +863,7 @@ function GoalStateStrip({
|
||||
type="button"
|
||||
className={cn(
|
||||
"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full",
|
||||
"text-muted-foreground transition-colors hover:bg-muted/65 hover:text-foreground",
|
||||
"text-muted-foreground transition-colors hover:text-foreground",
|
||||
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
||||
)}
|
||||
aria-label={t("thread.composer.goalStateCloseAria")}
|
||||
@@ -866,7 +889,7 @@ function GoalStateStrip({
|
||||
role="status"
|
||||
aria-label={ariaLabel}
|
||||
>
|
||||
<Target className="h-4 w-4 shrink-0 text-primary/75" aria-hidden />
|
||||
<GoalIcon className="h-4 w-4 shrink-0 text-primary/75" aria-hidden />
|
||||
<span className="flex min-w-0 flex-1 items-center gap-1.5 text-[12px] font-medium text-foreground/75">
|
||||
{displayStripLabel ? (
|
||||
<span className="truncate">
|
||||
@@ -880,7 +903,7 @@ function GoalStateStrip({
|
||||
type="button"
|
||||
className={cn(
|
||||
"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full",
|
||||
"text-muted-foreground transition-colors hover:bg-muted/55 hover:text-foreground",
|
||||
"text-muted-foreground transition-colors hover:text-foreground",
|
||||
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
||||
)}
|
||||
aria-expanded={goalPanelOpen}
|
||||
@@ -2331,7 +2354,7 @@ export function ThreadComposer({
|
||||
return () => observer?.disconnect();
|
||||
}, [compactControls, compactWhenIdle, modelLabel, voiceRecorder.isRecording, workspaceScope]);
|
||||
const accessControl = workspaceScope && !workspaceControlsHidden ? (
|
||||
<WorkspaceAccessMenu
|
||||
<WorkspaceAccessToggle
|
||||
scope={workspaceScope}
|
||||
disabled={interactionDisabled || workspaceScopeDisabled}
|
||||
canUseFullAccess={workspaceControls?.can_use_full_access !== false}
|
||||
@@ -2523,7 +2546,7 @@ export function ThreadComposer({
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
className="touch-target -mr-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full transition-colors hover:bg-muted/70 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
||||
className="touch-target -mr-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
||||
aria-label={t("thread.composer.removeQuotedContext")}
|
||||
onClick={() => {
|
||||
onQuotedContextChange?.(null);
|
||||
@@ -2625,18 +2648,18 @@ export function ThreadComposer({
|
||||
<Button
|
||||
type="button"
|
||||
size="icon"
|
||||
variant="ghost"
|
||||
variant="icon"
|
||||
disabled={attachButtonDisabled}
|
||||
aria-label={t("thread.composer.attachImage")}
|
||||
onClick={() => fileInputRef.current?.click()}
|
||||
className={cn(
|
||||
"thread-composer-action thread-composer-round-action touch-target rounded-full text-muted-foreground hover:text-foreground",
|
||||
"thread-composer-action thread-composer-round-action touch-target rounded-xl text-muted-foreground hover:text-foreground",
|
||||
isHero
|
||||
? "h-8 w-8 border border-border/55 bg-card shadow-[0_2px_8px_rgba(15,23,42,0.05)] hover:bg-card"
|
||||
: "h-9 w-9 border border-border/55 bg-card shadow-[0_2px_8px_rgba(15,23,42,0.05)] hover:bg-card",
|
||||
? "h-8 w-8"
|
||||
: "h-9 w-9",
|
||||
)}
|
||||
>
|
||||
<Plus className={cn(isHero ? "h-[18px] w-[18px]" : "h-4 w-4")} />
|
||||
<AttachIcon className={cn(isHero ? "h-[18px] w-[18px]" : "h-4 w-4")} />
|
||||
</Button>
|
||||
{voiceRecorder.isRecording ? (
|
||||
<VoiceRecordingMeter
|
||||
@@ -2667,24 +2690,23 @@ export function ThreadComposer({
|
||||
disabled={voiceRecorder.buttonDisabled}
|
||||
aria-label={voiceButtonLabel}
|
||||
aria-keyshortcuts={VOICE_SHORTCUT_ARIA}
|
||||
title={voiceButtonTooltip}
|
||||
onPointerDown={voiceRecorder.beginPress}
|
||||
onPointerUp={voiceRecorder.endPress}
|
||||
onPointerCancel={voiceRecorder.endPress}
|
||||
onClick={voiceRecorder.handleClick}
|
||||
className={cn(
|
||||
"thread-composer-action touch-target rounded-full border border-transparent text-muted-foreground hover:bg-muted/65 hover:text-foreground",
|
||||
"thread-composer-action touch-target rounded-xl border border-transparent text-muted-foreground hover:text-foreground",
|
||||
isHero ? "h-8 w-8" : "h-9 w-9",
|
||||
voiceRecorder.isRecording &&
|
||||
"bg-red-500 text-white shadow-[0_8px_20px_rgba(239,68,68,0.22)] hover:bg-red-500 hover:text-white",
|
||||
"bg-red-500 text-white hover:text-white",
|
||||
)}
|
||||
>
|
||||
{voiceRecorder.state === "transcribing" ? (
|
||||
<Loader2 className={cn(isHero ? "h-4 w-4" : "h-4 w-4", "animate-spin")} />
|
||||
) : voiceRecorder.isRecording ? (
|
||||
<Square className={cn(isHero ? "h-3.5 w-3.5" : "h-3.5 w-3.5")} fill="currentColor" />
|
||||
<StopIcon className={cn(isHero ? "h-3.5 w-3.5" : "h-3.5 w-3.5")} fill="currentColor" />
|
||||
) : (
|
||||
<Mic className={cn(isHero ? "h-4 w-4" : "h-4 w-4")} />
|
||||
<VoiceIcon className={cn(isHero ? "h-4 w-4" : "h-4 w-4")} />
|
||||
)}
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
@@ -2716,18 +2738,19 @@ export function ThreadComposer({
|
||||
}
|
||||
onClick={showStopButton ? handleStop : modelNeedsSetup ? onModelBadgeClick : undefined}
|
||||
className={cn(
|
||||
"thread-composer-action thread-composer-round-action touch-target rounded-full transition-transform",
|
||||
"thread-composer-action thread-composer-round-action touch-target rounded-full",
|
||||
showStopButton
|
||||
? "border border-border/70 bg-card text-foreground/85 shadow-[0_3px_10px_rgba(15,23,42,0.08)] hover:bg-muted/65 hover:text-foreground disabled:text-muted-foreground/50"
|
||||
? "border border-border/70 bg-card text-foreground/85 hover:text-foreground disabled:text-muted-foreground/50"
|
||||
: isHero
|
||||
? "border border-foreground bg-foreground text-background shadow-[0_4px_12px_rgba(15,23,42,0.20)] hover:bg-foreground/90 disabled:border-foreground disabled:bg-foreground disabled:text-background"
|
||||
: "border border-foreground bg-foreground text-background shadow-[0_3px_10px_rgba(15,23,42,0.18)] hover:bg-foreground/90 disabled:border-foreground disabled:bg-foreground disabled:text-background",
|
||||
? "border border-foreground bg-foreground text-background disabled:border-foreground disabled:bg-foreground disabled:text-background"
|
||||
: "border border-foreground bg-foreground text-background disabled:border-foreground disabled:bg-foreground disabled:text-background",
|
||||
isHero ? "h-8 w-8" : "h-9 w-9",
|
||||
(canSend || canOpenModelSettings || showStopButton) && "hover:scale-[1.03] active:scale-95",
|
||||
)}
|
||||
>
|
||||
{showStopButton ? (
|
||||
<Square className={cn("fill-current stroke-current", isHero ? "h-3 w-3" : "h-3.5 w-3.5")} />
|
||||
<StopIcon className={cn("fill-current stroke-current", isHero ? "h-3 w-3" : "h-3.5 w-3.5")} />
|
||||
) : modelNeedsSetup ? (
|
||||
<ModelsIcon className="h-4 w-4" />
|
||||
) : canSend || !isStreaming ? (
|
||||
<ArrowUp className={cn(isHero ? "h-4 w-4" : "h-4 w-4")} />
|
||||
) : (
|
||||
@@ -2909,8 +2932,8 @@ function QueuedPromptRow({
|
||||
onDragEnd={onDragEnd}
|
||||
className={cn(
|
||||
"inline-flex h-7 w-7 shrink-0 cursor-grab items-center justify-center rounded-lg",
|
||||
"text-muted-foreground/45 transition-colors hover:bg-background/80 hover:text-muted-foreground",
|
||||
"active:cursor-grabbing dark:hover:bg-white/[0.06]",
|
||||
"text-muted-foreground/45 transition-colors hover:text-muted-foreground",
|
||||
"active:cursor-grabbing",
|
||||
)}
|
||||
>
|
||||
<GripVertical className="pointer-events-none h-3.5 w-3.5" aria-hidden />
|
||||
@@ -2942,17 +2965,17 @@ function QueuedPromptRow({
|
||||
size="icon"
|
||||
aria-label={editLabel}
|
||||
title={editLabel}
|
||||
className="h-7 w-7 shrink-0 rounded-full text-muted-foreground hover:bg-background/85 hover:text-foreground dark:hover:bg-white/[0.07]"
|
||||
className="h-7 w-7 shrink-0 rounded-full text-muted-foreground hover:text-foreground"
|
||||
onClick={() => onEdit(prompt)}
|
||||
>
|
||||
<SquarePen className="h-3.5 w-3.5" aria-hidden />
|
||||
<EditIcon className="h-3.5 w-3.5" aria-hidden />
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
aria-label={deleteLabel}
|
||||
className="h-7 w-7 shrink-0 rounded-full text-muted-foreground hover:bg-background/85 hover:text-destructive dark:hover:bg-white/[0.07]"
|
||||
className="h-7 w-7 shrink-0 rounded-full text-muted-foreground hover:text-destructive"
|
||||
onClick={() => onDelete(prompt.id)}
|
||||
>
|
||||
<Trash2 className="h-3 w-3" aria-hidden />
|
||||
@@ -3188,7 +3211,7 @@ function MentionCandidateLogo({
|
||||
className="flex h-5 w-5 shrink-0 items-center justify-center"
|
||||
style={{ color }}
|
||||
>
|
||||
<MessageCircle className="h-4 w-4" aria-hidden />
|
||||
<ConversationIcon className="h-4 w-4" aria-hidden />
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -3253,7 +3276,7 @@ function SlashCommandPalette({
|
||||
>
|
||||
<div ref={listRef} className="overflow-y-auto pr-0.5" style={{ maxHeight: listMaxHeight }}>
|
||||
{commands.map((command, index) => {
|
||||
const Icon = COMMAND_ICONS[command.icon] ?? CircleHelp;
|
||||
const Icon = command.kind === "skill" ? SkillsIcon : BUILTIN_COMMAND_ICONS[command.command] ?? COMMAND_ICONS[command.icon] ?? HelpIcon;
|
||||
const selected = index === selectedIndex;
|
||||
const isSkill = command.kind === "skill";
|
||||
const commandKey = slashCommandI18nKey(command.command);
|
||||
@@ -3413,7 +3436,7 @@ function AttachmentChip({
|
||||
aria-label={labelRemove}
|
||||
className={cn(
|
||||
"ml-1 grid h-5 w-5 flex-none place-items-center rounded-full",
|
||||
"text-muted-foreground/80 hover:bg-foreground/8 hover:text-foreground",
|
||||
"text-muted-foreground/80 hover:text-foreground",
|
||||
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-foreground/30",
|
||||
)}
|
||||
>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { Menu, MessageCircleDashed, Moon, Sun } from "lucide-react";
|
||||
import {
|
||||
TemporaryChatIcon,
|
||||
} from "@/components/icons/product-icons";
|
||||
import { Menu, Moon, Sun } from "lucide-react";
|
||||
import { type ReactNode } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
@@ -84,7 +87,7 @@ export function ThreadHeader({
|
||||
aria-label={t("thread.header.toggleSidebar")}
|
||||
onClick={onToggleSidebar}
|
||||
className={cn(
|
||||
"h-7 w-7 rounded-md text-muted-foreground hover:bg-accent/35 hover:text-foreground",
|
||||
"h-7 w-7 rounded-xl text-muted-foreground hover:text-foreground",
|
||||
hideSidebarToggleForHostChrome && "lg:hidden",
|
||||
)}
|
||||
>
|
||||
@@ -124,11 +127,10 @@ export function ThreadHeader({
|
||||
aria-pressed={temporaryChatEnabled}
|
||||
onClick={() => onTemporaryChatEnabledChange(!temporaryChatEnabled)}
|
||||
className={cn(
|
||||
"host-no-drag h-8 w-8 shrink-0 rounded-full bg-transparent text-muted-foreground shadow-none transition-none hover:text-foreground",
|
||||
temporaryChatEnabled ? "hover:bg-transparent" : "hover:bg-accent/45",
|
||||
"host-no-drag h-8 w-8 shrink-0 rounded-xl text-muted-foreground hover:text-foreground",
|
||||
)}
|
||||
>
|
||||
<MessageCircleDashed
|
||||
<TemporaryChatIcon
|
||||
data-testid="temporary-chat-icon"
|
||||
className={cn(
|
||||
"h-4 w-4 motion-safe:transition-colors",
|
||||
@@ -189,7 +191,7 @@ function ThemeButton({
|
||||
aria-label={label}
|
||||
onClick={onToggleTheme}
|
||||
className={cn(
|
||||
"host-no-drag h-8 w-8 rounded-full text-muted-foreground/85 hover:bg-accent/40 hover:text-foreground",
|
||||
"host-no-drag h-8 w-8 rounded-xl text-muted-foreground/85 hover:text-foreground",
|
||||
className,
|
||||
)}
|
||||
>
|
||||
|
||||
@@ -454,7 +454,7 @@ function MessageBlockMenu({
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogTrigger asChild>
|
||||
<button ref={triggerRef} type="button" data-message-block-menu-trigger aria-label={label}
|
||||
className="inline-flex h-11 w-8 items-center justify-center rounded-control text-muted-foreground transition-colors hover:bg-muted/70 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
|
||||
className="inline-flex h-11 w-8 items-center justify-center rounded-control text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
|
||||
<MoreHorizontal className="h-4 w-4" strokeWidth={1.75} aria-hidden />
|
||||
</button>
|
||||
</DialogTrigger>
|
||||
@@ -487,8 +487,7 @@ function MessageBlockMenu({
|
||||
data-message-block-menu-highlight
|
||||
className={cn(
|
||||
"inline-flex h-4 w-7 items-center justify-center rounded-full",
|
||||
"transition-[background-color,box-shadow,scale]",
|
||||
"group-hover:bg-muted/70 group-active:scale-[0.96]",
|
||||
"transition-colors",
|
||||
"group-focus-visible:ring-2 group-focus-visible:ring-ring",
|
||||
"motion-reduce:transform-none motion-reduce:transition-none",
|
||||
)}
|
||||
|
||||
@@ -1093,7 +1093,7 @@ export const ThreadViewport = forwardRef<ThreadViewportHandle, ThreadViewportPro
|
||||
size="icon"
|
||||
onClick={() => scrollToBottom(true, { force: true })}
|
||||
className={cn(
|
||||
"h-8 w-8 rounded-full shadow-md",
|
||||
"h-8 w-8 rounded-full",
|
||||
"bg-background/90 backdrop-blur",
|
||||
"animate-in fade-in-0 zoom-in-95",
|
||||
)}
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import { useCallback, useEffect, useId, useRef, useState, type ReactNode } from "react";
|
||||
import { AlertTriangle, Check, ChevronDown, Folder, Hand } from "lucide-react";
|
||||
import {
|
||||
FullAccessIcon,
|
||||
WorkspaceIcon,
|
||||
RestrictedAccessIcon,
|
||||
} from "@/components/icons/product-icons";
|
||||
import { useCallback, useEffect, useId, useRef, useState } from "react";
|
||||
import { Check, ChevronDown } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
import {
|
||||
floatingItemClassName,
|
||||
floatingItemFocusClassName,
|
||||
@@ -20,7 +19,6 @@ import {
|
||||
PopoverTrigger,
|
||||
} from "@/components/ui/popover";
|
||||
import type {
|
||||
WorkspaceAccessMode,
|
||||
WorkspaceScopePayload,
|
||||
WorkspacesPayload,
|
||||
} from "@/lib/types";
|
||||
@@ -174,7 +172,7 @@ export function WorkspaceProjectPicker({
|
||||
(connected || currentProjectScope) && "text-primary",
|
||||
)}
|
||||
>
|
||||
<Folder className={cn("shrink-0", compact ? "h-4 w-4" : "h-3.5 w-3.5")} />
|
||||
<WorkspaceIcon className={cn("shrink-0", compact ? "h-4 w-4" : "h-3.5 w-3.5")} />
|
||||
<span className={compact ? "sr-only" : "truncate"}>{projectLabel}</span>
|
||||
</button>
|
||||
{!compact && (pathError || error) ? (
|
||||
@@ -208,7 +206,7 @@ export function WorkspaceProjectPicker({
|
||||
(connected || currentProjectScope) && "text-primary",
|
||||
)}
|
||||
>
|
||||
<Folder className={cn("shrink-0", compact ? "h-4 w-4" : "h-3.5 w-3.5")} />
|
||||
<WorkspaceIcon className={cn("shrink-0", compact ? "h-4 w-4" : "h-3.5 w-3.5")} />
|
||||
<span className={compact ? "sr-only" : "truncate"}>{projectLabel}</span>
|
||||
{!compact ? (
|
||||
<ChevronDown className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />
|
||||
@@ -231,7 +229,7 @@ export function WorkspaceProjectPicker({
|
||||
)}
|
||||
>
|
||||
<span className="grid h-8 w-8 shrink-0 place-items-center rounded-control bg-muted text-foreground/80">
|
||||
<Folder className="h-4 w-4" />
|
||||
<WorkspaceIcon className="h-4 w-4" />
|
||||
</span>
|
||||
<span className="min-w-0 flex-1">
|
||||
<span className="block truncate text-[13px] font-semibold text-foreground">
|
||||
@@ -298,7 +296,7 @@ export function WorkspaceProjectPicker({
|
||||
);
|
||||
}
|
||||
|
||||
export function WorkspaceAccessMenu({
|
||||
export function WorkspaceAccessToggle({
|
||||
scope,
|
||||
disabled,
|
||||
canUseFullAccess,
|
||||
@@ -312,7 +310,6 @@ export function WorkspaceAccessMenu({
|
||||
onChange?: (scope: WorkspaceScopePayload) => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const dismissedByPointerRef = useRef(false);
|
||||
const mode = scope.access_mode;
|
||||
const isFull = mode === "full";
|
||||
const accessLabel = t(
|
||||
@@ -323,99 +320,33 @@ export function WorkspaceAccessMenu({
|
||||
);
|
||||
const accessAriaLabel = `${t("thread.composer.workspace.accessAria")}: ${accessLabel}`;
|
||||
|
||||
const setMode = (value: WorkspaceAccessMode) => {
|
||||
if (value === "full" && !canUseFullAccess) return;
|
||||
if (value === mode) return;
|
||||
onChange?.(scopeWithAccessMode(scope, value));
|
||||
};
|
||||
|
||||
return (
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild disabled={disabled || !onChange}>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
aria-label={accessAriaLabel}
|
||||
title={accessLabel}
|
||||
className={cn(
|
||||
"thread-composer-access touch-target min-w-0 max-w-[min(12.5rem,42vw)] whitespace-nowrap rounded-control border border-transparent font-semibold shadow-none",
|
||||
isHero ? "h-8 px-2.5 text-[12px]" : "h-9 px-3 text-[12.5px]",
|
||||
isFull
|
||||
? "bg-transparent text-orange-600 hover:bg-orange-500/8 dark:text-orange-300 dark:hover:bg-orange-400/10"
|
||||
: "bg-transparent text-muted-foreground hover:bg-foreground/[0.045] hover:text-foreground dark:hover:bg-white/[0.06]",
|
||||
)}
|
||||
>
|
||||
{isFull ? (
|
||||
<AlertTriangle className={cn("thread-composer-access-icon mr-1.5 shrink-0", isHero ? "h-3.5 w-3.5" : "h-3.5 w-3.5")} />
|
||||
) : (
|
||||
<Hand className={cn("thread-composer-access-icon mr-1.5 shrink-0", isHero ? "h-3.5 w-3.5" : "h-3.5 w-3.5")} />
|
||||
)}
|
||||
<span aria-hidden className="thread-composer-access-label-full min-w-0 truncate">
|
||||
{accessLabel}
|
||||
</span>
|
||||
<span aria-hidden className="thread-composer-access-label-short hidden min-w-0 truncate">
|
||||
{shortAccessLabel}
|
||||
</span>
|
||||
<ChevronDown className={cn("thread-composer-access-chevron ml-1.5 shrink-0", isHero ? "h-3 w-3" : "h-3 w-3")} />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent
|
||||
align="start"
|
||||
className="w-56"
|
||||
onPointerDownOutside={() => { dismissedByPointerRef.current = true; }}
|
||||
onCloseAutoFocus={(event) => {
|
||||
if (dismissedByPointerRef.current) event.preventDefault();
|
||||
dismissedByPointerRef.current = false;
|
||||
}}
|
||||
>
|
||||
<AccessMenuItem
|
||||
icon={<Hand className="h-4 w-4" />}
|
||||
label={t("thread.composer.workspace.default")}
|
||||
selected={mode === "restricted"}
|
||||
onSelect={() => setMode("restricted")}
|
||||
/>
|
||||
<AccessMenuItem
|
||||
icon={<AlertTriangle className="h-4 w-4" />}
|
||||
label={t("thread.composer.workspace.full")}
|
||||
selected={mode === "full"}
|
||||
disabled={!canUseFullAccess}
|
||||
warning
|
||||
onSelect={() => setMode("full")}
|
||||
/>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
);
|
||||
}
|
||||
|
||||
function AccessMenuItem({
|
||||
icon,
|
||||
label,
|
||||
selected,
|
||||
disabled,
|
||||
warning,
|
||||
onSelect,
|
||||
}: {
|
||||
icon: ReactNode;
|
||||
label: string;
|
||||
selected: boolean;
|
||||
disabled?: boolean;
|
||||
warning?: boolean;
|
||||
onSelect: () => void;
|
||||
}) {
|
||||
return (
|
||||
<DropdownMenuItem
|
||||
disabled={disabled}
|
||||
onSelect={onSelect}
|
||||
<Button
|
||||
type="button"
|
||||
variant={null}
|
||||
aria-label={accessAriaLabel}
|
||||
aria-pressed={isFull}
|
||||
disabled={disabled || !onChange || (!isFull && !canUseFullAccess)}
|
||||
onClick={() => onChange?.(scopeWithAccessMode(scope, isFull ? "restricted" : "full"))}
|
||||
className={cn(
|
||||
"flex h-10 items-center gap-3 px-3 text-[13.5px] font-semibold max-sm:min-h-11",
|
||||
warning && "text-orange-600 focus:text-orange-600 dark:text-orange-300 dark:focus:text-orange-300",
|
||||
"settings-hover thread-composer-access touch-target min-w-0 max-w-[min(12.5rem,42vw)] whitespace-nowrap rounded-control border border-transparent font-semibold shadow-none",
|
||||
isHero ? "h-8 px-2.5 text-[12px]" : "h-9 px-3 text-[12.5px]",
|
||||
isFull
|
||||
? "bg-transparent text-orange-600 hover:text-orange-600 dark:text-orange-300 dark:hover:text-orange-300"
|
||||
: "bg-transparent text-muted-foreground hover:text-foreground",
|
||||
)}
|
||||
>
|
||||
<span className="grid h-5 w-5 shrink-0 place-items-center text-current" aria-hidden>
|
||||
{icon}
|
||||
{isFull ? (
|
||||
<FullAccessIcon className={cn("thread-composer-access-icon mr-1.5 shrink-0", isHero ? "h-3.5 w-3.5" : "h-3.5 w-3.5")} />
|
||||
) : (
|
||||
<RestrictedAccessIcon className={cn("thread-composer-access-icon mr-1.5 shrink-0", isHero ? "h-3.5 w-3.5" : "h-3.5 w-3.5")} />
|
||||
)}
|
||||
<span aria-hidden className="thread-composer-access-label-full min-w-0 truncate">
|
||||
{accessLabel}
|
||||
</span>
|
||||
<span className="min-w-0 flex-1 truncate">{label}</span>
|
||||
{selected ? <Check className="h-4 w-4 shrink-0" aria-hidden /> : null}
|
||||
</DropdownMenuItem>
|
||||
<span aria-hidden className="thread-composer-access-label-short hidden min-w-0 truncate">
|
||||
{shortAccessLabel}
|
||||
</span>
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
@@ -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