feat: Add lightweight Disconnect button

This commit is contained in:
Maxwell Gerber
2025-03-31 18:54:44 -07:00
parent fa7f9c80cd
commit 9ab213bc89
4 changed files with 31 additions and 11 deletions

View File

@@ -10,6 +10,7 @@ import {
EyeOff,
RotateCcw,
Settings,
RefreshCwOff,
} from "lucide-react";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
@@ -45,6 +46,7 @@ interface SidebarProps {
bearerToken: string;
setBearerToken: (token: string) => void;
onConnect: () => void;
onDisconnect: () => void;
stdErrNotifications: StdErrNotification[];
logLevel: LoggingLevel;
sendLogLevelRequest: (level: LoggingLevel) => void;
@@ -68,6 +70,7 @@ const Sidebar = ({
bearerToken,
setBearerToken,
onConnect,
onDisconnect,
stdErrNotifications,
logLevel,
sendLogLevelRequest,
@@ -375,19 +378,24 @@ const Sidebar = ({
</div>
<div className="space-y-2">
<Button className="w-full" onClick={onConnect}>
{connectionStatus === "connected" ? (
<>
{connectionStatus === "connected" && (
<div className="grid grid-cols-2 gap-4">
<Button onClick={onConnect}>
<RotateCcw className="w-4 h-4 mr-2" />
{transportType === "stdio" ? "Restart" : "Reconnect"}
</>
) : (
<>
<Play className="w-4 h-4 mr-2" />
Connect
</>
)}
</Button>
</Button>
<Button onClick={onDisconnect}>
<RefreshCwOff className="w-4 h-4 mr-2" />
Disconnect
</Button>
</div>
)}
{connectionStatus !== "connected" && (
<Button className="w-full" onClick={onConnect}>
<Play className="w-4 h-4 mr-2" />
Connect
</Button>
)}
<div className="flex items-center justify-center space-x-2 mb-4">
<div