@@ -218,6 +218,10 @@ const HistoryItem = React.memo<{
218218 const index = historyStore . $get ( ) . inputHistory . findIndex ( ( e ) => e === entry ) ;
219219 return ( ) => onJumpToInputHistory ?.( index ) ;
220220 } ) ( ) }
221+ onDelete = { ( ( ) => {
222+ const idx = historyStore . $get ( ) . history . indexOf ( entry ) ;
223+ return ( ) => historyStore . removeInputBlockAt ( idx ) ;
224+ } ) ( ) }
221225 />
222226 ) ,
223227 "{ type: 'output', variant: 'info', value: _ }" : ( value ) => (
@@ -291,7 +295,8 @@ const ButtonGroup = React.memo<{
291295 input : string ;
292296 inputAreaRef ?: React . RefObject < InputAreaRef | null > ;
293297 onJump ?: ( ) => void ;
294- } > ( function ButtonGroup ( { input, inputAreaRef, onJump } ) {
298+ onDelete ?: ( ) => void ;
299+ } > ( function ButtonGroup ( { input, inputAreaRef, onDelete, onJump } ) {
295300 const [ copied , setCopied ] = useState ( false ) ;
296301 const [ showMenu , setShowMenu ] = useState ( false ) ;
297302 const isTouchDevice = useIsTouchDevice ( ) ;
@@ -344,6 +349,16 @@ const ButtonGroup = React.memo<{
344349 { /* Show secondary buttons on hover for non-touch devices */ }
345350 { ! isTouchDevice && (
346351 < div className = "mr-1.5 hidden space-x-1.5 group-hover:flex" >
352+ < button
353+ type = "button"
354+ title = "Delete this entry"
355+ onClick = { ( e ) => {
356+ e . stopPropagation ( ) ;
357+ onDelete ?.( ) ;
358+ } }
359+ className = "rounded-md border border-gray-700/50 bg-black/70 p-1 text-gray-400 hover:bg-[#2a1e30] hover:text-[#ff6e6e]" >
360+ < Icon icon = "material-symbols:close" className = "size-4" />
361+ </ button >
347362 < button
348363 type = "button"
349364 title = "Copy to clipboard"
@@ -397,6 +412,17 @@ const ButtonGroup = React.memo<{
397412 { /* Touch-device dropdown menu */ }
398413 { showMenu && (
399414 < div className = "absolute top-8 right-0 z-10 min-w-32 rounded-md border border-gray-700/50 bg-black/90 py-0.5 shadow-lg" >
415+ < button
416+ type = "button"
417+ className = "flex w-full items-center px-2.5 py-1.5 text-left text-xs text-gray-300 hover:bg-white/10"
418+ onClick = { ( e ) => {
419+ e . stopPropagation ( ) ;
420+ onDelete ?.( ) ;
421+ setShowMenu ( false ) ;
422+ } } >
423+ < Icon icon = "material-symbols:close" className = "mr-2 size-3.5" />
424+ Delete
425+ </ button >
400426 < button
401427 type = "button"
402428 className = "flex w-full items-center px-2.5 py-1.5 text-left text-xs text-gray-300 hover:bg-white/10"
@@ -464,7 +490,8 @@ const InputMessage = React.memo<{
464490 inputAreaRef ?: React . RefObject < InputAreaRef | null > ;
465491 historyAreaRef ?: React . RefObject < HTMLDivElement | null > ;
466492 onJump ?: ( ) => void ;
467- } > ( function InputMessage ( { historyAreaRef, inputAreaRef, onJump, value } ) {
493+ onDelete ?: ( ) => void ;
494+ } > ( function InputMessage ( { historyAreaRef, inputAreaRef, onDelete, onJump, value } ) {
468495 const [ isTooCloseToTop , setIsTooCloseToTop ] = useState ( false ) ;
469496 const messageRef = useRef < HTMLDivElement > ( null ) ;
470497
@@ -524,7 +551,12 @@ const InputMessage = React.memo<{
524551 { /* Only render ButtonGroup if not too close to top,
525552 to avoid overlapping with the GitHub icon (which is always at the top right) */ }
526553 { ! isTooCloseToTop && (
527- < ButtonGroup input = { value } inputAreaRef = { inputAreaRef } onJump = { onJump } />
554+ < ButtonGroup
555+ input = { value }
556+ inputAreaRef = { inputAreaRef }
557+ onJump = { onJump }
558+ onDelete = { onDelete }
559+ />
528560 ) }
529561 </ div >
530562 </ div >
0 commit comments