@@ -700,8 +700,14 @@ export function ToolInput({
700700 newTools . splice ( draggedIndex , 1 )
701701
702702 // Insert the dragged tool at the new position
703- const adjustedDropIndex = draggedIndex < dropIndex ? dropIndex - 1 : dropIndex
704- newTools . splice ( adjustedDropIndex , 0 , draggedTool )
703+ // If dropping at the end (dropIndex === selectedTools.length), just append
704+ // Otherwise, adjust for the removed item
705+ if ( dropIndex === selectedTools . length ) {
706+ newTools . push ( draggedTool )
707+ } else {
708+ const adjustedDropIndex = draggedIndex < dropIndex ? dropIndex - 1 : dropIndex
709+ newTools . splice ( adjustedDropIndex , 0 , draggedTool )
710+ }
705711
706712 setStoreValue ( newTools )
707713 setDraggedIndex ( null )
@@ -868,18 +874,33 @@ export function ToolInput({
868874 < div
869875 key = { `${ tool . type } -${ toolIndex } ` }
870876 className = { cn (
871- 'group flex flex-col transition-opacity ' ,
877+ 'group relative flex flex-col transition-all duration-200 ease-in-out ' ,
872878 isWide ? 'w-[calc(50%-0.25rem)]' : 'w-full' ,
873- draggedIndex === toolIndex ? 'opacity-50' : '' ,
874- dragOverIndex === toolIndex && draggedIndex !== toolIndex ? 'scale-105' : ''
879+ draggedIndex === toolIndex ? 'scale-95 opacity-40' : '' ,
880+ dragOverIndex === toolIndex && draggedIndex !== toolIndex && draggedIndex !== null
881+ ? 'translate-y-1 transform'
882+ : '' ,
883+ selectedTools . length > 1 && ! isPreview && ! disabled
884+ ? 'cursor-grab active:cursor-grabbing'
885+ : ''
875886 ) }
876887 draggable = { ! isPreview && ! disabled }
877888 onDragStart = { ( e ) => handleDragStart ( e , toolIndex ) }
878889 onDragOver = { ( e ) => handleDragOver ( e , toolIndex ) }
879890 onDragEnd = { handleDragEnd }
880891 onDrop = { ( e ) => handleDrop ( e , toolIndex ) }
881892 >
882- < div className = 'flex flex-col overflow-visible rounded-md border bg-card' >
893+ { /* Subtle drop indicator - use border highlight instead of separate line */ }
894+ < div
895+ className = { cn (
896+ 'flex flex-col overflow-visible rounded-md border bg-card' ,
897+ dragOverIndex === toolIndex &&
898+ draggedIndex !== toolIndex &&
899+ draggedIndex !== null
900+ ? 'border-t-2 border-t-muted-foreground/40'
901+ : ''
902+ ) }
903+ >
883904 < div
884905 className = { cn (
885906 'flex items-center justify-between bg-accent/50 p-2' ,
@@ -1141,6 +1162,18 @@ export function ToolInput({
11411162 )
11421163 } ) }
11431164
1165+ { /* Drop zone for the end of the list */ }
1166+ { selectedTools . length > 0 && draggedIndex !== null && (
1167+ < div
1168+ className = { cn (
1169+ 'h-2 w-full rounded transition-all duration-200 ease-in-out' ,
1170+ dragOverIndex === selectedTools . length ? 'border-b-2 border-b-muted-foreground/40' : ''
1171+ ) }
1172+ onDragOver = { ( e ) => handleDragOver ( e , selectedTools . length ) }
1173+ onDrop = { ( e ) => handleDrop ( e , selectedTools . length ) }
1174+ />
1175+ ) }
1176+
11441177 < Popover open = { open } onOpenChange = { setOpen } >
11451178 < PopoverTrigger asChild >
11461179 < Button
0 commit comments