@@ -22,7 +22,7 @@ import {
22
22
CompatibilityCallToolResult ,
23
23
ClientNotification ,
24
24
} from "@modelcontextprotocol/sdk/types.js" ;
25
- import { useEffect , useRef , useState } from "react" ;
25
+ import { useCallback , useEffect , useRef , useState } from "react" ;
26
26
// Add dark mode class based on system preference
27
27
if ( window . matchMedia ( "(prefers-color-scheme: dark)" ) . matches ) {
28
28
document . documentElement . classList . add ( "dark" ) ;
@@ -127,6 +127,49 @@ const App = () => {
127
127
> ( ) ;
128
128
const [ nextToolCursor , setNextToolCursor ] = useState < string | undefined > ( ) ;
129
129
const progressTokenRef = useRef ( 0 ) ;
130
+ const [ historyPaneHeight , setHistoryPaneHeight ] = useState < number > ( 300 ) ;
131
+ const [ isDragging , setIsDragging ] = useState ( false ) ;
132
+ const dragStartY = useRef < number > ( 0 ) ;
133
+ const dragStartHeight = useRef < number > ( 0 ) ;
134
+
135
+ const handleDragStart = useCallback (
136
+ ( e : React . MouseEvent ) => {
137
+ setIsDragging ( true ) ;
138
+ dragStartY . current = e . clientY ;
139
+ dragStartHeight . current = historyPaneHeight ;
140
+ document . body . style . userSelect = "none" ;
141
+ } ,
142
+ [ historyPaneHeight ] ,
143
+ ) ;
144
+
145
+ const handleDragMove = useCallback (
146
+ ( e : MouseEvent ) => {
147
+ if ( ! isDragging ) return ;
148
+ const deltaY = dragStartY . current - e . clientY ;
149
+ const newHeight = Math . max (
150
+ 100 ,
151
+ Math . min ( 800 , dragStartHeight . current + deltaY ) ,
152
+ ) ;
153
+ setHistoryPaneHeight ( newHeight ) ;
154
+ } ,
155
+ [ isDragging ] ,
156
+ ) ;
157
+
158
+ const handleDragEnd = useCallback ( ( ) => {
159
+ setIsDragging ( false ) ;
160
+ document . body . style . userSelect = "" ;
161
+ } , [ ] ) ;
162
+
163
+ useEffect ( ( ) => {
164
+ if ( isDragging ) {
165
+ window . addEventListener ( "mousemove" , handleDragMove ) ;
166
+ window . addEventListener ( "mouseup" , handleDragEnd ) ;
167
+ return ( ) => {
168
+ window . removeEventListener ( "mousemove" , handleDragMove ) ;
169
+ window . removeEventListener ( "mouseup" , handleDragEnd ) ;
170
+ } ;
171
+ }
172
+ } , [ isDragging , handleDragMove , handleDragEnd ] ) ;
130
173
131
174
useEffect ( ( ) => {
132
175
localStorage . setItem ( "lastCommand" , command ) ;
@@ -467,11 +510,24 @@ const App = () => {
467
510
</ div >
468
511
) }
469
512
</ div >
470
- < div className = "h-1/3 min-h-[200px] border-t border-border" >
471
- < HistoryAndNotifications
472
- requestHistory = { requestHistory }
473
- serverNotifications = { notifications }
474
- />
513
+ < div
514
+ className = "relative border-t border-border"
515
+ style = { {
516
+ height : `${ historyPaneHeight } px` ,
517
+ } }
518
+ >
519
+ < div
520
+ className = "absolute w-full h-4 -top-2 cursor-row-resize flex items-center justify-center hover:bg-accent/50"
521
+ onMouseDown = { handleDragStart }
522
+ >
523
+ < div className = "w-8 h-1 rounded-full bg-border" />
524
+ </ div >
525
+ < div className = "h-full overflow-auto" >
526
+ < HistoryAndNotifications
527
+ requestHistory = { requestHistory }
528
+ serverNotifications = { notifications }
529
+ />
530
+ </ div >
475
531
</ div >
476
532
</ div >
477
533
</ div >
0 commit comments