fix(ui): align multi-file patch interactions
This commit is contained in:
@@ -2198,12 +2198,17 @@ const ToolPartContent: React.FC<ToolPartProps> = ({
|
|||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
'group/tool flex gap-1.5 pr-2 pl-px py-1.5 rounded-xl',
|
'group/tool flex gap-1.5 pr-2 pl-px py-1.5 rounded-xl',
|
||||||
isMultiFileApplyPatch ? 'flex-wrap items-start' : 'items-center cursor-pointer',
|
isMultiFileApplyPatch ? 'flex-wrap items-start cursor-pointer' : 'items-center cursor-pointer',
|
||||||
)}
|
)}
|
||||||
onClick={isMultiFileApplyPatch ? undefined : handleMainClick}
|
onClick={isMultiFileApplyPatch ? () => onToggle(part.id) : handleMainClick}
|
||||||
onKeyDown={isMultiFileApplyPatch ? undefined : handleMainKeyDown}
|
onKeyDown={isMultiFileApplyPatch ? (event) => {
|
||||||
role={isMultiFileApplyPatch ? undefined : 'button'}
|
if (event.target !== event.currentTarget) return;
|
||||||
tabIndex={isMultiFileApplyPatch ? undefined : 0}
|
if (event.key !== 'Enter' && event.key !== ' ') return;
|
||||||
|
event.preventDefault();
|
||||||
|
onToggle(part.id);
|
||||||
|
} : handleMainKeyDown}
|
||||||
|
role="button"
|
||||||
|
tabIndex={0}
|
||||||
>
|
>
|
||||||
<div className={cn('flex gap-1.5', isMultiFileApplyPatch ? 'w-full min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5' : 'items-center flex-shrink-0')}>
|
<div className={cn('flex gap-1.5', isMultiFileApplyPatch ? 'w-full min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5' : 'items-center flex-shrink-0')}>
|
||||||
{isMultiFileApplyPatch ? (
|
{isMultiFileApplyPatch ? (
|
||||||
@@ -2215,11 +2220,26 @@ const ToolPartContent: React.FC<ToolPartProps> = ({
|
|||||||
aria-expanded={isExpanded}
|
aria-expanded={isExpanded}
|
||||||
aria-label={displayName}
|
aria-label={displayName}
|
||||||
title={displayName}
|
title={displayName}
|
||||||
onClick={() => onToggle(part.id)}
|
onClick={(event) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
onToggle(part.id);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{isExpanded
|
<span className="relative h-3.5 w-3.5 flex-shrink-0">
|
||||||
? <Icon name="arrow-down-s" className="h-3.5 w-3.5" />
|
<span className={cn(
|
||||||
: getToolIcon(normalizedPartTool || part.tool)}
|
'absolute inset-0 flex items-center justify-center transition-opacity',
|
||||||
|
isExpanded ? 'opacity-0' : 'group-hover/tool:opacity-0',
|
||||||
|
)}>
|
||||||
|
{getToolIcon(normalizedPartTool || part.tool)}
|
||||||
|
</span>
|
||||||
|
<Icon
|
||||||
|
name={isExpanded ? 'arrow-down-s' : 'arrow-right-s'}
|
||||||
|
className={cn(
|
||||||
|
'absolute inset-0 h-3.5 w-3.5 transition-opacity',
|
||||||
|
isExpanded ? 'opacity-100' : 'opacity-0 group-hover/tool:opacity-100',
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
<MinDurationShineText
|
<MinDurationShineText
|
||||||
active={Boolean(isActive && !isError)}
|
active={Boolean(isActive && !isError)}
|
||||||
minDurationMs={300}
|
minDurationMs={300}
|
||||||
|
|||||||
Reference in New Issue
Block a user