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:
chengyongru authored and GitHub committed 2026-10-06 00:46:38 +08:00
1 parent 9dc0abae4f
commit 63bdd40280
59 files changed
+615 -505

No files matched your search

+12 -12
View File
@@ -1082,7 +1082,7 @@ export const ChatList = memo(function ChatList({
<DropdownMenuTrigger
className={cn(
"sidebar-action-trigger touch-target inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-sidebar-muted-foreground opacity-0 transition-opacity",
"media-hover:hover:bg-sidebar-accent media-hover:hover:text-sidebar-foreground media-hover:group-hover:opacity-100",
"media-hover:hover:text-sidebar-foreground media-hover:group-hover:opacity-100",
"focus-visible:opacity-100 data-[state=open]:opacity-100",
)}
aria-label={t("chat.actions", { title })}
@@ -1190,7 +1190,7 @@ export const ChatList = memo(function ChatList({
aria-label={t("chat.cancelSelection", {
defaultValue: "Cancel selection",
})}
className="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sidebar-muted-foreground transition-colors media-hover:hover:bg-accent/60 media-hover:hover:text-foreground"
className="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sidebar-muted-foreground transition-colors media-hover:hover:text-foreground"
>
<X className="h-4 w-4" aria-hidden />
</button>
@@ -1275,10 +1275,10 @@ function WorkbenchTabHeader({
onClick={onToggle}
className={cn(
"relative inline-flex h-6 w-3.5 shrink-0 items-center justify-center rounded-md before:absolute before:-inset-x-1 before:inset-y-0",
"text-sidebar-muted-foreground transition-[background-color,color,transform] duration-150 ease-out",
"media-hover:hover:bg-sidebar-accent media-hover:hover:text-sidebar-foreground active:scale-[0.96]",
"text-sidebar-muted-foreground transition-[color] duration-150 ease-out",
"media-hover:hover:text-sidebar-foreground",
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",
"motion-reduce:transition-none motion-reduce:active:scale-100",
"motion-reduce:transition-none ",
)}
>
<ChevronDown
@@ -1327,7 +1327,7 @@ function WorkbenchTabHeader({
className={cn(
"sidebar-action-trigger touch-target inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md",
"text-sidebar-muted-foreground opacity-0 transition-opacity",
"media-hover:hover:bg-sidebar-accent media-hover:hover:text-sidebar-foreground media-hover:group-hover/tab:opacity-100",
"media-hover:hover:text-sidebar-foreground media-hover:group-hover/tab:opacity-100",
"focus-visible:opacity-100 data-[state=open]:opacity-100",
)}
aria-label={t("chat.actions", { title })}
@@ -1519,7 +1519,7 @@ function ActivePaneRows({
<DropdownMenuTrigger
className={cn(
"sidebar-action-trigger touch-target inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-sidebar-muted-foreground opacity-0 transition-opacity",
"media-hover:hover:bg-sidebar-accent media-hover:hover:text-sidebar-foreground media-hover:group-hover/pane:opacity-100",
"media-hover:hover:text-sidebar-foreground media-hover:group-hover/pane:opacity-100",
"focus-visible:opacity-100 data-[state=open]:opacity-100",
)}
aria-label={paneActionsLabel}
@@ -1706,7 +1706,7 @@ function TemporaryChatSection({
type="button"
aria-label={t("temporaryChat.closeAction", { title })}
onClick={() => onClose(session.key)}
className="inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-sidebar-muted-foreground transition-colors media-hover:hover:bg-destructive/10 media-hover:hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60"
className="inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-sidebar-muted-foreground transition-colors media-hover:hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60"
>
<X className="h-3.5 w-3.5" aria-hidden />
</button>
@@ -1776,10 +1776,10 @@ function ProjectGroupHeader({
onClick={onToggle}
className={cn(
"relative inline-flex h-6 w-3.5 shrink-0 items-center justify-center rounded-md before:absolute before:-inset-x-1 before:inset-y-0",
"text-sidebar-muted-foreground transition-[background-color,color,transform] duration-150 ease-out",
"media-hover:hover:bg-sidebar-accent media-hover:hover:text-sidebar-foreground active:scale-[0.96]",
"text-sidebar-muted-foreground transition-[color] duration-150 ease-out",
"media-hover:hover:text-sidebar-foreground",
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",
"motion-reduce:transition-none motion-reduce:active:scale-100",
"motion-reduce:transition-none ",
)}
>
<ChevronDown
@@ -1814,7 +1814,7 @@ function ProjectGroupHeader({
<DropdownMenuTrigger
className={cn(
"sidebar-action-trigger touch-target inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-sidebar-muted-foreground opacity-0 transition-opacity",
"media-hover:hover:bg-sidebar-accent media-hover:hover:text-sidebar-foreground media-hover:group-hover:opacity-100 focus-visible:opacity-100",
"media-hover:hover:text-sidebar-foreground media-hover:group-hover:opacity-100 focus-visible:opacity-100",
"data-[state=open]:opacity-100",
)}
aria-label={t("chat.actions", { title: label })}
+1 -1
View File
@@ -317,7 +317,7 @@ export const CodeBlock = memo(function CodeBlock({
onClick={onCopy}
className={cn(
"absolute right-2.5 top-2.5 z-10 inline-flex h-8 w-8 items-center justify-center rounded-full",
"text-muted-foreground/75 transition-colors hover:bg-background/70 hover:text-foreground",
"text-muted-foreground/75 transition-colors hover:text-foreground",
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",
)}
aria-label={copyLabel}
+2 -2
View File
@@ -143,7 +143,7 @@ export function ImageLightbox({
aria-label={t("lightbox.close")}
className={cn(
"touch-target absolute right-4 top-4 grid h-9 w-9 place-items-center rounded-full",
"bg-black/55 text-white/90 hover:bg-black/70 hover:text-white",
"bg-black/55 text-white/90 hover:text-white",
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/70",
"transition-colors motion-reduce:transition-none",
)}
@@ -178,7 +178,7 @@ function NavButton({ side, label, onClick }: NavButtonProps) {
aria-label={label}
className={cn(
"absolute top-1/2 -translate-y-1/2 grid h-11 w-11 place-items-center rounded-full",
"bg-black/55 text-white/90 hover:bg-black/70 hover:text-white",
"bg-black/55 text-white/90 hover:text-white",
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/70",
"transition-colors motion-reduce:transition-none",
side === "left" ? "left-4" : "right-4",
+5 -16
View File
@@ -7,17 +7,7 @@ import {
useState,
type ReactNode,
} from "react";
import {
Activity,
Check,
ChevronRight,
CircleAlert,
Clock3,
Copy,
Link2,
Quote,
Wrench,
} from "lucide-react";
import { Activity, Check, ChevronRight, CircleAlert, Clock3, Copy, Link2, Quote, Wrench } from "lucide-react";
import { useTranslation } from "react-i18next";
import { DisclosureContent } from "@/components/ui/disclosure";
@@ -139,7 +129,7 @@ export function MessageCopyButton({ message, className }: { message: UIMessage;
onClick={onCopy} aria-label={label}
className={cn(
"inline-flex h-[var(--message-block-control-size)] w-[var(--message-block-action-width)] items-center justify-center rounded-control",
"text-muted-foreground transition-[color,background-color,scale] hover:bg-muted/70 hover:text-foreground active:scale-[0.96]",
"text-muted-foreground transition-[color] hover:text-foreground",
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring motion-reduce:transform-none",
className,
)}>
@@ -219,8 +209,8 @@ export function MessageBlockMenuActions({
aria-label={t("message.forkFromHere")}
className={cn(
"inline-flex h-[var(--message-block-control-size)] w-[var(--message-block-action-width)] items-center justify-center rounded-control",
"text-muted-foreground transition-[color,background-color,scale]",
"hover:bg-muted/70 hover:text-foreground active:scale-[0.96]",
"text-muted-foreground transition-colors",
"hover:text-foreground",
"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",
@@ -256,8 +246,7 @@ export function MessageBlockMenuActions({
data-message-block-activity-icon
className={cn(
"inline-flex h-[var(--message-block-control-size)] w-[var(--message-block-action-width)] shrink-0 items-center justify-center rounded-control",
"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",
sheet && "w-3.5",
+2 -2
View File
@@ -51,7 +51,7 @@ export function PreviewPane({ tabs, activeId, width, isClosing, onSelect, onClos
? remaining[Math.min(index, remaining.length - 1)]?.id ?? null : activeId;
onCloseTab(tab.id);
};
const iconButton = "touch-target inline-flex size-8 shrink-0 items-center justify-center rounded-control text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
const iconButton = "touch-target inline-flex size-8 shrink-0 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";
return <aside aria-label={t("previewTabs.title")} data-testid="preview-pane" data-file-preview-panel
style={{
"--file-preview-width": `${width}px`,
@@ -100,7 +100,7 @@ export function PreviewPane({ tabs, activeId, width, isClosing, onSelect, onClos
</button>
<button type="button" tabIndex={selected ? 0 : -1} aria-label={t("previewTabs.closeTab", { name })} title={t("previewTabs.closeTab", { name })}
onClick={() => closeTab(tab, index)}
className={cn("touch-target preview-tab-close mr-1 inline-flex size-6 shrink-0 items-center justify-center rounded-compact text-muted-foreground transition-colors hover:bg-foreground/10 hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", !selected && "sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100")}>
className={cn("touch-target preview-tab-close mr-1 inline-flex size-6 shrink-0 items-center justify-center rounded-compact text-muted-foreground transition-colors hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", !selected && "sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100")}>
<X className="size-3" aria-hidden />
</button>
</div>;
+26 -26
View File
@@ -1,20 +1,21 @@
import {
ArchiveIcon,
SkillsIcon,
AutomationsIcon,
ChannelsIcon,
SearchIcon,
SettingsIcon,
NewChatIcon,
ComposeIcon,
AppsIcon,
} from "@/components/icons/product-icons";
import {
type ReactNode,
type RefObject,
useRef,
useState,
} from "react";
import {
Archive,
Brain,
CalendarClock,
MessageCircle,
PanelLeftClose,
Search,
Settings,
SquarePen,
Blocks,
} from "lucide-react";
import { PanelLeftClose } from "lucide-react";
import { useTranslation } from "react-i18next";
import {
@@ -125,11 +126,11 @@ export function Sidebar(props: SidebarProps) {
collapsed={collapsed}
label={t("sidebar.newChat")}
iconOnly
className={collapsed ? undefined : "rounded-full border border-border/70 bg-background/80 shadow-sm"}
className={collapsed ? undefined : "rounded-full border border-border/70 bg-background/80 shadow-sm settings-hover"}
onClick={props.onNewChat}
active={props.newChatActive}
selectionRef={collapsed ? activeActionRef : undefined}
icon={<SquarePen className="h-4 w-4" />}
icon={collapsed ? <NewChatIcon className="h-4 w-4" /> : <ComposeIcon className="h-4 w-4" />}
shortcut={sidebarShortcutLabel("newChat", apple)}
ariaKeyShortcuts={sidebarShortcutAria("newChat")}
/>
@@ -142,7 +143,7 @@ export function Sidebar(props: SidebarProps) {
ariaKeyShortcuts={sidebarShortcutAria("search")}
iconOnly
onClick={props.onOpenSearch}
icon={<Search className="h-4 w-4" />}
icon={<SearchIcon className="h-4 w-4" />}
/>
);
@@ -175,9 +176,7 @@ export function Sidebar(props: SidebarProps) {
className={cn(
"host-no-drag flex h-8 w-8 shrink-0 items-center justify-center rounded-xl transition-colors",
props.hostChromeInset && "mt-5",
collapsed
? "hover:bg-sidebar-accent/60"
: "pointer-events-none",
!collapsed && "pointer-events-none",
)}
>
<img
@@ -218,7 +217,7 @@ export function Sidebar(props: SidebarProps) {
onIntent={props.onSettingsIntent}
active={props.activeUtility === "apps"}
selectionRef={activeActionRef}
icon={<Blocks className="h-4 w-4" />}
icon={<AppsIcon className="h-4 w-4" />}
/>
<SidebarActionButton
collapsed={collapsed}
@@ -229,7 +228,7 @@ export function Sidebar(props: SidebarProps) {
onIntent={props.onSettingsIntent}
active={props.activeUtility === "skills"}
selectionRef={activeActionRef}
icon={<Brain className="h-4 w-4" />}
icon={<SkillsIcon className="h-4 w-4" />}
/>
<SidebarActionButton
collapsed={collapsed}
@@ -240,7 +239,7 @@ export function Sidebar(props: SidebarProps) {
onIntent={props.onSettingsIntent}
active={props.activeUtility === "automations"}
selectionRef={activeActionRef}
icon={<CalendarClock className="h-4 w-4" />}
icon={<AutomationsIcon className="h-4 w-4" />}
/>
<SidebarActionButton
collapsed={collapsed}
@@ -251,14 +250,14 @@ export function Sidebar(props: SidebarProps) {
onIntent={props.onSettingsIntent}
active={props.activeUtility === "channels"}
selectionRef={activeActionRef}
icon={<MessageCircle className="h-4 w-4" />}
icon={<ChannelsIcon className="h-4 w-4" />}
/>
{props.archivedCount ? (
<SidebarActionButton
collapsed={collapsed}
label={props.showArchived ? t("chat.hideArchived") : t("chat.showArchived")}
onClick={props.onToggleArchived}
icon={<Archive className="h-4 w-4" />}
icon={<ArchiveIcon className="h-4 w-4" />}
/>
) : null}
</SidebarSelectionHighlight>
@@ -329,8 +328,7 @@ export function Sidebar(props: SidebarProps) {
ariaKeyShortcuts={sidebarShortcutAria("settings")}
onClick={props.onOpenSettings}
onIntent={props.onSettingsIntent}
className="w-9"
icon={<Settings className="h-4 w-4" />}
icon={<SettingsIcon className="h-4 w-4" />}
/>
<HostSwitcher collapsed={collapsed} portalContainer={props.containActionMenus ? menuPortalContainer : undefined} />
</div>
@@ -370,7 +368,7 @@ function SidebarActionButton({
<Button
ref={active ? selectionRef : undefined}
type="button"
variant={null}
variant={compact ? "icon" : null}
aria-label={label}
aria-current={active ? "page" : undefined}
aria-keyshortcuts={ariaKeyShortcuts}
@@ -386,7 +384,9 @@ function SidebarActionButton({
: "w-full justify-start gap-2 px-2 text-[13px] leading-5 [&_svg]:h-[18px] [&_svg]:w-[18px] [&_svg]:stroke-[1.75]",
active
? "text-sidebar-accent-foreground"
: "text-sidebar-content settings-hover hover:text-sidebar-accent-foreground",
: compact
? "text-sidebar-content hover:text-sidebar-accent-foreground"
: "text-sidebar-content settings-hover hover:text-sidebar-accent-foreground",
className,
)}
>
@@ -15,11 +15,11 @@ interface SidebarSelectionHighlightProps extends HTMLAttributes<HTMLDivElement>
}
export const SIDEBAR_SELECTION_ITEM_CLASS =
"relative z-[1] transition-[color] duration-150 ease-out motion-reduce:transition-none";
"relative z-[1] transition-[color,background-color] duration-150 ease-out motion-reduce:transition-none";
// During a drag, animate only the shared highlight, not its measured target as well.
export const SIDEBAR_SELECTION_ACTION_ITEM_CLASS =
"relative z-[1] transition-[width,padding,color] [transition-duration:300ms,300ms,150ms] ease-out group-data-[resizing=true]/sidebar:transition-none motion-reduce:transition-none";
"relative z-[1] transition-[width,padding,color,background-color] [transition-duration:300ms,300ms,150ms,150ms] ease-out group-data-[resizing=true]/sidebar:transition-none motion-reduce:transition-none";
export function SidebarSelectionHighlight({
targetRef,
+1 -1
View File
@@ -15,7 +15,7 @@ export function WebPreviewPanel({ url: value }: WebPreviewPanelProps) {
const [revision, setRevision] = useState(0);
const url = parseWebLink(value);
const restriction = currentWebPreviewRestriction(url);
const buttonClass = "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
const buttonClass = "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
return (
<section aria-label={t("webPreview.title")} data-testid="web-preview-panel" className="flex min-h-0 flex-1 flex-col">
<div className="flex h-9 shrink-0 items-center gap-1 border-b border-border/40 px-2">
+2 -2
View File
@@ -89,7 +89,7 @@ export function ZoomableImage({ src, alt }: { src: string; alt: string }) {
if (event.currentTarget.hasPointerCapture(event.pointerId)) event.currentTarget.releasePointerCapture(event.pointerId);
setDragging(pointers.current.size > 0);
};
const buttonClass = "grid size-9 shrink-0 place-items-center rounded-full text-white/90 transition-colors hover:bg-white/10 hover:text-white disabled:opacity-30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/70";
const buttonClass = "grid size-9 shrink-0 place-items-center rounded-full text-white/90 transition-colors hover:text-white disabled:opacity-30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/70";
return <>
<div ref={viewport} data-testid="image-zoom-viewport" tabIndex={0} role="group" aria-label={t("lightbox.gestures")}
@@ -110,7 +110,7 @@ export function ZoomableImage({ src, alt }: { src: string; alt: string }) {
<div className="absolute bottom-[calc(1rem+env(safe-area-inset-bottom))] left-1/2 flex -translate-x-1/2 items-center gap-1 rounded-full bg-black/55 p-1 backdrop-blur-sm">
<button type="button" aria-label={t("lightbox.zoomOut")} title={t("lightbox.zoomOut")} disabled={view.scale <= 1} className={buttonClass} onClick={() => zoom(view.scale / 1.5)}><Minus className="size-4" aria-hidden /></button>
<button type="button" aria-label={t("lightbox.resetZoom")} title={t("lightbox.resetZoom")}
className="h-9 min-w-14 rounded-full px-2 text-xs font-medium tabular-nums text-white/90 hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/70" onClick={() => apply(FIT)}>
className="h-9 min-w-14 rounded-full px-2 text-xs font-medium tabular-nums text-white/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/70" onClick={() => apply(FIT)}>
{Math.round(view.scale * 100)}%
</button>
<button type="button" aria-label={t("lightbox.zoomIn")} title={t("lightbox.zoomIn")} disabled={view.scale >= MAX_SCALE} className={buttonClass} onClick={() => zoom(view.scale * 1.5)}><Plus className="size-4" aria-hidden /></button>
@@ -0,0 +1,80 @@
import { forwardRef, type ReactNode } from "react";
import type { LucideIcon, LucideProps } from "lucide-react";
function productIcon(name: string, drawing: ReactNode): LucideIcon {
const Icon = forwardRef<SVGSVGElement, LucideProps>(({ size = 24, color = "currentColor", strokeWidth = 1.75, absoluteStrokeWidth, className, children, ...props }, ref) => (
<svg ref={ref} xmlns="http://www.w3.org/2000/svg" width={size} height={size}
viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth={strokeWidth}
strokeLinecap="round" strokeLinejoin="round"
vectorEffect={absoluteStrokeWidth ? "non-scaling-stroke" : undefined}
aria-hidden="true" className={className} data-product-icon={name} {...props}>
{drawing}{children}
</svg>
));
Icon.displayName = name;
return Icon;
}
export const NewChatIcon = productIcon("new-chat", <><path d="M11 20H7l-4 2V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4v4" /><path d="M17 14v7m-3.5-3.5h7" /></>);
export const ComposeIcon = productIcon("compose", <g transform="scale(1.5)" fill="currentColor" stroke="none"><path fillRule="evenodd" clipRule="evenodd" d="M7.25 1C7.66414 1 7.99988 1.33589 8 1.75C8 2.16421 7.66421 2.5 7.25 2.5H4.75C3.50745 2.5 2.50012 3.50744 2.5 4.75V11.25C2.5 12.4926 3.50736 13.5 4.75 13.5H11.25C12.4926 13.5 13.5 12.4926 13.5 11.25V8.75C13.5001 8.33589 13.8359 8 14.25 8C14.6641 8 14.9999 8.33589 15 8.75V11.25C15 13.3211 13.3211 15 11.25 15H4.75C2.67893 15 1 13.3211 1 11.25V4.75C1.00012 2.67905 2.67899 1 4.75 1H7.25Z" /><path fillRule="evenodd" clipRule="evenodd" d="M13.4326 1.26953C13.7913 0.910937 14.3728 0.910883 14.7314 1.26953C15.0897 1.6282 15.0899 2.20981 14.7314 2.56836L9.2373 8.06152C8.68101 8.6177 7.94043 8.95161 7.15527 9C7.06754 9.0052 6.99468 8.93248 7 8.84473C7.04847 8.05961 7.38232 7.31897 7.93848 6.7627L13.4326 1.26953Z" /></g>);
export const ConversationIcon = productIcon("conversation", <><path d="M7 4h10a4 4 0 0 1 4 4v7a4 4 0 0 1-4 4H8l-5 3V8a4 4 0 0 1 4-4Z" /><path d="M7 9h10M7 13h6" /></>);
export const SearchIcon = productIcon("search", <><circle cx="10.5" cy="10.5" r="6.5" /><path d="m15.5 15.5 5 5" /></>);
export const AppsIcon = productIcon("apps", <><rect x="3.5" y="3.5" width="6.5" height="6.5" rx="1.75" /><rect x="14" y="3.5" width="6.5" height="6.5" rx="1.75" /><rect x="3.5" y="14" width="6.5" height="6.5" rx="1.75" /><rect x="14" y="14" width="6.5" height="6.5" rx="1.75" /></>);
export const SkillsIcon = productIcon("skills", <><path d="M5 18V6a3 3 0 0 1 3-3h11v14M5 18a3 3 0 0 1 3-3h11v6H8a3 3 0 0 1-3-3Z" /><path d="m9 7 2 2-2 2m5-4h2m-5 11h5" /></>);
export const AutomationsIcon = productIcon("automations", <><rect x="3" y="5" width="18" height="16" rx="3" /><path d="M7 3v4m10-4v4M3 10h18m-8 2-4 4h4l-2 4 5-5h-4l1-3Z" /></>);
export const ChannelsIcon = productIcon("channels", <><path d="M4 4h9a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H8l-4 3V6a2 2 0 0 1 0-2Z" /><path d="M15 8h3a3 3 0 0 1 3 3v6a2 2 0 0 1-2 2h-3l-3 2v-4" /><path d="M7 8h5" /></>);
export const ArchiveIcon = productIcon("archive", <><rect x="3" y="3.5" width="18" height="4.5" rx="1.5" /><path d="M4.5 8v11a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V8M9 12h6" /></>);
export const SettingsIcon = productIcon("settings", <><path d="M10 3h4l.6 2.4 2.1 1.2 2.4-.7 2 3.5-1.8 1.7v2.4l1.8 1.7-2 3.5-2.4-.7-2.1 1.2L14 21h-4l-.6-2.4-2.1-1.2-2.4.7-2-3.5 1.8-1.7v-2.4L2.9 9.4l2-3.5 2.4.7 2.1-1.2L10 3Z" /><circle cx="12" cy="12" r="3" /></>);
export const OverviewIcon = productIcon("overview", <><rect x="3" y="3" width="18" height="18" rx="3" /><path d="M3 9h18M9 9v12m4-4v-3m4 3v-5" /><path d="M6 6h.01" /></>);
export const AppearanceIcon = productIcon("appearance", <><path d="M12 3a9 9 0 0 0 0 18h1a2 2 0 0 0 1.3-3.5 1.7 1.7 0 0 1 1.2-3H18a3 3 0 0 0 3-3A9 9 0 0 0 12 3Z" /><circle cx="7.5" cy="10" r=".8" /><circle cx="11" cy="6.8" r=".8" /><circle cx="16" cy="8" r=".8" /></>);
export const ModelsIcon = productIcon("models", <><path d="m12 3 9 5-9 5-9-5 9-5Zm-9 9 9 5 9-5M3 16l9 5 9-5" /></>);
export const CapabilitiesIcon = productIcon("capabilities", <><path d="m12 8 4 4-4 4-4-4 4-4Zm0-5v5m0 8v5M3 12h5m8 0h5" /><path d="M7 3H5a2 2 0 0 0-2 2v2m14-4h2a2 2 0 0 1 2 2v2M3 17v2a2 2 0 0 0 2 2h2m10 0h2a2 2 0 0 0 2-2v-2" /></>);
export const SystemIcon = productIcon("system", <><rect x="3" y="3" width="18" height="7" rx="2" /><rect x="3" y="14" width="18" height="7" rx="2" /><path d="M7 6.5h.01m0 11h.01M12 6.5h5m-5 11h5" /></>);
export const AdvancedIcon = productIcon("advanced", <><path d="M3 6h5m4 0h9M3 12h11m4 0h3M3 18h2m4 0h12" /><circle cx="10" cy="6" r="2" /><circle cx="16" cy="12" r="2" /><circle cx="7" cy="18" r="2" /></>);
export const AboutIcon = productIcon("about", <><circle cx="12" cy="12" r="9" /><path d="M12 11v6m0-10h.01" /></>);
export const AttachIcon = productIcon("attach", <path d="M8.5 12.5 14 7a2.75 2.75 0 0 1 3.89 3.89l-7.43 7.43a4.25 4.25 0 0 1-6.01-6.01l7.43-7.43a5.75 5.75 0 0 1 8.13 8.13L12.5 20.5" />);
export const SendIcon = productIcon("send", <><path d="m4 5 17 7-17 7 3-7-3-7Z" /><path d="M7 12h14" /></>);
export const VoiceIcon = productIcon("voice", <><rect x="9" y="3" width="6" height="12" rx="3" /><path d="M6 11v1a6 6 0 0 0 12 0v-1M12 18v3m-3 0h6" /></>);
export const StopIcon = productIcon("stop", <rect x="5" y="5" width="14" height="14" rx="2.5" />);
export const RestrictedAccessIcon = productIcon("restricted-access", <><rect x="5" y="10" width="14" height="11" rx="2.5" /><path d="M8 10V7a4 4 0 0 1 8 0v3m-4 5v2" /></>);
export const FullAccessIcon = productIcon("full-access", <><rect x="5" y="10" width="14" height="11" rx="2.5" /><path d="M8 10V7a4 4 0 0 1 7.5-2M9 16h6m-2.5-2.5L15 16l-2.5 2.5" /></>);
export const WorkspaceIcon = productIcon("workspace", <><path d="M3 7a2 2 0 0 1 2-2h5l2 3h7a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z" /><path d="M8 13h8m-8 4h5" /></>);
export const PromptNavigationIcon = productIcon("prompt-navigation", <><path d="M5 5v14m4-14h11M9 12h11M9 19h7" /><circle cx="5" cy="5" r="1.5" fill="currentColor" stroke="none" /><circle cx="5" cy="12" r="1.5" fill="currentColor" stroke="none" /><circle cx="5" cy="19" r="1.5" fill="currentColor" stroke="none" /></>);
export const TemporaryChatIcon = productIcon("temporary-chat", <><path d="M7 4h10a4 4 0 0 1 4 4v7a4 4 0 0 1-4 4H8l-5 3V8a4 4 0 0 1 4-4Z" strokeDasharray="3 3" /><path d="M8 10h8m-8 4h4" /></>);
export const GoalIcon = productIcon("goal", <><circle cx="12" cy="12" r="9" /><circle cx="12" cy="12" r="5" /><circle cx="12" cy="12" r="1.25" fill="currentColor" stroke="none" /></>);
export const DelegationIcon = productIcon("delegation", <><rect x="8" y="3" width="8" height="5" rx="1.5" /><rect x="2" y="16" width="8" height="5" rx="1.5" /><rect x="14" y="16" width="8" height="5" rx="1.5" /><path d="M12 8v4M6 16v-4h12v4" /></>);
export const TaskInspectIcon = productIcon("task-inspect", <><rect x="3" y="3" width="13" height="18" rx="2" /><path d="M7 7h5M7 11h3" /><circle cx="16" cy="15" r="4" /><path d="m19 18 3 3" /></>);
export const TaskMessageIcon = productIcon("task-message", <><path d="M12 19H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4v4M7 8h10M7 12h4" /><path d="M14 17h7m-3-3 3 3-3 3" /></>);
export const QueuedTaskIcon = productIcon("task-queued", <><circle cx="12" cy="12" r="8.5" /><path d="M12 7v5l3 2" /></>);
export const RunningTaskIcon = productIcon("task-running", <><path d="M12 3a9 9 0 1 1-9 9" /><path d="M3 7v.01M6 4v.01" /></>);
export const StoppingTaskIcon = productIcon("task-stopping", <><path d="M12 3a9 9 0 1 1-9 9M3 7v.01M6 4v.01" /><rect x="9" y="9" width="6" height="6" rx="1" /></>);
export const CompletedTaskIcon = productIcon("task-completed", <><circle cx="12" cy="12" r="9" /><path d="m7.5 12 3 3 6-6" /></>);
export const CancelledTaskIcon = productIcon("task-cancelled", <><circle cx="12" cy="12" r="9" /><path d="m9 9 6 6m0-6-6 6" /></>);
export const IncompleteTaskIcon = productIcon("task-incomplete", <><path d="M12 3a9 9 0 0 1 9 9M12 21a9 9 0 0 1-9-9" /><path d="M3 8v.01M6 5v.01M8 3v.01M21 16v.01M18 19v.01M16 21v.01" /><path d="M12 8v4" /></>);
export const InterruptedTaskIcon = productIcon("task-interrupted", <><circle cx="12" cy="12" r="9" /><path d="M9 8v8m6-8v8" /></>);
export const ErrorTaskIcon = productIcon("task-error", <><circle cx="12" cy="12" r="9" /><path d="M12 7v6m0 4h.01" /></>);
export const ActivityIcon = productIcon("activity", <><circle cx="4" cy="10" r="2" /><circle cx="12" cy="10" r="2" /><circle cx="20" cy="10" r="2" /><path d="M6 10h4m4 0h4M3 17h3m4 0h4m4 0h3" /></>);
export const StatusIcon = productIcon("status", <><path d="M3 15a9 9 0 1 1 18 0M6 20h12m-6-5 4-5" /><circle cx="12" cy="15" r="1.5" /></>);
export const CompactIcon = productIcon("compact", <><path d="M7 10h10M7 14h10M12 2v5m-2-2 2 2 2-2M12 22v-5m-2 2 2-2 2 2" /></>);
export const ResumeIcon = productIcon("resume", <><path d="m9 5 11 7-11 7V5Z" /><path d="M4 6v12" /></>);
export const RestartIcon = productIcon("restart", <><path d="M20 8a8.5 8.5 0 1 0 0 8M20 3v5h-5" /></>);
export const UpdateIcon = productIcon("update", <><path d="M12 15V3m-4 4 4-4 4 4M4 13v6a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-6" /></>);
export const ImportIcon = productIcon("import", <><path d="M10 4h7l4 4v11a2 2 0 0 1-2 2h-9M17 4v5h4M3 13h11m-4-4 4 4-4 4" /></>);
export const AppActionsIcon = productIcon("app-actions", <><rect x="3" y="3" width="18" height="18" rx="3" /><path d="M3 8h18M7 5.5h.01M8 14h.01M12 14h.01M16 14h.01" /></>);
export const McpIcon = productIcon("mcp", <><path d="M8 3v5m8-5v5M5 8h14v3a7 7 0 0 1-14 0V8Zm7 10v3" /></>);
export const ToolRunIcon = productIcon("tool-run", <path d="M14 4a6 6 0 0 0-7 7L3.5 18a2 2 0 0 0 2.5 2.5l7-3.5a6 6 0 0 0 7-7l-4 4-5-1-1-5 4-4Z" />);
export const FileReadIcon = productIcon("file-read", <><path d="M13 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V10l-7-7Zm0 0v7h7M8 14h8m-8 3h5" /></>);
export const FileListIcon = productIcon("file-list", <><path d="M3 6a2 2 0 0 1 2-2h5l2 3h7a2 2 0 0 1 2 2v11H3V6Z" /><path d="M7 12h.01M10 12h7M7 16h.01M10 16h5" /></>);
export const MemoryIcon = productIcon("memory", <><rect x="5" y="3" width="15" height="18" rx="2" /><path d="M5 8H3m2 5H3m2 5H3M14 3v8l2-1.5 2 1.5V3M9 15h7m-7 3h4" /></>);
export const DreamIcon = productIcon("dream", <><path d="M14 4A8.5 8.5 0 1 0 20 15a8 8 0 0 1-6-11Z" /><path d="m18 3 1 3 3 1-3 1-1 3-1-3-3-1 3-1 1-3Z" /></>);
export const DreamLogIcon = productIcon("dream-log", <><rect x="4" y="3" width="16" height="18" rx="2" /><path d="M8 7h8m-8 5h8m-8 5h5" /></>);
export const RestoreMemoryIcon = productIcon("restore-memory", <><path d="M13 4h5a2 2 0 0 1 2 2v13a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-4M4 4v5h5M4 9a6 6 0 1 1 3 5" /></>);
export const PromptTemplateIcon = productIcon("prompt-template", <><rect x="4" y="3" width="16" height="18" rx="2" /><path d="m10 8-3 4 3 4m4-8 3 4-3 4" /></>);
export const TriggerIcon = productIcon("trigger", <path d="m13 2-9 12h7l-1 8 10-13h-7l0-7Z" />);
export const PairingIcon = productIcon("pairing", <><path d="m9 15-2 2a4 4 0 0 1-6-6l4-4a4 4 0 0 1 6 0m4 2 2-2a4 4 0 0 1 6 6l-4 4a4 4 0 0 1-6 0M8 16l8-8" /></>);
export const HelpIcon = productIcon("help", <><circle cx="12" cy="12" r="9" /><path d="M9 8a3 3 0 0 1 6 0c0 2-3 2-3 5m0 4h.01" /></>);
export const HistoryIcon = productIcon("history", <><path d="M4 9a8.5 8.5 0 1 1 0 7M4 4v5h5M12 7v5l3 2" /></>);
export const WebSearchIcon = productIcon("web-search", <><circle cx="10" cy="10" r="7" /><path d="M3 10h14M10 3a12 12 0 0 0 0 14 12 12 0 0 0 0-14" /><circle cx="17" cy="17" r="4" /><path d="m20 20 2 2" /></>);
export const ImageGenerationIcon = productIcon("image-generation", <><path d="M12 4H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5M4 16l5-5 8 9" /><circle cx="9" cy="8" r="1" /><path d="m18 2 1 4 3 1-3 1-1 4-1-4-3-1 3-1 1-4Z" /></>);
export const EditIcon = productIcon("edit", <><path d="m15 4 5 5M4 15l11-11a2 2 0 0 1 3 0l2 2a2 2 0 0 1 0 3L9 20l-6 1 1-6Z" /></>);
export const ProviderIcon = productIcon("provider", <><path d="M7 3h10l5 9-5 9H7L2 12l5-9Z" /><path d="M8 8h8v8H8V8Z" /></>);
@@ -11,7 +11,7 @@ export function HostConnectionStatus({ state, compact = false }: {
}) {
const { t } = useTranslation();
const label = t(`connection.${state}`);
return <span role="status" title={label} className="inline-flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground">
return <span role="status" title={compact ? label : undefined} className="inline-flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground">
{state === "connecting" ? <Loader2 aria-hidden className="h-3.5 w-3.5 animate-spin motion-reduce:animate-none" />
: state === "error" ? <CircleAlert aria-hidden className="h-3.5 w-3.5 text-amber-600 dark:text-amber-400" />
: <span aria-hidden className={cn("h-1.5 w-1.5 rounded-full", state === "open" ? "bg-emerald-500" : "bg-muted-foreground/40")} />}
+9 -5
View File
@@ -2,6 +2,7 @@ import { createContext, useContext, useEffect, useRef, useState } from "react";
import { Check, ChevronUp, CircleAlert, Laptop, Loader2, Search, Server, Settings2, X } from "lucide-react";
import { useTranslation } from "react-i18next";
import { Button } from "@/components/ui/button";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
import { ConnectionBadge } from "@/components/ConnectionBadge";
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
import { useClient } from "@/providers/ClientProvider";
@@ -147,9 +148,9 @@ export function HostSwitcher({ collapsed = false, portalContainer }: { collapsed
const identity = picker.name === picker.hostname ? picker.name : `${picker.name} · ${picker.hostname}`;
const current = `${identity} · ${currentLabel}`;
const detail = pendingName ? `${current} · ${t("remote.preparing", { name: pendingName })}` : current;
const title = picker.error ? `${detail} — ${picker.error}` : detail;
const button = <Button ref={buttonRef} variant="ghost" size="sm" aria-label={t("remote.switchHost")} title={title}
data-host-switcher className={cn("host-no-drag h-8 min-w-0 gap-2 rounded-xl px-2 text-xs font-normal text-sidebar-content/75 hover:bg-sidebar-accent/65 hover:text-sidebar-content",
const hint = picker.error ? `${detail} — ${picker.error}` : detail;
const button = <Button ref={buttonRef} variant="ghost" size="sm" aria-label={t("remote.switchHost")}
data-host-switcher className={cn("host-no-drag touch-target h-8 min-w-0 gap-2 rounded-xl px-2 text-xs font-normal text-sidebar-content/75 hover:text-sidebar-content",
collapsed ? "w-8 justify-center px-0" : "max-w-full flex-1 justify-start")}
onClick={picker.kind === "embedded" ? () => {
const rect = buttonRef.current?.getBoundingClientRect();
@@ -163,9 +164,12 @@ export function HostSwitcher({ collapsed = false, portalContainer }: { collapsed
{!collapsed && <><span className="truncate">{label}</span><ChevronUp className="ml-auto h-3 w-3 shrink-0 opacity-60" /></>}
<span className="sr-only" role="status">{detail}</span>
</Button>;
if (!shell) return button;
const trigger = <TooltipTrigger asChild>{button}</TooltipTrigger>;
// The mobile sidebar already owns the modal lock; a nested lock can outlive it on navigation.
return <DropdownMenu modal={!portalContainer}><DropdownMenuTrigger asChild>{button}</DropdownMenuTrigger><HostMenuContent picker={shell} portalContainer={portalContainer} /></DropdownMenu>;
return <TooltipProvider><Tooltip>
{shell ? <DropdownMenu modal={!portalContainer}><DropdownMenuTrigger asChild>{trigger}</DropdownMenuTrigger><HostMenuContent picker={shell} portalContainer={portalContainer} /></DropdownMenu> : trigger}
<TooltipContent side="top">{hint}</TooltipContent>
</Tooltip></TooltipProvider>;
}
/** Parent-owned menu anchored to the active remote sidebar, never inside its DOM. */
@@ -510,7 +510,7 @@ export function RemoteConnectionsPage({ mainNavigationExpanded = false, hostChro
{busy.startsWith("pick-") && <p role="status" className="text-xs text-muted-foreground">{t("remote.setup.pickingFile")}</p>}
<div className="remote-dialog-actions">
<Button type="button" variant="ghost" onClick={closeEditor}>{t("common.cancel")}</Button>
<Button type="submit" className="min-w-0" title={t(editorLabel)} aria-label={t(editorLabel)} aria-busy={!!busy} disabled={!!busy || !form.host.trim() || (locationStep && !form.config_path.trim())}>
<Button type="submit" className="min-w-0" aria-label={t(editorLabel)} aria-busy={!!busy} disabled={!!busy || !form.host.trim() || (locationStep && !form.config_path.trim())}>
{busy && !busy.startsWith("pick-") && <Loader2 aria-hidden className="mr-2 h-4 w-4 shrink-0 animate-spin motion-reduce:animate-none" />}
<span role={busy && !busy.startsWith("pick-") ? "status" : undefined} className="min-w-0">{t(editorLabel)}</span>
</Button>
@@ -1,21 +1,16 @@
import {
OverviewIcon,
AboutIcon,
RestartIcon,
CapabilitiesIcon,
AppearanceIcon,
SystemIcon,
AdvancedIcon,
ModelsIcon,
} from "@/components/icons/product-icons";
import { useContext, useRef, useState } from "react";
import { HostNavigationContext, HostSwitcher } from "@/components/remote/HostSwitcher";
import {
Activity,
Info,
Check,
ChevronDown,
ChevronLeft,
LogOut,
Loader2,
RotateCcw,
Blocks,
Palette,
Server,
ShieldCheck,
SlidersHorizontal,
type LucideIcon,
} from "lucide-react";
import { Check, ChevronDown, ChevronLeft, LogOut, Loader2, type LucideIcon } from "lucide-react";
import { useTranslation } from "react-i18next";
import {
@@ -35,13 +30,13 @@ import { useMediaQuery } from "@/hooks/useMediaQuery";
import { cn } from "@/lib/utils";
const SETTINGS_NAV_ITEMS: Array<{ key: SettingsSectionKey; icon: LucideIcon; fallback: string }> = [
{ key: "overview", icon: Activity, fallback: "Overview" },
{ key: "appearance", icon: Palette, fallback: "Appearance" },
{ key: "models", icon: SlidersHorizontal, fallback: "Models" },
{ key: "capabilities", icon: Blocks, fallback: "Capabilities" },
{ key: "runtime", icon: Server, fallback: "System" },
{ key: "advanced", icon: ShieldCheck, fallback: "Advanced" },
{ key: "about", icon: Info, fallback: "About" },
{ key: "overview", icon: OverviewIcon, fallback: "Overview" },
{ key: "appearance", icon: AppearanceIcon, fallback: "Appearance" },
{ key: "models", icon: ModelsIcon, fallback: "Models" },
{ key: "capabilities", icon: CapabilitiesIcon, fallback: "Capabilities" },
{ key: "runtime", icon: SystemIcon, fallback: "System" },
{ key: "advanced", icon: AdvancedIcon, fallback: "Advanced" },
{ key: "about", icon: AboutIcon, fallback: "About" },
];
export function standaloneSectionTitle(section: SettingsSectionKey): string {
@@ -107,7 +102,7 @@ export function SettingsSidebar(props: SettingsSidebarProps) {
onClick={onBackToChat}
aria-label={t("settings.backToChat")}
className={cn(
"touch-target mb-2 inline-flex h-9 w-9 items-center justify-center rounded-full text-[13px] leading-5 font-normal text-sidebar-content transition-colors settings-hover hover:text-foreground lg:mb-3",
"touch-target mb-2 inline-flex h-9 w-9 items-center justify-center rounded-xl text-[13px] leading-5 font-normal text-sidebar-content transition-colors duration-150 motion-reduce:transition-none focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-ring hover:text-foreground lg:mb-3",
hostChromeInset && "-ml-1",
)}
>
@@ -171,7 +166,7 @@ export function SettingsSidebar(props: SettingsSidebarProps) {
: "text-sidebar-content hover:text-foreground")}
>
{isRestarting ? <Loader2 className="h-4 w-4 animate-spin" aria-hidden />
: <RotateCcw className="h-4 w-4" aria-hidden />}
: <RestartIcon className="h-4 w-4" aria-hidden />}
<span>{restartLabel}</span>
</Button>
</div>
@@ -217,7 +212,7 @@ function MobileSettingsNavigation({
? "text-orange-600 hover:text-orange-700 dark:text-orange-400 dark:hover:text-orange-300"
: "text-muted-foreground hover:text-foreground";
const restartIcon = isRestarting ? <Loader2 className="h-4 w-4 animate-spin" aria-hidden />
: <RotateCcw className="h-4 w-4" aria-hidden />;
: <RestartIcon className="h-4 w-4" aria-hidden />;
const restartAction = onRestart ? (
<Button type="button" variant="ghost" disabled={isRestarting}
onClick={restart}
@@ -233,9 +228,9 @@ function MobileSettingsNavigation({
hostChromeInset ? "pt-10" : "pt-[env(safe-area-inset-top)]")}
>
<div className="grid h-14 grid-cols-[2.75rem_minmax(0,1fr)_2.75rem] items-center px-3">
<Button type="button" variant="ghost" onClick={onBackToChat}
<Button size="icon" type="button" variant="ghost" onClick={onBackToChat}
aria-label={t("settings.backToChat")}
className="h-11 w-11 rounded-full p-0 text-sidebar-content"
className="h-11 w-11 rounded-xl p-0 text-sidebar-content"
>
<ChevronLeft className="h-5 w-5" aria-hidden />
</Button>
@@ -651,7 +651,7 @@ function RequirementsSection({
})}
title={option.label}
onClick={() => void copyCommand(option.command)}
className="flex h-9 w-9 shrink-0 items-center justify-center rounded-control text-muted-foreground transition-colors settings-hover hover:text-foreground sm:h-7 sm:w-7"
className="flex h-9 w-9 shrink-0 items-center justify-center rounded-control text-muted-foreground transition-colors hover:text-foreground sm:h-7 sm:w-7"
>
{copiedCommand === option.command ? (
<Check className="h-3.5 w-3.5 text-emerald-600" aria-hidden />
@@ -519,7 +519,7 @@ function MarketplaceSkillRow({
provider: providerLabel(skill.provider),
defaultValue: "Open {{name}} on {{provider}}",
})}
className="inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors settings-hover hover:text-foreground"
className="inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:text-foreground"
>
<ExternalLink className="h-3.5 w-3.5" aria-hidden />
</a>
@@ -554,7 +554,7 @@ function MarketplaceSkillRow({
disabled={installed || installBusy || !skill.install_supported}
onClick={() => onSelect(skill)}
className={cn(
"h-9 w-9 shrink-0 rounded-full bg-muted/70 text-muted-foreground transition-[opacity,color,background-color,transform] hover:scale-[1.03] hover:bg-foreground hover:text-background focus-visible:bg-foreground focus-visible:text-background focus-visible:opacity-100 sm:opacity-[0.55] sm:group-hover:opacity-100",
"h-9 w-9 shrink-0 rounded-full bg-muted/70 text-muted-foreground transition-[opacity,color] hover:text-foreground focus-visible:bg-foreground focus-visible:text-background focus-visible:opacity-100 sm:opacity-[0.55] sm:group-hover:opacity-100",
installed &&
"bg-emerald-500/10 text-emerald-700 disabled:opacity-100 dark:text-emerald-300",
)}
@@ -198,7 +198,7 @@ export function WebSettings({
aria-label={
keyVisible ? t("settings.byok.hideApiKey") : t("settings.byok.showApiKey")
}
className="absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 rounded-full text-muted-foreground settings-hover hover:text-foreground"
className="absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 rounded-full text-muted-foreground hover:text-foreground"
>
{keyVisible ? (
<EyeOff className="h-3.5 w-3.5" aria-hidden />
@@ -218,7 +218,7 @@ export function WebSettings({
size="icon"
onClick={onToggleKeyEditing}
aria-label={t("settings.actions.edit")}
className="absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 rounded-full text-muted-foreground settings-hover hover:text-foreground"
className="absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 rounded-full text-muted-foreground hover:text-foreground"
>
<Pencil className="h-3.5 w-3.5" aria-hidden />
</Button>
@@ -98,7 +98,7 @@ export function ChannelCatalogRow({
{!feature.installed ? (
<Button ref={installButtonRef} type="button" variant="outline" size="icon"
className={cn(
"h-[22px] w-[38px] min-w-0 shrink-0 rounded-full border-border/70 bg-background p-0 shadow-sm settings-hover active:scale-[0.96]",
"h-[22px] w-[38px] min-w-0 shrink-0 rounded-full border-border/70 bg-background p-0",
installHint && "border-[#2997FF]/60 bg-[#2997FF]/10 text-[#087FE7] ring-2 ring-[#2997FF]/25 ring-offset-2",
)}
disabled={actionsDisabled || anyActionBusy || !feature.install_supported}
@@ -27,7 +27,7 @@ export function ChannelHelpMenu({ feature, chatAppsDocsUrl }: {
<TooltipTrigger asChild>
<DropdownMenuTrigger asChild>
<button type="button" aria-label={label}
className="grid h-8 w-8 place-items-center rounded-full text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring">
className="grid h-8 w-8 place-items-center rounded-full text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring">
<CircleHelp className="h-4 w-4" aria-hidden />
</button>
</DropdownMenuTrigger>
@@ -240,7 +240,7 @@ export function CredentialForm({
}
onClick={() => onToggleSecret(field.key)}
disabled={disabled}
className="absolute right-0 top-1/2 grid h-10 w-10 -translate-y-1/2 place-items-center rounded-full text-muted-foreground hover:bg-background hover:text-foreground sm:right-1 sm:h-8 sm:w-8"
className="absolute right-0 top-1/2 grid h-10 w-10 -translate-y-1/2 place-items-center rounded-full text-muted-foreground hover:text-foreground sm:right-1 sm:h-8 sm:w-8"
>
{visible ? (
<EyeOff className="h-3.5 w-3.5" aria-hidden />
@@ -992,7 +992,7 @@ export function ProvidersSettings({
? t("settings.byok.hideApiKey")
: t("settings.byok.showApiKey")
}
className="absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 rounded-full text-muted-foreground settings-hover hover:text-foreground"
className="absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 rounded-full text-muted-foreground hover:text-foreground"
>
{keyVisible ? (
<EyeOff className="h-3.5 w-3.5" aria-hidden />
@@ -1012,7 +1012,7 @@ export function ProvidersSettings({
size="icon"
onClick={() => onToggleProviderKeyEditing(provider.name)}
aria-label={t("settings.actions.edit")}
className="absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 rounded-full text-muted-foreground settings-hover hover:text-foreground"
className="absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 rounded-full text-muted-foreground hover:text-foreground"
>
<Pencil className="h-3.5 w-3.5" aria-hidden />
</Button>
@@ -1168,7 +1168,7 @@ export function ProvidersSettings({
? t("settings.byok.hideApiKey")
: t("settings.byok.showApiKey")
}
className="absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 rounded-full text-muted-foreground settings-hover hover:text-foreground"
className="absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 rounded-full text-muted-foreground hover:text-foreground"
>
{customProviderKeyVisible ? (
<EyeOff className="h-3.5 w-3.5" aria-hidden />
@@ -1,17 +1,19 @@
import {
ModelsIcon,
WebSearchIcon,
ImageGenerationIcon,
VoiceIcon,
} from "@/components/icons/product-icons";
import { useState, type Dispatch, type SetStateAction } from "react";
import {
ArrowUpCircle,
Bot,
BookOpen,
MessageCircle,
Check,
ChevronRight,
ExternalLink,
Globe2,
Github,
ImageIcon,
Loader2,
Mic,
type LucideIcon,
} from "lucide-react";
import { useTranslation } from "react-i18next";
@@ -90,7 +92,7 @@ export function OverviewSettings({
<SettingsSectionTitle>{tx("settings.sections.ai", "AI")}</SettingsSectionTitle>
<SettingsGroup>
<OverviewListRow
icon={Bot}
icon={ModelsIcon}
valueLogoProvider={activeProvider}
title={tx("settings.overview.model", "Current model")}
value={activeModelValue}
@@ -105,7 +107,7 @@ export function OverviewSettings({
<SettingsSectionTitle>{tx("settings.sections.capabilities", "Capabilities")}</SettingsSectionTitle>
<SettingsGroup>
<OverviewListRow
icon={Globe2}
icon={WebSearchIcon}
valueLogoProvider={settings.web_search.provider}
title={tx("settings.overview.webSearch", "Web search")}
value={webStatus}
@@ -113,7 +115,7 @@ export function OverviewSettings({
onClick={() => onSelectSection("browser")}
/>
<OverviewListRow
icon={ImageIcon}
icon={ImageGenerationIcon}
valueLogoProvider={settings.image_generation.provider}
title={tx("settings.overview.imageGeneration", "Image generation")}
value={imageStatus}
@@ -121,7 +123,7 @@ export function OverviewSettings({
onClick={() => onSelectSection("image")}
/>
<OverviewListRow
icon={Mic}
icon={VoiceIcon}
valueLogoProvider={transcription.provider}
title={tx("settings.overview.voiceInput", "Voice input")}
value={voiceStatus}
@@ -413,7 +415,7 @@ function OverviewRowIcon({
icon: LucideIcon;
}) {
return (
<span className="grid h-9 w-9 shrink-0 place-items-center rounded-control bg-muted text-foreground/82 transition-colors group-hover:bg-muted/80 dark:bg-muted/70">
<span className="grid h-9 w-9 shrink-0 place-items-center rounded-control bg-muted text-foreground/82 transition-colors dark:bg-muted/70">
<Icon className="h-4 w-4" aria-hidden />
</span>
);
@@ -145,8 +145,8 @@ export function DismissibleStatusMessage({
className={cn(
"flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-colors",
isError
? "text-destructive/70 hover:bg-destructive/10 hover:text-destructive"
: "text-muted-foreground/70 settings-hover hover:text-foreground",
? "text-destructive/70 hover:text-destructive"
: "text-muted-foreground/70 hover:text-foreground",
)}
>
<X className="h-3.5 w-3.5" aria-hidden />
@@ -43,7 +43,7 @@ export function SettingsTextEditor({ id, title, description, value, placeholder,
}}>
<TooltipProvider><Tooltip>
<TooltipTrigger asChild><DialogTrigger asChild>
<Button id={id} type="button" variant="ghost" disabled={disabled} aria-label={title}
<Button size="icon" id={id} type="button" variant="ghost" disabled={disabled} aria-label={title}
className="ml-auto flex h-9 w-9 shrink-0 rounded-full p-0 text-muted-foreground">
<SquarePen className="h-4 w-4" aria-hidden />
</Button>
@@ -1,3 +1,9 @@
import {
ImportIcon,
UpdateIcon,
McpIcon,
AppActionsIcon,
} from "@/components/icons/product-icons";
import {
forwardRef,
useEffect,
@@ -14,16 +20,12 @@ import {
ChevronDown,
ChevronRight,
Clipboard,
Database,
ExternalLink,
Loader2,
PauseCircle,
PlayCircle,
Plus,
RotateCcw,
Search,
Server,
SlidersHorizontal,
TriangleAlert,
Trash2,
} from "lucide-react";
@@ -440,7 +442,7 @@ function CliAppsCatalogRow({
disabled={busy}
tone="installed"
>
<Check className="h-4 w-4" aria-hidden />
<AppActionsIcon className="h-4 w-4" aria-hidden />
</AppsActionButton>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
@@ -449,7 +451,7 @@ function CliAppsCatalogRow({
{tx("settings.cliApps.test", "Test CLI")}
</DropdownMenuItem>
<DropdownMenuItem disabled={busy} onClick={() => onAction("update", app.name)}>
<RotateCcw aria-hidden />
<UpdateIcon aria-hidden />
{tx("settings.cliApps.update", "Update CLI")}
</DropdownMenuItem>
<DropdownMenuItem
@@ -674,7 +676,7 @@ function McpAppsCatalogRow({
disabled={anotherOAuthBusy}
onClick={() => openManagement("connection")}
>
<SlidersHorizontal className="h-4 w-4" aria-hidden />
<AppActionsIcon className="h-4 w-4" aria-hidden />
</AppsActionButton>
) : readyInstalled ? (
toggleable ? (
@@ -687,7 +689,7 @@ function McpAppsCatalogRow({
disabled={busy}
tone="installed"
>
<Check className="h-4 w-4" aria-hidden />
<AppActionsIcon className="h-4 w-4" aria-hidden />
</AppsActionButton>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
@@ -712,7 +714,7 @@ function McpAppsCatalogRow({
tone={runtimeConnected ? "installed" : "default"}
onClick={() => openManagement("overview")}
>
<Check className="h-4 w-4" aria-hidden />
<AppActionsIcon className="h-4 w-4" aria-hidden />
</AppsActionButton>
)
) : preset.enabled === false ? (
@@ -927,18 +929,18 @@ const AppsActionButton = forwardRef<HTMLButtonElement, AppsActionButtonProps>(
ref={ref}
type="button"
size={visibleLabel ? "sm" : "icon"}
variant="ghost"
variant={visibleLabel ? "ghost" : "icon"}
aria-label={ariaLabel}
title={ariaLabel}
title={visibleLabel ? undefined : ariaLabel}
disabled={disabled || busy}
className={cn(
"rounded-full text-muted-foreground transition-colors",
visibleLabel
? "h-8 w-auto gap-1.5 px-3 text-[12px] font-semibold"
: "h-9 w-9",
tone === "installed" && "bg-transparent settings-hover hover:text-foreground",
tone === "danger" && "bg-transparent hover:bg-destructive/10 hover:text-destructive",
tone === "default" && "bg-muted/70 settings-hover hover:text-foreground",
tone === "installed" && "bg-transparent hover:text-foreground",
tone === "danger" && "bg-transparent hover:text-destructive",
tone === "default" && "bg-muted/70 hover:text-foreground",
className,
)}
>
@@ -1038,7 +1040,7 @@ function McpCustomServerPanel({
<div className="flex flex-col gap-3 px-3 py-3 sm:flex-row sm:items-center sm:justify-between">
<div className="flex min-w-0 items-center gap-3">
<span className="grid h-9 w-9 shrink-0 place-items-center rounded-control bg-muted text-muted-foreground">
<Server className="h-4 w-4" aria-hidden />
<McpIcon className="h-4 w-4" aria-hidden />
</span>
<div className="min-w-0">
<h3 className="text-[13px] font-semibold leading-5 text-foreground">
@@ -1060,7 +1062,7 @@ function McpCustomServerPanel({
onClick={() => setActiveMode((mode) => (mode === "custom" ? null : "custom"))}
className="h-8 rounded-full px-3 text-[12px] font-semibold"
>
<Server className="mr-1.5 h-3.5 w-3.5" aria-hidden />
<McpIcon className="mr-1.5 h-3.5 w-3.5" aria-hidden />
{tx("settings.mcp.customAction", "Custom")}
</Button>
<Button
@@ -1070,7 +1072,7 @@ function McpCustomServerPanel({
onClick={() => setActiveMode((mode) => (mode === "import" ? null : "import"))}
className="h-8 rounded-full px-3 text-[12px] font-semibold"
>
<Database className="mr-1.5 h-3.5 w-3.5" aria-hidden />
<ImportIcon className="mr-1.5 h-3.5 w-3.5" aria-hidden />
{tx("settings.mcp.importAction", "Import")}
</Button>
</div>
@@ -1275,7 +1277,7 @@ function McpCustomServerPanel({
disabled={!configImport.trim() || importBusy}
className="h-9 shrink-0 rounded-full px-4 text-[12.5px] font-semibold"
>
{importBusy ? <Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" aria-hidden /> : <Database className="mr-1.5 h-3.5 w-3.5" aria-hidden />}
{importBusy ? <Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" aria-hidden /> : <ImportIcon className="mr-1.5 h-3.5 w-3.5" aria-hidden />}
{tx("settings.mcp.importConfig", "Import")}
</Button>
</div>
@@ -187,7 +187,7 @@ export function AutomationsSettings({
const filters = visibleJobs.length ? (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="ghost" size="sm" aria-label={filterLabel} title={filterLabel}
<Button variant="ghost" size="sm" aria-label={filterLabel} title={filter === "all" ? filterLabel : undefined}
className={cn("h-8 text-[12px]", filter === "all" ? "w-8 p-0 text-muted-foreground" : "gap-1.5 bg-background text-foreground")}>
<ListFilter className="h-4 w-4" strokeWidth={1.5} aria-hidden />
{filter !== "all" ? filterLabel : null}
@@ -168,7 +168,7 @@ export function ChannelsSettings({
<div className="relative">
<div className="absolute end-6 top-6 z-10 flex h-10 items-center gap-1">
{selectedChannel ? <ChannelHelpMenu feature={selectedChannel} chatAppsDocsUrl={chatAppsDocsUrl} /> : null}
<DialogClose className="grid h-8 w-8 place-items-center rounded-full text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring">
<DialogClose className="grid h-8 w-8 place-items-center rounded-full text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring">
<X className="h-4 w-4" aria-hidden />
<span className="sr-only">{t("common.close")}</span>
</DialogClose>
@@ -1,15 +1,8 @@
import { useEffect, useMemo, useRef, useState, type ReactNode } from "react";
import {
Check,
ExternalLink,
Loader2,
RotateCcw,
Search,
Server,
SlidersHorizontal,
Trash2,
X,
} from "lucide-react";
AppActionsIcon,
} from "@/components/icons/product-icons";
import { useEffect, useMemo, useRef, useState, type ReactNode } from "react";
import { Check, ExternalLink, Loader2, RotateCcw, Search, Server, Trash2, X } from "lucide-react";
import { useTranslation } from "react-i18next";
import { Button } from "@/components/ui/button";
@@ -383,7 +376,7 @@ function ToolsPanel({
{testBusy ? (
<Loader2 className="h-4 w-4 animate-spin motion-reduce:animate-none" aria-hidden />
) : (
<SlidersHorizontal className="h-4 w-4" aria-hidden />
<AppActionsIcon className="h-4 w-4" aria-hidden />
)}
</div>
<p
@@ -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>
+25 -9
View File
@@ -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>
+81 -58
View File
@@ -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",
)}
>
+8 -6
View File
@@ -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",
)}
+34 -103
View File
@@ -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}
+10 -3
View File
@@ -5,7 +5,7 @@ import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "@/lib/utils";
const buttonVariants = cva(
"inline-flex items-center justify-center whitespace-nowrap rounded-control text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
"inline-flex items-center justify-center whitespace-nowrap rounded-control text-sm font-medium ring-offset-background transition-colors duration-150 motion-reduce:transition-none focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
{
variants: {
variant: {
@@ -16,7 +16,8 @@ const buttonVariants = cva(
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
secondary:
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
ghost: "quiet-control hover:text-accent-foreground",
icon: "icon-action relative hover:text-foreground active:text-foreground",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
@@ -42,9 +43,15 @@ interface ButtonProps
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button";
const iconOnly = size === "icon";
const resolvedVariant = iconOnly && variant === "ghost" ? "icon" : variant;
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
className={cn(
buttonVariants({ variant: resolvedVariant, size }),
iconOnly && variant === "outline" && "hover:bg-background",
className,
)}
ref={ref}
{...props}
/>
+1 -1
View File
@@ -130,7 +130,7 @@ const DialogContent = React.forwardRef<
{children}
</FloatingPortalContext.Provider>
{showCloseButton ? (
<DialogPrimitive.Close className={cn("absolute right-2.5 top-2.5 grid place-items-center rounded-full text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground active:bg-muted/80 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none", placement === "bottom" ? "h-11 w-11" : "h-7 w-7")}>
<DialogPrimitive.Close className={cn("absolute right-2.5 top-2.5 grid place-items-center rounded-full text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none", placement === "bottom" ? "h-11 w-11" : "h-7 w-7")}>
<X className="h-4 w-4" />
<span className="sr-only">{t("common.close")}</span>
</DialogPrimitive.Close>
@@ -183,9 +183,8 @@ function HeaderIconButton({
size="icon"
disabled={disabled}
aria-label={label}
title={disabled ? disabledLabel : undefined}
onClick={onClick}
className="host-no-drag h-8 w-8 shrink-0 rounded-full text-muted-foreground/85 hover:bg-accent/40 hover:text-foreground"
className="host-no-drag h-8 w-8 shrink-0 rounded-full text-muted-foreground/85 hover:text-foreground"
>
<Icon className="h-4 w-4" aria-hidden />
</Button>
@@ -632,7 +631,7 @@ export function PaneWorkbench({
aria-label={t("workbench.layout", {
defaultValue: "Pane layout",
})}
className="host-no-drag h-8 w-8 rounded-full text-muted-foreground/85 hover:bg-accent/40 hover:text-foreground"
className="host-no-drag h-8 w-8 rounded-full text-muted-foreground/85 hover:text-foreground"
>
<currentLayout.icon className="h-4 w-4" aria-hidden />
</Button>
+65 -26
View File
@@ -967,38 +967,22 @@
mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 0.75rem), transparent);
}
.thread-composer-model-badge:not([data-switching="true"]):active > .composer-model-pill {
transform: scale(0.98);
}
.composer-model-pill-setup {
border-color: hsl(var(--border) / 0.72);
box-shadow:
inset 0 1px 0 rgb(255 255 255 / 0.62),
0 1px 2px hsl(var(--foreground) / 0.035);
transition-property: color, background-color, border-color, box-shadow, transform;
transition-duration: 180ms;
transition-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}
.dark .composer-model-pill-setup {
box-shadow:
inset 0 1px 0 rgb(255 255 255 / 0.045),
0 1px 2px rgb(0 0 0 / 0.12);
transition: color 150ms ease-out, background-color 150ms ease-out, border-color 150ms ease-out;
}
.thread-composer-model-badge:hover > .composer-model-pill-setup {
border-color: hsl(var(--border));
background-color: hsl(var(--accent) / 0.7);
box-shadow:
inset 0 1px 0 rgb(255 255 255 / 0.72),
0 2px 5px hsl(var(--foreground) / 0.06);
background-color: hsl(var(--foreground) / 0.045);
}
.dark .thread-composer-model-badge:hover > .composer-model-pill-setup {
box-shadow:
inset 0 1px 0 rgb(255 255 255 / 0.07),
0 2px 5px rgb(0 0 0 / 0.16);
background-color: rgb(255 255 255 / 0.065);
}
.thread-composer-model-badge:not([data-switching="true"]):active > .composer-model-pill {
background-color: hsl(var(--foreground) / 0.085);
}
@keyframes composer-model-pill-setup-attention {
@@ -1136,7 +1120,7 @@
align-items: center;
}
/* Keep a 44px hit area around the quieter 36px attachment/send circles.
/* Keep a 44px hit area around the quieter 36px attachment/send controls.
* The transparent pseudo-element belongs to the button, including its disabled
* state; margins reserve its space so adjacent controls never overlap it. */
[data-compact-controls] .thread-composer-round-action.touch-target {
@@ -1407,9 +1391,64 @@
text-align: justify;
text-align-last: justify;
}
.icon-action[aria-pressed="true"], .icon-action[data-state="open"] {
color: hsl(var(--foreground));
}
.icon-action[aria-pressed="true"]::after, .icon-action[data-state="open"]::after {
content: "";
position: absolute;
bottom: 3px;
left: calc(50% - 4px);
width: 8px;
height: 2px;
border-radius: 1px;
background-color: currentColor;
pointer-events: none;
}
.icon-action svg {
transform-box: fill-box;
transform-origin: center;
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
.icon-action [data-product-icon="settings"] {
transform: rotate(0deg);
transition: transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.icon-action:not(:disabled):hover [data-product-icon="settings"] {
transform: rotate(90deg);
}
}
.activity-current-trace { display: none; }
@media (prefers-reduced-motion: no-preference) {
.activity-current > path:first-child { opacity: 0.35; }
.activity-current-trace {
display: block;
stroke-dasharray: 16 84;
animation: activity-current-flow 1800ms linear infinite;
}
}
@keyframes activity-current-flow {
0% { stroke-dashoffset: 16; opacity: 0; }
10% { opacity: 1; }
65% { stroke-dashoffset: 116; opacity: 1; }
75%, 100% { stroke-dashoffset: 116; opacity: 0; }
}
.quiet-control, .settings-hover {
--control-hover-fill: hsl(var(--foreground) / 0.045);
--control-active-fill: hsl(var(--foreground) / 0.085);
}
.dark .quiet-control, .dark .settings-hover {
--control-hover-fill: rgb(255 255 255 / 0.065);
--control-active-fill: rgb(255 255 255 / 0.105);
}
@media (hover: hover) {
.settings-hover:hover { background-color: hsl(var(--sidebar-foreground) / 0.055); }
.dark .settings-hover:hover { background-color: rgb(255 255 255 / 0.07); }
.quiet-control:hover, .settings-hover:hover {
background-color: var(--control-hover-fill);
}
}
.quiet-control:active, .settings-hover:active,
.quiet-control[data-state="open"], .quiet-control[aria-pressed="true"] {
background-color: var(--control-active-fill);
}
.settings-editor { padding: 16px var(--settings-inset, 16px); }
@media (min-width: 640px) {
+4 -4
View File
@@ -840,7 +840,7 @@ describe("App layout", () => {
const newTopicButton = within(sidebar).getByRole("button", { name: "New topic" });
expect(newTopicButton).toHaveAttribute("aria-current", "page");
expect(newTopicButton).toHaveClass("transition-[width,padding,color]");
expect(newTopicButton).toHaveClass("transition-[width,padding,color,background-color]");
expect(newTopicButton).toBeEnabled();
});
@@ -986,11 +986,11 @@ describe("App layout", () => {
fireEvent.click(within(sidebar).getByRole("button", { name: "New topic" }));
const temporaryToggle = screen.getByRole("button", { name: "Temporary chat" });
expect(temporaryToggle).toHaveClass("h-8", "w-8", "rounded-full");
expect(temporaryToggle).toHaveClass("h-8", "w-8", "rounded-xl");
expect(within(temporaryToggle).queryByText("Temporary chat")).not.toBeInTheDocument();
fireEvent.click(temporaryToggle);
expect(temporaryToggle).toHaveAttribute("aria-pressed", "true");
expect(temporaryToggle).toHaveClass("bg-transparent", "shadow-none", "hover:bg-transparent");
expect(temporaryToggle).toHaveClass("icon-action");
expect(within(temporaryToggle).getByTestId("temporary-chat-icon")).toHaveClass(
"motion-safe:duration-150",
"text-[var(--temporary-control-active)]",
@@ -2977,7 +2977,7 @@ describe("App layout", () => {
expect(overviewButton).toHaveAttribute("aria-current", "page");
expect(overviewButton).not.toHaveClass("bg-sidebar-accent");
expect(overviewButton).toHaveClass("transition-[color]");
expect(overviewButton).toHaveClass("transition-[color,background-color]");
expect(settingsHighlight).toHaveAttribute("data-active-id", "overview");
fireEvent.click(modelsButton);
+12 -6
View File
@@ -32,11 +32,14 @@ beforeEach(() => window.localStorage.clear());
afterEach(() => { cleanup(); vi.restoreAllMocks(); });
describe("host switcher", () => {
it("announces the host only once when its display name is the hostname", () => {
it("announces the host only once when its display name is the hostname", async () => {
const value = { ...picker(1), name: "team-host", hostname: "team-host" };
render(<HostNavigationContext.Provider value={value}><HostSwitcher /></HostNavigationContext.Provider>);
expect(screen.getByRole("status").textContent).toBe("team-host · Connected");
expect(screen.getByRole("button", { name: "Switch host" })).toHaveAttribute("title", "team-host · Connected");
const trigger = screen.getByRole("button", { name: "Switch host" });
expect(trigger).not.toHaveAttribute("title");
await userEvent.hover(trigger);
expect(await screen.findByRole("tooltip")).toHaveTextContent("team-host · Connected");
});
it("does not borrow the local socket's Connected status while restoring a remote", () => {
@@ -56,7 +59,8 @@ describe("host switcher", () => {
render(<HostNavigationContext.Provider value={value}><HostSwitcher /></HostNavigationContext.Provider>);
const trigger = screen.getByRole("button", { name: "Switch host" });
expect(within(trigger).getByText("Local", { exact: true })).toBeVisible();
expect(trigger).toHaveAttribute("title", expect.stringContaining("Connecting to Server 1"));
await userEvent.hover(trigger);
expect(await screen.findByRole("tooltip")).toHaveTextContent("Connecting to Server 1");
expect(within(trigger).getByRole("status")).toHaveTextContent("Local · My-Mac · Connected · Connecting to Server 1");
await userEvent.click(trigger);
expect(screen.getByRole("menuitem", { name: "Local nanobot My-Mac" })).toHaveAttribute("aria-current", "true");
@@ -68,7 +72,8 @@ describe("host switcher", () => {
render(<HostNavigationContext.Provider value={value}><HostSwitcher /></HostNavigationContext.Provider>);
const trigger = screen.getByRole("button", { name: "Switch host" });
expect(within(trigger).getByRole("status")).toHaveTextContent("Local · My-Mac · Connected");
expect(trigger).toHaveAttribute("title", expect.stringContaining(value.error));
await userEvent.hover(trigger);
expect(await screen.findByRole("tooltip")).toHaveTextContent(value.error);
expect(trigger).not.toHaveTextContent("Offline");
await userEvent.click(trigger);
expect(screen.getByRole("alert")).toHaveTextContent(value.error);
@@ -80,7 +85,7 @@ describe("host switcher", () => {
expect(screen.getByRole("status")).toHaveTextContent("Team server · team-host · Server connection lost");
});
it("keeps remote sidebar identity and connection status separate from pending or failed switches", () => {
it("keeps remote sidebar identity and connection status separate from pending or failed switches", async () => {
const value = { kind: "embedded" as const, name: "Team server", hostname: "team-host", pendingName: "Another server", open: vi.fn() };
const view = render(<HostNavigationContext.Provider value={value}><HostSwitcher /></HostNavigationContext.Provider>);
const trigger = screen.getByRole("button", { name: "Switch host" });
@@ -88,7 +93,8 @@ describe("host switcher", () => {
expect(within(trigger).getByRole("status")).toHaveTextContent("Team server · team-host · Connected · Connecting to Another server");
view.rerender(<HostNavigationContext.Provider value={{ ...value, pendingName: undefined, error: "Destination SSH is unreachable" }}><HostSwitcher /></HostNavigationContext.Provider>);
expect(within(trigger).getByRole("status")).toHaveTextContent("Team server · team-host · Connected");
expect(trigger).toHaveAttribute("title", expect.stringContaining("Destination SSH is unreachable"));
await userEvent.hover(trigger);
expect(await screen.findByRole("tooltip")).toHaveTextContent("Destination SSH is unreachable");
});
it.each([0, 1, 5])("keeps %i saved hosts simple without search", async (count) => {
await openMenu(picker(count));
+4 -4
View File
@@ -10,7 +10,7 @@ const presets = [
];
describe("ModelPresetBadge setup tooltip", () => {
it.each([true, false])("hides model details on hover and focus (hero: %s)", async (isHero) => {
it.each([true, false])("keeps setup actionable without repeating its prompt in a tooltip (hero: %s)", async (isHero) => {
const user = userEvent.setup();
const onClick = vi.fn();
render(
@@ -27,12 +27,12 @@ describe("ModelPresetBadge setup tooltip", () => {
const trigger = screen.getByRole("button", { name: "Choose your AI" });
await user.hover(trigger);
expect(await screen.findByRole("tooltip")).toHaveTextContent(/^Choose your AI$/);
expect(screen.queryByRole("tooltip")).not.toBeInTheDocument();
await user.unhover(trigger);
fireEvent.keyDown(trigger, { key: "Escape" });
await waitFor(() => expect(screen.queryByRole("tooltip")).not.toBeInTheDocument());
fireEvent.focus(trigger);
expect(await screen.findByRole("tooltip")).toHaveTextContent(/^Choose your AI$/);
expect(screen.queryByRole("tooltip")).not.toBeInTheDocument();
await user.click(trigger);
expect(onClick).toHaveBeenCalledTimes(1);
});
@@ -56,7 +56,7 @@ describe("ModelPresetBadge setup tooltip", () => {
expect(trigger).toHaveTextContent("选择你的 AI");
expect(trigger.querySelector("[data-fallback]")).toBeNull();
fireEvent.focus(trigger);
expect(await screen.findByRole("tooltip")).toHaveTextContent(/^选择你的 AI$/);
expect(screen.queryByRole("tooltip")).not.toBeInTheDocument();
},
);
});
+6 -3
View File
@@ -413,7 +413,7 @@ describe("PaneWorkbench", () => {
expect(screen.queryByTestId("workbench-pane-gamma")).not.toBeInTheDocument();
});
it("explains why the desktop add-pane control is disabled", () => {
it("explains why the desktop add-pane control is disabled", async () => {
render(
<PaneWorkbench
panes={[{ key: "alpha", title: "Alpha" }]}
@@ -430,8 +430,11 @@ describe("PaneWorkbench", () => {
/>,
);
expect(screen.getByRole("button", { name: "Add pane" }))
.toHaveAttribute("title", "Maximum 4 panes");
const addPane = screen.getByRole("button", { name: "Add pane" });
expect(addPane).toBeDisabled();
expect(addPane).not.toHaveAttribute("title");
fireEvent.pointerMove(addPane.parentElement!, { pointerType: "mouse" });
expect(await screen.findByRole("tooltip")).toHaveTextContent("Maximum 4 panes");
});
it("fills the workbench through alternating binary splits", () => {
+7 -1
View File
@@ -4,12 +4,18 @@ import { expect, it } from "vitest";
import { ReasoningRow } from "@/components/thread/activity/ReasoningRow";
it("shows the reasoning preview in the shared tooltip on hover and keyboard focus", async () => {
it("shows clipped reasoning in the shared tooltip on hover and keyboard focus", async () => {
const user = userEvent.setup();
const text = 'The user is saying "hi" again. I should respond in Chinese, concisely and in a friendly manner.';
const { container } = render(<ReasoningRow text={text} streaming={false} />);
const line = screen.getByTestId("activity-line");
const clippedLabel = line.querySelector(".truncate") as HTMLElement;
Object.defineProperties(clippedLabel, {
clientWidth: { value: 100 },
scrollWidth: { value: 200 },
});
expect(container.querySelector("[title]")).toBeNull();
await user.hover(line);
expect(await screen.findByRole("tooltip")).toHaveTextContent(text);
+3 -3
View File
@@ -710,7 +710,7 @@ describe("remote instance UX", () => {
const switcher = await screen.findByRole("button", { name: "Switch host" });
expect(screen.queryByRole("button", { name: "Remote connections" })).not.toBeInTheDocument();
expect(switcher).toHaveClass("w-8", "h-8");
expect(switcher).toHaveAttribute("title", expect.stringContaining("Xubin-Mac"));
expect(within(switcher).getByRole("status")).toHaveTextContent("Xubin-Mac");
await openDirectory();
});
@@ -801,7 +801,7 @@ describe("remote instance UX", () => {
expect(frame).toHaveAttribute("src", connection.url);
expect(frame).toHaveAttribute("sandbox", expect.not.stringContaining("allow-top-navigation"));
expect(document.querySelector('[data-host-view="local"]')).toHaveAttribute("inert");
expect(screen.getByRole("button", { name: "Switch host" })).toHaveAttribute("title", expect.stringContaining("Team server · team-host"));
expect(within(screen.getByRole("button", { name: "Switch host" })).getByRole("status")).toHaveTextContent("Team server · team-host");
expect(mocks.request).toHaveBeenCalledWith("remote.connect", { id: profile.id }, 65_000);
expect(window.sessionStorage.getItem("nanobot.remote-instance")).not.toContain("secret");
expect(readRecentRemotes()).toEqual([profile.id]);
@@ -1200,7 +1200,7 @@ describe("remote instance UX", () => {
view();
const identity = await screen.findByRole("button", { name: "Switch host" });
expect(identity).toHaveTextContent("Local");
expect(identity).toHaveAttribute("title", expect.stringContaining("Xubin-Mac"));
expect(within(identity).getByRole("status")).toHaveTextContent("Xubin-Mac");
expect(screen.getByRole("navigation", { name: "Sidebar navigation" })).toContainElement(identity);
expect(document.querySelector("header")).toBeNull();
fireEvent.pointerDown(identity, { button: 0, ctrlKey: false });
@@ -336,7 +336,6 @@ describe("SettingsView Apps catalog", () => {
));
const connected = await screen.findByRole("button", { name: "Manage team-docs" });
expect(connected).toHaveTextContent("Manage");
expect(connected.querySelector(".lucide-check")).not.toBeNull();
fireEvent.click(screen.getByRole("button", { name: "Ready" }));
const readyHeading = await screen.findByRole("heading", { name: "team-docs" });
expect(within(readyHeading.closest("article") as HTMLElement).getByText("MCP"))
+8 -3
View File
@@ -29,6 +29,11 @@ async function enter() {
await act(async () => { await Promise.resolve(); });
}
async function clickStarLink(link: HTMLElement) {
link.addEventListener("click", (event) => event.preventDefault(), { once: true });
await act(async () => fireEvent.click(link));
}
it("claims once on entry and lets users skip without permanently dismissing", async () => {
const view = render(<StarPrompt ready />);
await enter();
@@ -95,7 +100,7 @@ it("the About link opens GitHub and persists permanent dismissal", async () => {
const link = screen.getByRole("link", { name: "Star nanobot on GitHub" });
expect(link).toHaveAttribute("href", "https://github.com/HKUDS/nanobot");
expect(link).toHaveAttribute("target", "_blank");
await act(async () => fireEvent.click(link));
await clickStarLink(link);
expect(action).toHaveBeenCalledWith(client, "dismiss");
});
@@ -167,10 +172,10 @@ it("keeps the GitHub action a real link and retries failed preference saves", as
expect(link).toHaveAttribute("target", "_blank");
expect(link.querySelector(".star-prompt-decoration")).toHaveAttribute("aria-hidden", "true");
action.mockRejectedValueOnce(new Error("offline"));
await act(async () => fireEvent.click(link));
await clickStarLink(link);
expect(screen.getByRole("alert")).toBeVisible();
expect(screen.getByRole("dialog")).toBeVisible();
await act(async () => fireEvent.click(link));
await clickStarLink(link);
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
expect(action.mock.calls.map(([, command]) => command)).toEqual(["claim", "dismiss", "dismiss"]);
});
+32 -29
View File
@@ -6,7 +6,7 @@ import { ThreadComposer } from "@/components/thread/ThreadComposer";
import { ComposerDraftStore } from "@/lib/composer-draft";
import { encodeImage } from "@/lib/imageEncode";
import { SESSION_DRAG_TYPE } from "@/lib/session-drag";
import type { ChatSummary, CliAppInfo, McpPresetInfo, SlashCommand } from "@/lib/types";
import type { ChatSummary, CliAppInfo, McpPresetInfo, SlashCommand, WorkspaceScopePayload } from "@/lib/types";
vi.mock("@/lib/imageEncode", () => ({
encodeImage: vi.fn(async (file: File) => ({
@@ -801,7 +801,6 @@ describe("ThreadComposer", () => {
expect(input.parentElement?.parentElement?.className).toContain("max-w-[49.5rem]");
expect(input.parentElement?.parentElement?.className).toContain("rounded-panel");
expect(input.parentElement?.parentElement?.className).not.toContain("shadow-");
expect(screen.getByRole("button", { name: "Attach files" }).className).toContain("bg-card");
expect(screen.getByRole("button", { name: "Send message" }).className).toContain("bg-foreground");
expect(screen.queryByText(/Enter to send/)).not.toBeInTheDocument();
});
@@ -1093,7 +1092,7 @@ describe("ThreadComposer", () => {
);
const voiceButton = screen.getByRole("button", { name: "Voice input" });
expect(voiceButton).toHaveAttribute("title", "Click to dictate or hold");
expect(voiceButton).not.toHaveAttribute("title");
expect(voiceButton).toHaveAttribute("aria-keyshortcuts", "Control+Shift+D");
fireEvent.keyDown(window, { code: "KeyD", ctrlKey: true, key: "D", shiftKey: true });
expect(await screen.findByLabelText("Recording 0:00")).toBeInTheDocument();
@@ -1343,33 +1342,37 @@ describe("ThreadComposer", () => {
expect(screen.getByRole("progressbar", { name: "Context 50%" })).toBeVisible();
});
it("renders and changes workspace access mode", async () => {
it("toggles workspace access directly by click and keyboard", async () => {
const user = userEvent.setup();
const onWorkspaceScopeChange = vi.fn();
render(
<ThreadComposer
onSend={vi.fn()}
placeholder="Type your message..."
workspaceScope={{
project_path: "/tmp/project",
project_name: "project",
access_mode: "restricted",
restrict_to_workspace: true,
}}
workspaceControls={{ can_change_project: true, can_use_full_access: true }}
onWorkspaceScopeChange={onWorkspaceScopeChange}
/>,
);
fireEvent.pointerDown(screen.getByRole("button", { name: /Workspace access mode/ }));
fireEvent.click(await screen.findByRole("menuitem", { name: /Full Access/ }));
expect(onWorkspaceScopeChange).toHaveBeenCalledWith(
expect.objectContaining({
project_path: "/tmp/project",
access_mode: "full",
restrict_to_workspace: false,
}),
const restricted: WorkspaceScopePayload = {
project_path: "/tmp/project", project_name: "project",
access_mode: "restricted", restrict_to_workspace: true,
};
const composer = (workspaceScope: WorkspaceScopePayload, canUseFullAccess = true) => (
<ThreadComposer onSend={vi.fn()} placeholder="Type your message..."
workspaceScope={workspaceScope}
workspaceControls={{ can_change_project: true, can_use_full_access: canUseFullAccess }}
onWorkspaceScopeChange={onWorkspaceScopeChange} />
);
const { rerender } = render(composer(restricted));
const access = screen.getByRole("button", { name: /Workspace access mode/ });
expect(access).toHaveAttribute("aria-pressed", "false");
await user.click(access);
expect(screen.queryByRole("menu")).not.toBeInTheDocument();
const full = { ...restricted, access_mode: "full" as const, restrict_to_workspace: false };
expect(onWorkspaceScopeChange).toHaveBeenLastCalledWith(full);
rerender(composer(full));
expect(access).toHaveAttribute("aria-pressed", "true");
expect(access).toHaveAccessibleName("Workspace access mode: Full Access");
expect(access).toHaveFocus();
await user.keyboard("{Enter}");
expect(onWorkspaceScopeChange).toHaveBeenLastCalledWith(restricted);
rerender(composer(restricted, false));
expect(access).toBeDisabled();
onWorkspaceScopeChange.mockClear();
await user.click(access);
expect(onWorkspaceScopeChange).not.toHaveBeenCalled();
});
it("exposes full and compact workspace labels for container-driven compression", () => {
@@ -1394,7 +1397,7 @@ describe("ThreadComposer", () => {
});
const fullLabel = within(accessButton).getByText("Full Access");
const shortLabel = within(accessButton).getByText("Full");
expect(accessButton).toHaveAttribute("title", "Full Access");
expect(accessButton).not.toHaveAttribute("title");
expect(fullLabel).toHaveClass("thread-composer-access-label-full");
expect(shortLabel).toHaveClass("thread-composer-access-label-short");
expect(shortLabel).toHaveClass("hidden");
-1
View File
@@ -755,7 +755,6 @@ describe("ThreadMessages", () => {
"h-[var(--message-block-control-size)]",
"w-[var(--message-block-action-width)]",
"rounded-control",
"group-hover:bg-muted/70",
);
expect(disclosure.querySelector("svg")).toBeInTheDocument();
const toolbar = menu.querySelector("[data-message-block-toolbar]");
+2 -2
View File
@@ -1450,7 +1450,7 @@ describe("ThreadShell", () => {
expect(screen.queryByText(/This response used a fallback model/)).not.toBeInTheDocument();
});
it.each([false, true])("hides unconfigured model details in setup tooltips (existing history: %s)", async (hasHistory) => {
it.each([false, true])("keeps model setup actionable without a repeated tooltip (existing history: %s)", async (hasHistory) => {
const client = makeClient();
const settings = modelSettings("anthropic/claude-opus-4-5", "anthropic");
settings.agent.has_api_key = false;
@@ -1479,7 +1479,7 @@ describe("ThreadShell", () => {
await screen.findByText(hasHistory ? "Previous message" : HERO_GREETING_PATTERN);
const badge = screen.getByRole("button", { name: "Choose your AI" });
fireEvent.focus(badge);
expect(await screen.findByRole("tooltip")).toHaveTextContent(/^Choose your AI$/);
expect(screen.queryByRole("tooltip")).not.toBeInTheDocument();
fireEvent.click(badge);
expect(onOpenModelSettings).toHaveBeenCalledTimes(1);
expect(client.sendMessage).not.toHaveBeenCalled();