@@ -10,6 +10,9 @@ import {
10
10
} from "@/components/ui/resizable"
11
11
import { TooltipProvider } from "@/components/ui/tooltip"
12
12
import axios from "axios"
13
+ import { Separator } from "@/components/ui/separator"
14
+ import { Textarea } from "@/components/ui/textarea"
15
+ import { Button } from "@/components/ui/button"
13
16
14
17
const backendUrl = import . meta. env . VITE_BACKEND_URL || 'http://localhost:5000' ;
15
18
@@ -135,25 +138,45 @@ export function Message() {
135
138
< ResizableHandle withHandle />
136
139
< ResizablePanel minSize = { 30 } className = "flex flex-col" >
137
140
< div className = "flex-grow overflow-auto" >
138
- { selectedUser && (
141
+
142
+ { selectedUser ? (
139
143
< div >
140
144
< h3 > Chat with { selectedUser . username } </ h3 >
141
- < div >
145
+ < div className = "flex-1 whitespace-pre-wrap p-4 text-sm" >
142
146
{ chatMessages . map ( ( msg , index ) => (
143
147
< div key = { index } >
144
148
< strong > { msg . sender_username === currentUserId ? "You" : selectedUser . username } :</ strong > { msg . message }
145
149
</ div >
146
150
) ) }
147
151
</ div >
148
- < input
149
- type = "text"
150
- value = { message }
151
- onChange = { ( e ) => setMessage ( e . target . value ) }
152
- placeholder = "Type a message"
153
- />
154
- < button onClick = { handleSendMessage } > Send</ button >
155
- </ div >
156
- ) }
152
+ < Separator className = "mt-auto" />
153
+ < div className = "p-4" >
154
+ < form >
155
+ < div className = "grid gap-4" >
156
+ < Textarea
157
+ className = "p-4"
158
+ value = { message }
159
+ onChange = { ( e ) => setMessage ( e . target . value ) }
160
+ placeholder = "Type a message"
161
+ />
162
+ < div className = "flex items-center" >
163
+ < Button
164
+ onClick = { handleSendMessage }
165
+ size = "sm"
166
+ className = "ml-auto"
167
+ >
168
+ Send
169
+ </ Button >
170
+ </ div >
171
+ </ div >
172
+ </ form >
173
+ </ div >
174
+ </ div >
175
+ ) : (
176
+ < div className = "p-8 text-center text-muted-foreground" >
177
+ No message selected
178
+ </ div >
179
+ ) }
157
180
</ div >
158
181
</ ResizablePanel >
159
182
</ ResizablePanelGroup >
0 commit comments