@@ -5,6 +5,9 @@ import MessageList from "./MessageList";
55import MessageInput from "./MessageInput" ;
66import { useSearchParams } from "next/navigation" ;
77import { toast } from "sonner" ;
8+ import { Button } from "./ui/button" ;
9+ import { TriangleAlertIcon } from "lucide-react" ;
10+ import { Alert , AlertTitle , AlertDescription } from "./ui/alert" ;
811
912interface Message {
1013 role : string ;
@@ -214,50 +217,45 @@ export default function ChatInterface() {
214217
215218 return (
216219 < div className = "flex flex-col h-svh" >
217- < header className = "p-3 dark:text-white text-sm flex items-center justify-between border-b" >
218- < span className = "font-medium " > AgentAPI Chat</ span >
220+ < header className = "p-3 dark:text-white flex items-center justify-between border-b" >
221+ < span className = "font-bold " > AgentAPI Chat</ span >
219222
220- < div className = "flex items-center space-x-3" >
221- < div className = "flex items-center" >
223+ { serverStatus !== "unknown" && (
224+ < div className = "flex items-center gap-2 text-sm font-medium " >
222225 < span
223- className = { `w-2 h-2 rounded-full mr-2 ${
226+ className = { `text-secondary w-2 h-2 rounded-full ${
224227 [ "offline" , "unknown" ] . includes ( serverStatus )
225- ? "bg-red-500"
226- : "bg-green-500"
228+ ? "bg-red-500 ring-2 ring-red-500/35 "
229+ : "bg-green-500 ring-2 ring-green-500/35 "
227230 } `}
228- > </ span >
229- < span > Status: { serverStatus } </ span >
231+ />
232+ < span className = "sr-only" > Status:</ span >
233+ < span className = "first-letter:uppercase" > { serverStatus } </ span >
230234 </ div >
231- </ div >
235+ ) }
232236 </ header >
233237
234238 < main className = "flex flex-1 flex-col w-full overflow-auto" >
235- { ( serverStatus === "offline" || serverStatus === "unknown" ) && (
236- < div className = "bg-yellow-100 border-y border-yellow-400 text-yellow-800 px-4 py-3 flex items-center justify-between font-medium" >
237- < div className = "flex items-center" >
238- < svg
239- className = "w-5 h-5 mr-2"
240- fill = "currentColor"
241- viewBox = "0 0 20 20"
242- xmlns = "http://www.w3.org/2000/svg"
239+ { serverStatus === "offline" && (
240+ < div className = "p-4 w-full max-w-4xl mx-auto" >
241+ < Alert className = "flex border-yellow-500" >
242+ < TriangleAlertIcon className = "h-4 w-4 stroke-yellow-600" />
243+ < div >
244+ < AlertTitle > API server is offline</ AlertTitle >
245+ < AlertDescription >
246+ Please start the AgentAPI server. Attempting to connect to:{ " " }
247+ { agentAPIUrl || "N/A" } .
248+ </ AlertDescription >
249+ </ div >
250+ < Button
251+ variant = "ghost"
252+ size = "sm"
253+ className = "ml-auto"
254+ onClick = { ( ) => window . location . reload ( ) }
243255 >
244- < path
245- fillRule = "evenodd"
246- d = "M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z"
247- clipRule = "evenodd"
248- />
249- </ svg >
250- < span >
251- API server is offline. Please start the AgentAPI server.
252- Attempting to connect to: { agentAPIUrl || "N/A" } .
253- </ span >
254- </ div >
255- < button
256- onClick = { ( ) => window . location . reload ( ) }
257- className = "bg-yellow-200 px-3 py-1 rounded text-xs hover:bg-yellow-300"
258- >
259- Retry Connection
260- </ button >
256+ Retry
257+ </ Button >
258+ </ Alert >
261259 </ div >
262260 ) }
263261
0 commit comments