51
51
}
52
52
</ script >
53
53
< style >
54
- /* Custom scrollbar */
54
+ /* Modern, subtle scrollbar */
55
55
.custom-scrollbar ::-webkit-scrollbar {
56
- width : 6px ;
56
+ width : 8px ;
57
+ height : 8px ;
57
58
}
58
59
.custom-scrollbar ::-webkit-scrollbar-track {
59
- background : # f1f5f9 ;
60
- }
61
- .dark .custom-scrollbar ::-webkit-scrollbar-track {
62
- background : # 1e293b ;
60
+ background : transparent;
63
61
}
64
62
.custom-scrollbar ::-webkit-scrollbar-thumb {
65
- background : # cbd5e1 ;
66
- border-radius : 3px ;
63
+ background : # 94a3b8 ;
64
+ border-radius : 4px ;
65
+ border : 2px solid transparent;
66
+ background-clip : content-box;
67
67
}
68
68
.dark .custom-scrollbar ::-webkit-scrollbar-thumb {
69
- background : # 475569 ;
69
+ background : # 52525b ;
70
70
}
71
71
.custom-scrollbar ::-webkit-scrollbar-thumb : hover {
72
- background : # 94a3b8 ;
72
+ background : # 475569 ;
73
73
}
74
74
.dark .custom-scrollbar ::-webkit-scrollbar-thumb : hover {
75
- background : # 64748b ;
75
+ background : # 71717a ;
76
+ }
77
+ .custom-scrollbar {
78
+ scrollbar-width : thin;
79
+ scrollbar-color : # 94a3b8 transparent;
80
+ }
81
+ .dark .custom-scrollbar {
82
+ scrollbar-color : # 52525b transparent;
76
83
}
77
84
78
85
/* Dark mode for body background */
285
292
const messagesEndRef = useRef ( null ) ;
286
293
const inputRef = useRef ( null ) ;
287
294
295
+ // Auto-resize textarea
296
+ useEffect ( ( ) => {
297
+ if ( inputRef . current ) {
298
+ inputRef . current . style . height = 'auto' ;
299
+ const scrollHeight = inputRef . current . scrollHeight ;
300
+ inputRef . current . style . height = scrollHeight + 'px' ;
301
+ }
302
+ } , [ input ] ) ;
303
+
288
304
const toggleOutput = ( messageIndex ) => {
289
305
const newExpanded = new Set ( expandedOutputs ) ;
290
306
if ( newExpanded . has ( messageIndex ) ) {
@@ -819,18 +835,24 @@ <h2 className={`text-2xl font-bold ${isDarkMode ? 'text-white' : 'text-gray-900'
819
835
< div className = "max-w-4xl mx-auto" >
820
836
< form onSubmit = { handleSubmit } className = "flex space-x-3" >
821
837
< div className = "flex-1 relative" >
822
- < input
838
+ < textarea
823
839
ref = { inputRef }
824
- type = "text"
825
840
value = { input }
826
841
onChange = { ( e ) => setInput ( e . target . value ) }
842
+ onKeyDown = { ( e ) => {
843
+ if ( e . key === 'Enter' && ! e . shiftKey ) {
844
+ e . preventDefault ( ) ;
845
+ handleSubmit ( e ) ;
846
+ }
847
+ } }
827
848
placeholder = { getInputPlaceholder ( ) }
828
849
disabled = { ! canSendMessage }
829
- className = { `w-full px-4 py-3 pr-12 border rounded-xl shadow-sm focus:outline-none focus:ring-2 focus:ring-brand-500 focus:border-transparent transition-colors ${
850
+ className = { `w-full px-4 py-3 pr-12 border rounded-xl shadow-sm focus:outline-none focus:ring-2 focus:ring-brand-500 focus:border-transparent transition-colors resize-none overflow-y-auto max-h-40 custom-scrollbar align-bottom ${
830
851
isDarkMode
831
852
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400'
832
853
: 'bg-white border-gray-300 text-gray-900 placeholder-gray-400'
833
854
} ${ ! canSendMessage ? ( isDarkMode ? 'bg-gray-800 text-gray-500' : 'bg-gray-50 text-gray-500' ) : '' } `}
855
+ rows = "1"
834
856
/>
835
857
{ agentState === 'running' && (
836
858
< div className = "absolute right-3 top-1/2 transform -translate-y-1/2" >
@@ -841,7 +863,7 @@ <h2 className={`text-2xl font-bold ${isDarkMode ? 'text-white' : 'text-gray-900'
841
863
< button
842
864
type = "submit"
843
865
disabled = { ! canSendMessage || ! input . trim ( ) }
844
- className = "px-6 py-3 bg-gradient-to-r from-brand-500 to-brand-600 text-white rounded-xl hover:from-brand-600 hover:to-brand-700 focus:outline-none focus:ring-2 focus:ring-brand-500 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200 font-medium shadow-sm"
866
+ className = "px-6 py-3 bg-gradient-to-r from-brand-500 to-brand-600 text-white rounded-xl hover:from-brand-600 hover:to-brand-700 focus:outline-none focus:ring-2 focus:ring-brand-500 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200 font-medium shadow-sm self-end "
845
867
>
846
868
Send
847
869
</ button >
0 commit comments